Skip to content

whitespots-robot/VibeLMS

Repository files navigation

Vibe LMS - Learning Management System

A modern Learning Management System with hierarchical course structure, YouTube video integration, and comprehensive progress tracking for both authenticated and anonymous users.

Features

  • 🎯 Hierarchical structure: Course β†’ Chapter β†’ Lesson
  • πŸ“Ή YouTube video integration with embedded player
  • πŸ“ Rich text content with TipTap editor
  • πŸ–ΌοΈ Image and code example support
  • ❓ Interactive questions and assignments
  • πŸ“Š Individual progress tracking per user session
  • πŸ‘€ Anonymous user support with session continuity
  • πŸ“ File upload and materials management system
  • πŸ“¦ Course export to ZIP archives
  • πŸ”’ JWT-based authentication with secure HTTP-only cookies
  • πŸ‘₯ Role-based access control (Teachers/Instructors, Students)
  • 🌐 Public course preview without registration
  • πŸ“± Responsive mobile-first design
  • πŸŽ‰ Course completion celebrations

Technologies

  • Frontend: React 18, TypeScript, Tailwind CSS, Shadcn/ui components
  • Backend: Node.js, Express, TypeScript
  • Database: PostgreSQL with Drizzle ORM
  • Authentication: JWT tokens with HTTP-only cookies
  • State Management: TanStack Query (React Query)
  • Rich Text: TipTap editor
  • Build Tools: Vite
  • Containerization: Docker with multi-stage builds

Installation and Setup

Development

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Create a .env file with environment variables (see "Environment Variables" section)
  4. Start the application:
    npm run dev

Production with Docker

  1. Create a .env file with environment variables
  2. Start with Docker Compose:
    docker-compose up -d

The application will be available on port 80.

Environment Variables

Create a .env file in the project root with the following variables:

# PostgreSQL database password (REQUIRED)
POSTGRES_PASSWORD=your_secure_password_here

# JWT session secret (REQUIRED for production)
SESSION_SECRET=your_jwt_secret_key_here

# Additional variables for development (optional)
DATABASE_URL=postgresql://username:password@localhost:5432/vibelms
PGHOST=localhost
PGPORT=5432
PGUSER=username
PGPASSWORD=password
PGDATABASE=vibelms

Required Variables

  • POSTGRES_PASSWORD - PostgreSQL database password. Use a strong password for security.
  • SESSION_SECRET - Secret key for JWT token signing. Generate a random string (32+ characters).

Development Variables

If you're using a local database for development, add:

  • DATABASE_URL - Full PostgreSQL connection string
  • PGHOST - Database host (usually localhost)
  • PGPORT - Database port (usually 5432)
  • PGUSER - Database username
  • PGPASSWORD - Database user password
  • PGDATABASE - Database name

Project Structure

β”œβ”€β”€ client/               # Frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/   # React components
β”‚   β”‚   β”œβ”€β”€ pages/        # Application pages
β”‚   β”‚   β”œβ”€β”€ hooks/        # Custom hooks
β”‚   β”‚   └── lib/          # Utilities and configurations
β”œβ”€β”€ server/               # Backend application
β”‚   β”œβ”€β”€ index.ts          # Server entry point
β”‚   β”œβ”€β”€ routes.ts         # API routes
β”‚   β”œβ”€β”€ storage.ts        # Data access layer
β”‚   └── db.ts             # Database configuration
β”œβ”€β”€ shared/               # Shared types and schemas
β”‚   └── schema.ts         # Database schemas
β”œβ”€β”€ uploads/              # Uploaded files
β”œβ”€β”€ Dockerfile            # Docker configuration
β”œβ”€β”€ docker-compose.yml    # Docker Compose configuration
└── init-db.sql          # Database initialization script

Database

The application uses PostgreSQL with automatic migrations through Drizzle ORM. When running in Docker, the database structure is created automatically.

Database Commands

# Apply schema changes to the database
npm run db:push

# Open Drizzle Studio for data viewing
npm run db:studio

API Endpoints

Public Routes (No authentication required)

  • GET /api/public/courses - List public courses
  • GET /api/public/courses/:id - Get public course details
  • GET /api/public/lessons/:id/details - Get lesson content for preview
  • GET /api/settings/allow_student_registration - Check registration settings

Authentication Routes

  • POST /api/auth/login - User login
  • POST /api/auth/register - User registration
  • POST /api/auth/logout - User logout
  • GET /api/auth/user - Get current user info

Protected Routes (Authentication required)

  • GET /api/courses - User's courses
  • GET /api/courses/:id - Course details
  • GET /api/courses/:id/progress - User's progress in course
  • POST /api/progress - Update lesson progress
  • GET /api/enrollments - User's enrollments
  • POST /api/enrollments - Enroll in course
  • GET /api/materials - Course materials
  • POST /api/materials - Upload material

Admin Routes (Teacher/Instructor only)

  • GET /api/users - Manage users
  • DELETE /api/users/bulk - Delete multiple users
  • GET /api/dashboard/stats - System statistics

User Roles

  • Instructor/Teacher - Full course management, user administration, analytics access
  • Student - Course enrollment, progress tracking, material access
  • Anonymous - Public course preview, automatic session-based progress tracking

Security Features

  • JWT-based authentication with HTTP-only cookies
  • Automatic CSRF protection through SameSite cookie policy
  • File path validation prevents directory traversal attacks
  • Filename sanitization on upload
  • Role-based access control for API endpoints
  • Secure password hashing with bcrypt
  • Session-based anonymous user tracking

Deployment

Docker Production Deployment

  1. Clone the repository and create your .env file:

    cp .env.example .env
    # Edit .env with your secure passwords and secrets
  2. Generate secure secrets:

    # Generate a secure PostgreSQL password
    openssl rand -base64 32
    
    # Generate a secure JWT session secret
    openssl rand -base64 64
  3. Start the application:

    docker-compose up -d
  4. Check application status:

    docker-compose logs -f app
    docker-compose ps

The application will be available at http://localhost (port 80).

Health Monitoring

The application includes built-in health checks:

  • Docker health check endpoint: GET /api/health
  • Automatic container restart on failure
  • Database connection monitoring

Scaling and Performance

For production environments:

  • Use a reverse proxy (nginx) for SSL termination
  • Configure PostgreSQL with appropriate connection pooling
  • Monitor JWT session token expiration (7 days default)
  • Scale horizontally using Docker Swarm or Kubernetes

Support

For support, please create an issue in the project repository.

License

MIT License

About

Vibecoded Learning Management System

Topics

Resources

Security policy

Stars

Watchers

Forks

Packages

No packages published