Skip to content

anasbadawy/courses-progress-tracker-platform-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lesson Progress Tracker

A comprehensive lesson progress tracking system featuring Next.js frontend with App Router and scalable Node.js backend with layered architecture.

🏗️ Architecture Overview

Frontend (Next.js 14 + TypeScript + App Router)

  • App Router: Modern Next.js routing with server/client components
  • Progress Tracker: Interactive lesson management with real-time updates
  • Analytics Dashboard: Comprehensive learning analytics and insights
  • Responsive Design: Mobile-first approach with modern UI/UX

Backend (Node.js + Express + MongoDB + Redis)

  • Layered Architecture: Controllers → Services → Repositories
  • Caching: Redis and in-memory caching for performance
  • Validation: Express-validator for robust input validation
  • Authentication: JWT-based secure authentication
  • Error Handling: Comprehensive error management

📁 Project Structure

/
├── frontend/                    # Next.js App Router frontend
│   ├── app/                    # App Router pages
│   │   ├── layout.tsx          # Root layout
│   │   ├── page.tsx            # Home page (Progress Tracker)
│   │   └── analytics/          # Analytics dashboard
│   ├── components/             # Reusable components
│   ├── services/               # API service layer
│   └── types/                  # TypeScript interfaces
├── backend/                     # Node.js Express backend
│   ├── src/
│   │   ├── controllers/        # Request handlers
│   │   ├── services/           # Business logic
│   │   ├── repositories/       # Data access layer
│   │   ├── models/             # MongoDB schemas
│   │   ├── middleware/         # Express middleware
│   │   ├── routes/             # API routes
│   │   └── scripts/            # Database seeding
├── SYSTEM_DESIGN.md            # Comprehensive system design document
└── README.md                   # This file

🚀 Features

Frontend Features

  • Progress Tracking: Visual progress indicators and completion status
  • Analytics Dashboard: Personal and platform-wide analytics
  • Real-time Updates: Optimistic updates with error handling
  • Responsive Design: Works seamlessly on all devices
  • Loading States: Smooth user experience with loading indicators

Backend Features

  • RESTful API: Well-designed endpoints following REST principles
  • Layered Architecture: Separation of concerns with controllers, services, repositories
  • Caching: Multi-level caching with Redis and in-memory cache
  • Input Validation: Comprehensive validation using express-validator
  • Authentication: Secure JWT-based authentication
  • Analytics: Advanced aggregation pipelines for insights
  • Error Handling: Robust error management with proper status codes

🔌 API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - User login
  • POST /api/auth/verify - Verify JWT token

User Progress

  • GET /api/users/:id/progress - Get user's lesson progress
  • POST /api/users/:id/lessons/:lessonId/complete - Mark lesson complete
  • GET /api/users/:id/analytics - Get detailed user analytics

Lessons

  • GET /api/lessons - Get all lessons (with filtering/pagination)
  • GET /api/lessons/:id - Get specific lesson
  • GET /api/lessons/:id/stats - Get lesson completion statistics
  • POST /api/lessons - Create new lesson
  • GET /api/lessons/tracks - Get all available tracks
  • GET /api/lessons/track/:track - Get lessons by track
  • GET /api/lessons/analytics/overview - Get overall platform analytics

🛠️ Getting Started

Prerequisites

  • Node.js 18+
  • MongoDB 4.4+
  • npm or yarn

Backend Setup

cd backend
npm install

# Copy and configure environment variables
cp env.example .env
# Edit .env with your configurations

# Seed database with sample data
npm run seed

# Start development server
npm run dev

Frontend Setup

cd frontend
npm install

# Start development server
npm run dev

The frontend will be available at http://localhost:3000 and the backend API at http://localhost:3001.

📊 Analytics Dashboard

The analytics dashboard provides insights into:

  • Personal Progress: Individual user statistics and breakdowns
  • Platform Overview: System-wide analytics and performance metrics
  • Track Performance: Progress by learning tracks
  • Difficulty Analysis: Performance across difficulty levels
  • Completion Rates: Lesson-by-lesson completion statistics

🏗️ Architecture Decisions

Frontend (Next.js App Router)

  • App Router: Modern routing with better performance and developer experience
  • Server Components: Optimal performance with selective client-side hydration
  • TypeScript: Type safety throughout the application
  • Tailwind CSS: Utility-first styling for rapid development

Backend (Layered Architecture)

  • Controllers: Handle HTTP requests and responses
  • Services: Contain business logic and orchestrate operations
  • Repositories: Provide data access abstraction
  • Middleware: Handle cross-cutting concerns (auth, validation, caching)

Caching Strategy

  • Application Cache: In-memory caching for frequently accessed data
  • Redis Cache: Distributed caching for scalability (ready for Redis integration)
  • Database Optimization: Proper indexing and aggregation pipelines

Validation & Security

  • Input Validation: Express-validator for comprehensive request validation
  • Authentication: JWT tokens with proper expiration
  • Rate Limiting: Protection against abuse
  • CORS: Configured for secure cross-origin requests
  • Helmet: Security headers for protection

🔧 Environment Variables

Backend (.env)

PORT=3001
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/lesson_progress_tracker
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRES_IN=7d
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
ALLOWED_ORIGINS=http://localhost:3000

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:3001/api

📈 Performance & Scalability

Current Optimizations

  • Caching: Multi-level caching strategy
  • Database Indexing: Optimized queries with proper indexes
  • Compression: Gzip compression for API responses
  • Pagination: Efficient data loading with pagination
  • Aggregation Pipelines: Optimized analytics queries

Future Scalability (See SYSTEM_DESIGN.md)

  • Microservices Architecture: Service decomposition
  • Event Streaming: Real-time analytics with Kinesis/Kafka
  • Database Sharding: Horizontal scaling strategies
  • Container Orchestration: Kubernetes deployment
  • CDN Integration: Global content delivery

🧪 Sample Data

Run the seed script to populate the database with realistic sample data:

cd backend
npm run seed

This creates:

  • 3 Users: With different progress levels
  • 8 Lessons: Across multiple tracks and difficulties
  • Progress Data: Realistic completion times and scores

📚 System Design

For detailed system architecture, scalability considerations, and future enhancements, see SYSTEM_DESIGN.md.

🚀 Production Deployment

Docker Support (Coming Soon)

  • Containerized frontend and backend
  • Docker Compose for local development
  • Production-ready configurations

Cloud Deployment Considerations

  • Frontend: Vercel/Netlify deployment
  • Backend: AWS ECS/EKS or Google Cloud Run
  • Database: MongoDB Atlas or self-hosted
  • Caching: Redis Cloud or ElastiCache
  • Monitoring: Application and infrastructure monitoring

🤝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

📄 License

This project is licensed under the MIT License.

About

boilerplate for a comprehensive lesson progress tracking system featuring Next.js frontend with App Router and scalable Node.js backend with layered architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors