Skip to content

Commit adefa2e

Browse files
committed
migrate to nextjs
1 parent e4aabf5 commit adefa2e

32 files changed

+10196
-0
lines changed

.DS_Store

10 KB
Binary file not shown.

soulmedicine-nextjs/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

soulmedicine-nextjs/README.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Soul Medicine - Next.js Migration
2+
3+
This is the Next.js version of Soul Medicine, migrated from Vue.js and Ruby on Rails. A platform providing healing pathways and personalized content for mental health and recovery journeys.
4+
5+
## Architecture
6+
7+
- **Frontend**: Next.js 15 with TypeScript and Material-UI
8+
- **Backend**: Next.js API routes
9+
- **Database**: PostgreSQL with UUID primary keys
10+
- **Authentication**: Firebase Auth
11+
- **CMS**: Storyblok
12+
- **Caching**: Redis
13+
- **Deployment**: Vercel (recommended)
14+
15+
## Features Migrated
16+
17+
### Vue Components → React Components
18+
- ✅ Authentication (sign_in.vue → SignIn.tsx)
19+
- ✅ User Profile (profile.vue → Profile.tsx)
20+
- ✅ Cookie Law Banner (cookie_law.vue → CookieBanner.tsx)
21+
- ✅ Leave Site Emergency Exit (leave_site.vue → LeaveSite.tsx)
22+
23+
### Rails Backend → Next.js API Routes
24+
- ✅ Authentication endpoints (/api/auth/*)
25+
- 🔄 Course management (/api/courses/*)
26+
- 🔄 Lesson management (/api/lessons/*)
27+
- 🔄 Subscription management (/api/subscriptions/*)
28+
- 🔄 User reactions (/api/reactions/*)
29+
- 🔄 Voting system (/api/votes/*)
30+
- 🔄 Profile management (/api/profile/*)
31+
32+
### Database Models
33+
- ✅ Core database connection and querying
34+
- ✅ User model structure
35+
- 🔄 Subscription model with timezone handling
36+
- 🔄 Course and lesson models (CMS integration)
37+
- 🔄 Reaction and voting models
38+
- 🔄 Progress tracking
39+
40+
## Getting Started
41+
42+
### Prerequisites
43+
- Node.js 18+
44+
- PostgreSQL database
45+
- Redis instance
46+
- Firebase project
47+
- Storyblok account
48+
49+
### Installation
50+
51+
1. Clone the repository and navigate to the Next.js project:
52+
```bash
53+
cd soulmedicine-nextjs
54+
npm install
55+
```
56+
57+
2. Set up environment variables:
58+
```bash
59+
cp .env.example .env.local
60+
# Edit .env.local with your configuration
61+
```
62+
63+
3. Set up the database:
64+
```bash
65+
# Run the PostgreSQL migrations from the original Rails app
66+
# or recreate the schema using the database structure
67+
```
68+
69+
4. Start the development server:
70+
```bash
71+
npm run dev
72+
```
73+
74+
Open [http://localhost:3000](http://localhost:3000) to see the application.
75+
76+
## Environment Variables
77+
78+
### Required Environment Variables
79+
80+
```env
81+
# Database
82+
DATABASE_HOST=localhost
83+
DATABASE_PORT=5432
84+
DATABASE_USER=your_db_user
85+
DATABASE_PASSWORD=your_db_password
86+
DATABASE_NAME=soulmedicine
87+
88+
# Firebase (get from Firebase console)
89+
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
90+
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
91+
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
92+
FIREBASE_PROJECT_ID=your_project_id
93+
FIREBASE_CLIENT_EMAIL=your_service_account_email
94+
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
95+
96+
# Redis
97+
REDIS_HOST=localhost
98+
REDIS_PORT=6379
99+
REDIS_PASSWORD=optional_password
100+
101+
# Storyblok CMS
102+
STORYBLOK_API_TOKEN=your_storyblok_token
103+
```
104+
105+
## Migration Status
106+
107+
### ✅ Completed
108+
- Next.js project setup with TypeScript
109+
- Material-UI theme and styling system
110+
- Firebase authentication integration
111+
- Database connection and models setup
112+
- Basic React components for core features
113+
- Project structure and configuration
114+
115+
### 🔄 In Progress
116+
- API route implementations
117+
- CMS integration with Storyblok
118+
- Email subscription system
119+
- Course and lesson management
120+
121+
### 📋 To Do
122+
- Multi-language support (i18n)
123+
- Email templates and delivery
124+
- Background job processing
125+
- Testing suite
126+
- Deployment configuration
127+
- Performance optimization
128+
129+
## Key Differences from Rails Version
130+
131+
1. **Client-side routing**: Uses Next.js App Router instead of Rails routes
132+
2. **Authentication**: Firebase client SDK + server-side verification
133+
3. **Styling**: Material-UI instead of Bootstrap + SCSS
134+
4. **State management**: React hooks instead of Vue reactive data
135+
5. **API design**: RESTful Next.js API routes instead of Rails controllers
136+
6. **Background jobs**: Will need external solution (Vercel Cron, etc.) instead of Sidekiq
137+
138+
## Development Scripts
139+
140+
```bash
141+
# Development server with Turbopack
142+
npm run dev
143+
144+
# Production build
145+
npm run build
146+
npm run start
147+
148+
# Linting
149+
npm run lint
150+
```
151+
152+
## Deployment
153+
154+
This project is designed to deploy on Vercel, but can be deployed to any Node.js hosting platform.
155+
156+
### Vercel Deployment
157+
1. Connect your GitHub repository to Vercel
158+
2. Set environment variables in Vercel dashboard
159+
3. Deploy automatically on push to main branch
160+
161+
### Database Setup
162+
The application expects a PostgreSQL database with the same schema as the Rails version. You can either:
163+
1. Import data from the existing Rails database
164+
2. Run Rails migrations to create the schema
165+
3. Use the provided SQL schema file (when available)
166+
167+
## Contributing
168+
169+
This is a migration project converting the Ruby on Rails + Vue.js Soul Medicine application to Next.js. The goal is to maintain feature parity while modernizing the tech stack.
170+
171+
Key principles:
172+
- Maintain the same user experience
173+
- Preserve all data and functionality
174+
- Improve performance and developer experience
175+
- Keep the same database structure for easy migration
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
});
11+
12+
const eslintConfig = [
13+
...compat.extends("next/core-web-vitals", "next/typescript"),
14+
];
15+
16+
export default eslintConfig;

soulmedicine-nextjs/next.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
};
6+
7+
export default nextConfig;

0 commit comments

Comments
 (0)