A robust digital transformation education platform where users can purchase courses, study free courses, take quizzes, practice skills, and more.
- Next.js 14 - React framework with App Router
- TypeScript - Type safety
- TailwindCSS - Styling
- TanStack Query - Server state management
- Zustand - Client state management
- React Hook Form + Zod - Form handling and validation
- Node.js + Express - API server
- TypeScript - Type safety
- MongoDB Atlas - Database
- Mongoose - ODM
- JWT - Authentication
- Stripe - Payment processing
dx_ed/
├── apps/
│ ├── web/ # Next.js frontend
│ │ ├── src/
│ │ │ ├── app/ # App router pages
│ │ │ ├── components/ # React components
│ │ │ ├── hooks/ # Custom hooks
│ │ │ ├── lib/ # Utilities & API
│ │ │ ├── stores/ # Zustand stores
│ │ │ └── types/ # TypeScript types
│ │ └── ...
│ │
│ └── api/ # Express backend
│ └── src/
│ ├── config/ # Configuration
│ ├── controllers/ # Route handlers
│ ├── middleware/ # Express middleware
│ ├── models/ # Mongoose models
│ ├── routes/ # Route definitions
│ ├── services/ # Business logic
│ ├── utils/ # Helpers
│ └── validators/ # Zod schemas
│
└── packages/ # Shared packages
- Node.js 20+
- npm 9+
- MongoDB Atlas account
- Stripe account (for payments)
-
Clone the repository
git clone <repository-url> cd dx_ed
-
Install dependencies
npm install
-
Set up environment variables
Backend (
apps/api/.env):cp apps/api/.env.example apps/api/.env
Edit the
.envfile with your values:MONGODB_URI- Your MongoDB Atlas connection stringJWT_SECRET- A secure random stringSTRIPE_SECRET_KEY- Your Stripe secret keySTRIPE_WEBHOOK_SECRET- Your Stripe webhook secret
Frontend (
apps/web/.env.local):cp apps/web/.env.example apps/web/.env.local
-
Start development servers
# Start both frontend and backend npm run dev # Or start individually npm run dev:api # Backend on http://localhost:5000 npm run dev:web # Frontend on http://localhost:3000
- Browse free and premium courses
- Enroll in courses
- Track progress through lessons
- Take quizzes with various question types
- Earn badges and certificates
- View learning analytics
- Create and manage courses
- Build modules and lessons
- Create quizzes and assessments
- View student analytics
- Manage course pricing
- User management
- Course moderation
- Category management
- Revenue reports
- Platform settings
POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- LoginPOST /api/v1/auth/logout- LogoutPOST /api/v1/auth/refresh- Refresh tokenGET /api/v1/auth/me- Get current user
GET /api/v1/courses- List coursesGET /api/v1/courses/:slug- Get course detailsPOST /api/v1/courses/:slug/enroll- Enroll in coursePATCH /api/v1/courses/:slug/lessons/:lessonId/complete- Mark lesson complete
GET /api/v1/quizzes/:quizId- Get quizPOST /api/v1/quizzes/:quizId/start- Start quiz attemptPOST /api/v1/quizzes/:quizId/submit- Submit answers
POST /api/v1/payments/checkout- Create checkout sessionPOST /api/v1/payments/subscription- Create subscriptionPOST /api/v1/payments/webhook- Stripe webhook
- User - User accounts and profiles
- Course - Course content and metadata
- Enrollment - User-course relationships and progress
- Quiz - Assessments and questions
- Category - Course categories
- Order - Purchase history
- Review - Course reviews
- Badge - Achievement badges
# Development
npm run dev # Start all services
npm run dev:web # Start frontend only
npm run dev:api # Start backend only
# Building
npm run build # Build all
npm run build:web # Build frontend
npm run build:api # Build backend
# Linting
npm run lint # Lint all
# Testing
npm run test # Run tests| Variable | Description |
|---|---|
PORT |
Server port (default: 5000) |
MONGODB_URI |
MongoDB connection string |
JWT_SECRET |
JWT signing secret |
JWT_REFRESH_SECRET |
Refresh token secret |
STRIPE_SECRET_KEY |
Stripe API key |
STRIPE_WEBHOOK_SECRET |
Stripe webhook secret |
| Variable | Description |
|---|---|
NEXT_PUBLIC_API_URL |
Backend API URL |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY |
Stripe public key |
- Connect GitHub repository
- Set environment variables
- Deploy
- Create new project
- Connect GitHub repository
- Set environment variables
- Deploy
- Create cluster
- Set up network access
- Create database user
- Get connection string
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
MIT License - see LICENSE file for details.