A comprehensive online course management system built with FastAPI backend and Next.js frontend.
- Course Discovery: Browse and search available courses
- Enrollment: Enroll in courses with one click
- Progress Tracking: Track lesson completion and overall progress
- Interactive Learning: Access video content and lesson materials
- Dashboard: Personal dashboard with learning statistics
- Course Creation: Create and manage courses with rich content
- Lesson Management: Add, edit, and organize lessons with video content
- Student Analytics: Monitor student progress and engagement
- Content Publishing: Control course and lesson visibility
- Student Management: View enrolled students per course
- User Authentication: Secure registration and login system
- Role-based Access: Different permissions for students and instructors
- Responsive Design: Works on desktop, tablet, and mobile devices
- Modern UI: Clean and intuitive user interface with Tailwind CSS
- Real-time Updates: Dynamic content updates without page refresh
- FastAPI: Modern, fast web framework for Python APIs
- SQLAlchemy: SQL toolkit and ORM for database operations
- SQLite: Lightweight database (easily switchable to PostgreSQL)
- JWT Authentication: Secure token-based authentication
- Pydantic: Data validation using Python type annotations
- Uvicorn: ASGI web server for Python
- Next.js 14: React framework with App Router
- TypeScript: Type-safe JavaScript development
- Tailwind CSS: Utility-first CSS framework
- React Query: Data fetching and state management
- React Hook Form: Performant forms with easy validation
- Lucide React: Beautiful and consistent icons
Before running this application, make sure you have the following installed:
- Python 3.8+ (Python 3.11+ recommended)
- Node.js 18+ (Node.js 20+ recommended)
- npm (comes with Node.js)
- Git (for cloning the repository)
python3 --version # Should show 3.8 or higher
node --version # Should show 18 or higher
npm --version # Should show 8 or higher-
Clone the repository:
git clone <repository-url> cd course-management-system
-
Run the startup script:
chmod +x start.sh ./start.sh
This script will:
- Create Python virtual environment
- Install all dependencies
- Set up environment files
- Create database tables
- Start both backend and frontend servers
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
Navigate to backend directory:
cd backend -
Create and activate virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env # Edit .env file if needed -
Create database tables:
python -c "from app.database import create_tables; create_tables()" -
Start the backend server:
uvicorn app.main:app --reload --port 8000
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Set up environment variables:
cp .env.local.example .env.local # Edit .env.local if needed -
Start the frontend server:
npm run dev
-
Register an Account:
- Go to http://localhost:3000/register
- Choose "Student" or "Instructor" during registration
- Complete the registration form
-
Login:
- Go to http://localhost:3000/login
- Use your credentials to sign in
-
Browse Courses:
- Visit the home page to see available courses
- Use search and filters to find specific courses
-
Enroll in Courses:
- Click on a course to view details
- Click "Enroll" to join the course
-
Learn:
- Access enrolled courses from your dashboard
- Complete lessons and track your progress
-
Create Courses:
- Go to your dashboard
- Click "Create New Course"
- Fill in course details and publish
-
Add Lessons:
- Enter your course
- Click "Add Lesson"
- Upload content and organize lessons
-
Manage Students:
- View enrolled students
- Track student progress
- Monitor course analytics
DATABASE_URL=sqlite:///./course_management.db
SECRET_KEY=your-secret-key-here-change-in-productionNEXT_PUBLIC_API_URL=http://localhost:8000The system uses SQLite by default for easy setup. To use PostgreSQL:
- Install PostgreSQL
- Update
DATABASE_URLin backend/.env:DATABASE_URL=postgresql://username:password@localhost/course_management
- Install psycopg2-binary:
pip install psycopg2-binary
course-management-system/
βββ backend/ # FastAPI backend
β βββ app/
β β βββ __init__.py
β β βββ main.py # FastAPI app and routes
β β βββ database.py # Database models and config
β β βββ schemas.py # Pydantic schemas
β β βββ auth.py # Authentication utilities
β β βββ routers/ # API route modules
β β βββ auth.py # Authentication routes
β β βββ courses.py # Course management routes
β β βββ lessons.py # Lesson management routes
β β βββ dashboard.py # Dashboard and stats routes
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment variables template
β βββ venv/ # Virtual environment (created)
βββ frontend/ # Next.js frontend
β βββ app/ # App Router pages
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β β βββ login/ # Login page
β β βββ register/ # Registration page
β β βββ dashboard/ # Dashboard page
β βββ components/ # Reusable components
β β βββ ui/ # UI components
β β βββ Layout/ # Layout components
β βββ lib/ # Utilities and configuration
β β βββ api.ts # API client
β β βββ contexts/ # React contexts
β β βββ providers/ # React providers
β βββ package.json # Node.js dependencies
β βββ .env.local.example # Environment variables template
β βββ tailwind.config.js # Tailwind CSS configuration
β βββ tsconfig.json # TypeScript configuration
β βββ node_modules/ # Node.js modules (created)
βββ start.sh # Startup script
βββ README.md # This file
When the backend is running, you can access the interactive API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
POST /auth/register- User registrationPOST /auth/token- User loginGET /auth/me- Get current user info
GET /courses/- List all coursesPOST /courses/- Create new course (instructors only)GET /courses/{id}- Get course detailsPUT /courses/{id}- Update course (instructor only)POST /courses/{id}/enroll- Enroll in course
GET /courses/{course_id}/lessons- Get course lessonsPOST /lessons/- Create lesson (instructors only)PUT /lessons/{id}- Update lesson (instructor only)POST /lessons/{id}/progress- Mark lesson as completed
-
Port already in use:
# Kill existing processes pkill -f "uvicorn.*8000" # Backend pkill -f "next.*3000" # Frontend
-
Python virtual environment issues:
# Remove and recreate venv rm -rf backend/venv cd backend && python3 -m venv venv
-
Node.js dependency issues:
# Clear npm cache and reinstall cd frontend rm -rf node_modules package-lock.json npm install
-
Database issues:
# Delete and recreate database rm backend/course_management.db cd backend && python -c "from app.database import create_tables; create_tables()"
- Check the API documentation at http://localhost:8000/docs
- Look at the browser console for frontend errors
- Check terminal output for backend errors
- Ensure all environment variables are properly set
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- 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