A comprehensive online learning platform inspired by Coursera, built with modern web technologies. This system allows students to enroll in courses, instructors to create and manage educational content, and administrators to oversee the entire platform.
The application follows a microservices architecture with three main components:
- Client: React-based frontend application
- Server: TypeScript-based backend API service
- ChatServer: Dedicated service for real-time communication and AI features
The backend is structured following Domain-Driven Design (DDD) principles, which organizes the codebase around business domains and concepts. This approach enhances maintainability, scalability, and aligns the code structure with the business requirements.
Each module in the system follows a consistent structure with these layers:
The core of the module containing business logic and rules:
- Entities: Core business objects (e.g.,
Course,Lesson,Enrollment) - Value Objects: Immutable objects representing concepts with no identity (e.g.,
CourseTitle,LessonComplexity) - Domain Services: Services that operate on multiple entities (e.g.,
CourseService,LearningService) - Domain Events: Events that occur within the domain
Coordinates application activities and delegates work to domain objects:
- Application Services: Orchestrate the execution of domain logic
- DTOs (Data Transfer Objects): Objects for transferring data between layers
Provides technical capabilities to support the higher layers:
- Repositories: Data access implementations (e.g.,
CourseRepository,LessonRepository) - External Services: Integration with external systems (e.g., AI services, gRPC clients)
Handles user interaction and displays information:
- Controllers: Handle HTTP requests and responses (e.g.,
CourseController,AIController) - Routes: Define API endpoints (e.g.,
courseRoutes,aiRoutes)
-
Course Module
- Manages course creation, retrieval, and management
- Key components:
Course,CourseTitle,CourseDescription,CoursePrice,CourseService,CourseFactory,CourseRepository,CourseController
-
Lesson Module
- Handles lesson content and structure within courses
- Key components:
Lesson,LessonTitle,LessonComplexity,LessonType,LessonService,LessonFactory,LessonRepository
-
AI Module
- Provides AI-powered features and integrations
- Key components:
AIService,AIController,AIMessage - Integrates with external AI services via gRPC and GraphQL
-
Learning Module
- Manages student learning experiences
- Key components:
LearningProgress,Enrollment,ProcessStatus,LearningService,LearningFactory,LearningRepository,LearningController
-
Enrollment Module
- Handles course enrollment processes
- Key components:
Enrollment,EnrollmentStatus,EnrollmentService,EnrollmentFactory,EnrollmentRepository,EnrollmentController
-
LearnProgress Module
- Tracks student progress through course materials
- Key components:
LearnProgress,ProcessStatus,LearnProgressService,LearnProgressFactory,LearnProgressRepository,LearnProgressController
-
Statistics Module
- Provides analytics and reporting features
- Key components:
StatisticsService,StatisticsController,StatisticsRepository - DTOs:
RevenueStatisticsDTO,KeywordTrendDTO,MonthlyRevenueDTO,CourseRevenueDTO
Modules are integrated through a central routing system:
// DDD Routes integration
const DddRouter = Router();
DddRouter.use('/course', courseRoutes);
DddRouter.use('/ai', aiRoutes);
DddRouter.use('/learning', learningRoutes);
DddRouter.use('/enrollment', enrollmentRoutes);
DddRouter.use('/learn-progress', learnProgressRoutes);
DddRouter.use('/statistics', statisticsRoutes);
// Mount Domain routes to main API
router.use("/apiv2", DomainRouter);modules/course/
├── controllers/ # Presentation layer
│ └── course.co.ts # Course controller
├── domain/ # Domain layer
│ ├── course.ts # Course entity and value objects
│ ├── course.service.ts # Course domain service
│ └── factories/ # Factory methods
│ └── course.factory.ts
├── dto/ # Data Transfer Objects
│ └── course.dto.ts
├── repositories/ # Infrastructure layer
│ ├── ICourse.repo.ts # Repository interface
│ └── Implement/
│ └── Course.repo.ts # Repository implementation
├── routes/ # API routes
│ └── course.route.ts
└── index.ts # Module exports
- React with Redux for state management
- Vite as the build tool
- Tailwind CSS for styling
- End-to-end testing with Selenium WebDriver
- Node.js with Express
- TypeScript for type safety
- PostgreSQL database
- MongoDB for chat and messaging features
- RESTful APIs
- GraphQL
- gRPC for service-to-service communication
- Socket.IO for real-time features
- Groq AI integration for intelligent features
- Docker containerization
- Kubernetes orchestration
- Nginx as a load balancer
- Browse and search courses
- Enroll in courses
- Track learning progress
- Participate in discussion forums
- Access AI-powered learning assistance
- Create and manage courses
- Upload lesson materials
- Monitor student progress
- Engage with students through forums
- User management
- Course oversight
- Revenue statistics and analytics
- System monitoring and maintenance
├── client/ # Frontend React application
│ ├── src/ # Source code
│ ├── e2e/ # End-to-end tests
│ └── public/ # Static assets
├── server/ # Backend API service
│ ├── src/ # Source code
│ │ ├── api/ # API routes and controllers
│ │ ├── config/ # Configuration files
│ │ └── modules/ # DDD modules
│ └── tests/ # Test files
├── chatserver/ # Chat and real-time service
│ ├── src/ # Source code
│ │ ├── api/ # API routes
│ │ ├── graphql/ # GraphQL schema and resolvers
│ │ ├── grpc/ # gRPC service definitions
│ │ ├── model/ # MongoDB models
│ │ └── socket/ # Socket.IO implementation
│ └── tests/ # Test files
├── k8s/ # Kubernetes configuration
│ └── deployments/ # Kubernetes deployment files
├── nginx/ # Nginx configuration
└── docker-compose.yml # Docker Compose configuration
- Node.js (v18.12.1 or higher)
- npm (v8.19.2 or higher) or yarn (v1.22.19 or higher)
- PostgreSQL (v12.11 or higher)
- MongoDB
- Docker and Docker Compose (for containerized deployment)
git clone https://github.com/yourusername/coursera-clone.git
cd coursera-clonecd client
npm install
npm run devThe client will be available at http://localhost:5173
cd server
npm install
npm run devThe server will be available at http://localhost:5001
cd chatserver
npm install
npm run devThe chat server will be available at http://localhost:5003 with Socket.IO on port 5004 and gRPC on port 50051
To deploy the entire application using Docker Compose:
docker-compose up -dThis will start all services and make them available through the Nginx load balancer on port 80.
The k8s directory contains scripts and configuration files for deploying the application on a Kubernetes cluster:
chmod +x k8s/setup-cluster.sh
./k8s/setup-cluster.shAfter deployment, the application will be available at http://coursera.zapto.org
cd client
npm test # Run unit tests
npm run test:e2e # Run end-to-end testscd server
npm test- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by Coursera's learning platform
- Built with modern web technologies and best practices
- Designed with scalability and maintainability in mind