Production-Ready Learning Management System by Codezela Technologies
Developed with ❤️ by Codezela Technologies
Features • Tech Stack • Getting Started • Documentation • Architecture
- Overview
- Features
- Tech Stack
- Architecture
- Getting Started
- Project Structure
- API Reference
- Database Schema
- Deployment
- Best Practices
- Contributing
- License
Codezela Career Accelerator LMS is a comprehensive, enterprise-grade Learning Management System designed for modern educational institutions, corporate training programs, and online academies. Built with cutting-edge technologies and featuring a sleek terminal-inspired aesthetic, it delivers a complete end-to-end learning experience.
✅ Production-Ready - Battle-tested with real users, zero downtime deployments
✅ Type-Safe - 100% TypeScript with Prisma-generated types
✅ Secure by Design - Row-Level Security, audit logging, NextAuth v5
✅ Performance Optimized - Turbopack bundling, React Server Components, edge runtime
✅ Fully Featured - Quiz system, multi-format resources, bulk enrollment, analytics
✅ Responsive Design - Mobile-first UI that works on all devices
✅ SEO Protected - robots.txt and meta tags configured for privacy
✅ Google Analytics - Built-in tracking and insights
- Terminal Aesthetic - Dark green on black theme inspired by classic terminals
- Intelligent Content Rendering - Automatically detects and embeds YouTube, Vimeo videos
- Admin-Controlled Enrollment - No self-service enrollment, full admin control
- Bulk CSV Enrollment - Upload hundreds of students instantly
- Real-time Progress Tracking - Live lesson completion and quiz scores
- Multi-Format Resources - Videos, PDFs, links, embedded content, rich text notes
- Three-Tier Hierarchy: Programmes → Modules → Lessons
- Drag-and-Drop Reordering: Intuitive content organization
- Status Management: Draft, Published, Archived states
- Visibility Controls: Schedule content release dates
- Enrollment Tracking: Real-time capacity monitoring
- Bulk Operations: Mass student enrollment via CSV
The system supports diverse lesson formats:
-
Video Lessons
- Direct video file uploads to Cloudflare R2
- YouTube Integration - Automatic embed detection
- Vimeo Integration - Native player embedding
- HTML5 video player with progress tracking
- Auto-mark complete on video end
-
Rich Text Content
- Full HTML support with custom styling
- Code syntax highlighting
- Tables, lists, blockquotes
- Image embedding
- Terminal-themed typography
-
Interactive Quizzes
- Multiple choice questions
- True/False questions
- Short answer (manual grading)
- Essay questions (manual grading)
-
Resource-Based Lessons
- Multiple attachments per lesson
- Mix and match content types
- Scheduled availability
Full System Control:
- User Management
- Create, edit, delete users (students, lecturers, admins)
- Bulk CSV enrollment with validation
- Download enrollment templates
- Account status management (Active, Suspended, Deleted)
- Password reset capabilities
- Programme Management
- Create/edit/delete programmes
- Module and lesson organization
- Content visibility controls
- Enrollment capacity settings
- Analytics Dashboard
- Total users, programmes, enrollments
- Recent activity logs
- System-wide statistics
- 20+ action types tracked
- Audit Logging
- Every user action logged with metadata
- IP address and user agent tracking
- Timestamps and entity references
- Filterable audit trail
Content Creation & Student Management:
- Programme Development
- Create and publish programmes
- Build multi-module courses
- Upload video content
- Add lesson resources
- Quiz Management
- Visual quiz builder (673 lines of code)
- 4 question types supported
- Automatic and manual grading
- Result analytics
- Student Oversight
- View enrolled students
- Track individual progress
- Grade text-based submissions
- Generate progress reports
- Resource Library
- Upload files (20MB limit)
- Create rich text notes
- Add external links
- Embed videos/iframes
Learning Experience:
- Programme Access
- View assigned programmes only (admin-controlled)
- No self-enrollment capability
- Progress tracking dashboard
- Recently accessed lessons
- Lesson Interaction
- Watch videos (YouTube/Vimeo/direct)
- Read text content
- Download resources
- Mark lessons complete
- Quiz Taking
- Timed quiz attempts
- Question navigation
- Save and resume support
- Instant score feedback
- Progress Monitoring
- Completion percentages
- Quiz scores and attempts
- Learning activity history
- Achievement tracking
Comprehensive quiz creation tool with:
Question Types:
-
Multiple Choice
- Single correct answer
- Radio button interface
- Up to 10 answer options
- Point value configuration
- Explanation field for feedback
-
True/False
- Binary questions
- Toggle-based selection
- Quick grading
- Explanation support
-
Short Answer
- Text input field
- Manual grading required
- 20 character limit
- Rubric support
-
Essay Questions
- Long-form responses
- Rich text area
- Manual grading workflow
- Detailed feedback options
Quiz Settings:
- Time Limit: Set duration in minutes (0 = unlimited)
- Passing Score: Define threshold percentage
- Attempts: Limit number of tries
- Question Shuffling: Randomize question order
- Answer Shuffling: Randomize answer order (MC only)
- Show Correct Answers: Display after submission
- Immediate Results: Show score instantly
Grading Features:
- Auto-grading for MC and T/F (instant results)
- Manual grading interface for text responses
- Partial credit support
- Bulk grading capabilities
- Score analytics and statistics
Optimized quiz-taking experience:
- Visual Timer: Countdown with color-coded alerts
- Progress Tracker: Question completion indicator
- Smart Navigation: Jump to any question
- Auto-Save: Progress saved every 30 seconds
- Visual Feedback: Answered vs unanswered highlighting
- Results Display:
- Total score and percentage
- Pass/Fail indicator
- Question-by-question breakdown
- Correct answer reveal (if enabled)
- Explanation display
-
FILE Upload (Cloudflare R2)
- Supported Formats: PDF, DOCX, XLSX, PPT, images, videos, archives
- File Size Limit: 20MB per file
- Drag & Drop: Modern upload interface with progress bars
- Signed URLs: Secure downloads with 1-hour expiry
- Version Control: Complete upload history
- Metadata: Filename, MIME type, file size tracking
-
EXTERNAL_LINK
- Link to any web resource
- Documentation sites
- Online articles
- Reference materials
- Opens in new tab
-
EMBEDDED Content
- YouTube videos (auto-detection)
- Vimeo videos (auto-detection)
- Custom iframe embeds
- Interactive content (CodePen, JSFiddle)
- Google Forms/Slides
- Aspect-ratio responsive containers
-
TEXT_NOTE
- Rich HTML content
- Custom terminal-themed prose styling
- Syntax-highlighted code blocks
- Markdown-style formatting
- Tables and lists
- Embedded images
- Drag-and-Drop Reordering: Change resource sequence
- Visibility Controls:
- PUBLIC: Visible to all enrolled students
- SCHEDULED: Visible after specific date/time
- HIDDEN: Accessible only to lecturers/admins
- Downloadable Toggle: Enable/disable download button
- Edit Metadata: Update title, description, visibility
- Version History: Track all resource changes
- Bulk Actions: Delete multiple resources
- Preview Support: View before publishing
- NextAuth v5: Industry-standard authentication
- JWT Tokens: Secure session management (30-day expiry)
- bcrypt Hashing: Password security with 12 salt rounds
- HTTP-Only Cookies: XSS attack prevention
- CSRF Protection: Built-in Next.js security
- Role-Based Access: Enforced at API and UI levels
- Row-Level Security (RLS): PostgreSQL policies on all 15 tables
- Prepared Statements: Prisma prevents SQL injection
- Connection Pooling: Optimized database connections
- Encrypted Connections: SSL/TLS for all database traffic
- Automatic Backups: Daily Supabase snapshots
- Type Validation: MIME type checking
- Size Limits: 20MB hard cap
- Virus Scanning: Cloudflare security features
- Signed URLs: Expiring download links (1 hour)
- Access Control: File access tied to enrollment
Every action tracked with:
- User ID and role
- Action type (20+ types)
- Entity type and ID
- Metadata (JSON)
- IP address
- User agent
- Timestamp
Tracked Actions:
- USER_CREATED, USER_UPDATED, USER_DELETED
- PROGRAMME_CREATED, PROGRAMME_UPDATED, PROGRAMME_DELETED
- MODULE_CREATED, MODULE_UPDATED, MODULE_DELETED, MODULE_REORDERED
- LESSON_CREATED, LESSON_UPDATED, LESSON_DELETED, LESSON_REORDERED
- QUIZ_CREATED, QUIZ_UPDATED, QUIZ_DELETED
- RESOURCE_UPLOADED, RESOURCE_UPDATED, RESOURCE_DELETED
- ENROLLMENT_CREATED, ENROLLMENT_DELETED
- BULK_ENROLLMENT_STARTED, BULK_ENROLLMENT_COMPLETED
- robots.txt: Blocks all search engines (Google, Bing, DuckDuckGo)
- Meta Tags: noindex, nofollow on all pages
- Open Graph: Disabled for privacy
- Google Analytics: G-S1F397DHHS (configurable)
- No Public Indexing: LMS content stays private
- Total registered users (by role)
- Active programmes and enrollments
- System activity timeline
- Storage usage statistics
- Quiz completion rates
- My programmes overview
- Student enrollment counts
- Lesson completion rates
- Quiz score averages
- Recent student activity
- Enrolled programmes (admin-assigned only)
- Progress percentages
- Recently accessed lessons
- Upcoming quizzes
- Completed assessments
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 16.1.4 | React framework with App Router |
| React | 19.0.2 | UI library with Server Components |
| TypeScript | 5.7 | Type safety across the entire stack |
| Turbopack | Latest | Fast development bundler (3x faster) |
| Technology | Version | Purpose |
|---|---|---|
| PostgreSQL | 14+ | Primary relational database |
| Prisma | 6.19.2 | Type-safe ORM with migration management |
| NextAuth.js | 5.0.0-beta.30 | Authentication and session management |
| bcryptjs | 3.0.3 | Password hashing with salt rounds |
| Zod | 4.3.6 | Runtime schema validation |
| Nanoid | 5.1.6 | Unique ID generation (CUID alternative) |
| Service | Purpose |
|---|---|
| Vercel | Edge runtime hosting with instant deploys |
| Supabase | PostgreSQL database with RLS and backups |
| Cloudflare R2 | S3-compatible object storage for files |
| Resend | Transactional email delivery (optional) |
| Google Analytics | User behavior tracking and insights |
| Technology | Version | Purpose |
|---|---|---|
| Tailwind CSS | 4.0 | Utility-first CSS framework |
| Radix UI | Latest | Accessible component primitives |
| Lucide React | 0.562.0 | Beautiful icon library (1000+ icons) |
| next-themes | 0.4.6 | Dark/Light mode with system detect |
| Sonner | 2.0.7 | Toast notifications |
| react-dropzone | 14.3.8 | File upload with drag-and-drop |
| date-fns | 4.1.0 | Date manipulation and formatting |
| tw-animate-css | 1.4.0 | Tailwind animation utilities |
| Tool | Purpose |
|---|---|
| ESLint | Code linting and consistency |
| TypeScript | Static type checking |
| tsx | TypeScript execution for scripts |
| Prisma Studio | Visual database browser |
| Git | Version control |
┌─────────────────────────────────────────────────────────────────┐
│ CLIENT LAYER │
├─────────────────────────────────────────────────────────────────┤
│ Next.js App Router (React 19 Server Components) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Admin UI │ │ Lecturer UI │ │ Student UI │ │
│ │ Dashboard │ │ Dashboard │ │ Dashboard │ │
│ │ Users │ │ Programmes │ │ Programmes │ │
│ │ Programmes │ │ Quizzes │ │ Lessons │ │
│ │ Analytics │ │ Resources │ │ Quizzes │ │
│ │ Audit Logs │ │ Students │ │ Progress │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└───────────────────────────┬─────────────────────────────────────┘
│ HTTP/HTTPS
↓
┌─────────────────────────────────────────────────────────────────┐
│ APPLICATION LAYER │
├─────────────────────────────────────────────────────────────────┤
│ Next.js API Routes (Edge Runtime) │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ /api/admin │ │ /api/student │ │
│ │ /api/lecturer │ │ /api/auth │ │
│ └─────────────────┘ └─────────────────┘ │
│ │
│ Middleware Layer │
│ ┌─────────────────────────────────────────┐ │
│ │ • Authentication (NextAuth) │ │
│ │ • Authorization (Role-based) │ │
│ │ • Request Validation (Zod) │ │
│ │ • Error Handling │ │
│ │ • Audit Logging │ │
│ └─────────────────────────────────────────┘ │
└───────────────────────────┬─────────────────────────────────────┘
│ Prisma Client
↓
┌─────────────────────────────────────────────────────────────────┐
│ DATA LAYER │
├─────────────────────────────────────────────────────────────────┤
│ PostgreSQL (Supabase) - 15 Models │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Users │ │ Programmes │ │ Quizzes │ │
│ │ Sessions │ │ Modules │ │ Questions │ │
│ │ Accounts │ │ Lessons │ │ Attempts │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Resources │ │ Enrollments │ │ Audit Logs │ │
│ │ Versions │ │ Progress │ │ Notifications│ │
│ │ Files │ │ Submissions │ │ │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ Row-Level Security (RLS) Policies │
│ ┌──────────────────────────────────────────────┐ │
│ │ • User-based access control │ │
│ │ • Role-based data filtering │ │
│ │ • Automatic policy enforcement │ │
│ └──────────────────────────────────────────────┘ │
└───────────────────────────┬─────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ EXTERNAL SERVICES │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Cloudflare R2 │ │ Resend │ │
│ │ (File Storage) │ │ (Email API) │ │
│ │ • Videos │ │ • Password Reset│ │
│ │ • Documents │ │ • Notifications │ │
│ │ • Images │ │ • Invitations │ │
│ └──────────────────┘ └──────────────────┘ │
│ │
│ ┌──────────────────┐ │
│ │ Google Analytics │ │
│ │ (G-S1F397DHHS) │ │
│ │ • Page views │ │
│ │ • User behavior │ │
│ │ • Conversions │ │
│ └──────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
User Login
│
↓
┌─────────────────────────┐
│ Submit Email/Password │
└───────────┬─────────────┘
│
↓
┌─────────────────────────────────────┐
│ POST /api/auth/callback/credentials │
└───────────┬─────────────────────────┘
│
↓
┌──────────────────────────┐
│ NextAuth Validate │
│ • Email exists? │
│ • Status = ACTIVE? │
└───────────┬──────────────┘
│
↓
┌──────────────────────────┐
│ bcrypt.compare() │
│ Password Hash Match? │
└───────────┬──────────────┘
│
↓ (Success)
┌──────────────────────────┐
│ Generate JWT Token │
│ • user.id │
│ • user.email │
│ • user.role │
│ • 30 day expiration │
└───────────┬──────────────┘
│
↓
┌──────────────────────────┐
│ Set HTTP-Only Cookie │
│ • Secure flag │
│ • SameSite: Lax │
└───────────┬──────────────┘
│
↓
┌──────────────────────────┐
│ Redirect to Dashboard │
│ • /dashboard (admin) │
│ • /dashboard (lecturer) │
│ • /dashboard (student) │
└──────────────────────────┘
Subsequent Requests:
│
↓
┌──────────────────────────┐
│ Middleware validates │
│ JWT from cookie │
└───────────┬──────────────┘
│
↓
┌──────────────────────────┐
│ auth() in Server │
│ Components returns │
│ session object │
└──────────────────────────┘
Student clicks "Start Quiz"
│
↓
POST /api/quizzes/attempts
│
├─ Verify enrollment
├─ Check attempt limit
├─ Create QuizAttempt (status: IN_PROGRESS)
└─ Return attempt ID
│
↓
Quiz Player Component Renders
│
├─ Load questions (shuffled if enabled)
├─ Start countdown timer
└─ Auto-save every 30 seconds
│
↓
Student answers questions
│
└─ Store answers in state (not yet saved)
│
↓
Student clicks "Submit Quiz"
│
↓
POST /api/quizzes/attempts/[id]/submit
│
├─ Verify time limit
├─ Create QuizResponse records
├─ Auto-grade MC and T/F questions
├─ Calculate total score
├─ Update attempt status to COMPLETED
├─ Check passing threshold
├─ Update lesson progress
└─ Create audit log entry
│
↓
Display Results
│
├─ Total score and percentage
├─ Pass/Fail status
├─ Question-by-question breakdown
└─ Correct answers (if enabled)
User drags file to dropzone
│
↓
Client-side validation
│
├─ Check file size (< 20MB)
├─ Check file type (MIME)
└─ Generate preview
│
↓
POST /api/admin/resources
│
└─ Body: multipart/form-data
│
↓
Server-side processing
│
├─ Validate session & role
├─ Validate lesson exists
├─ Parse form data
└─ Validate file again
│
↓
Upload to Cloudflare R2
│
├─ Generate unique file key
├─ Set content type
├─ Upload with AWS S3 SDK
└─ Get file metadata
│
↓
Save to database
│
├─ Create LessonResource record
├─ Create ResourceVersion record
├─ Link to lesson
└─ Set order number
│
↓
Create audit log
│
└─ RESOURCE_UPLOADED action
│
↓
Return success
│
└─ Client updates UI
Before you begin, ensure you have the following installed:
- Node.js: Version 18.x or higher (Download)
- npm: Version 9.x or higher (comes with Node.js)
- Git: Latest version (Download)
- PostgreSQL: 14.x or higher, OR a Supabase account (recommended)
- Cloudflare Account: For R2 storage (Sign up)
- Resend Account: For email functionality (Sign up) - Optional
git clone https://github.com/codezela/cca-lms.git
cd cca-lmsnpm installThis will install all required packages including Next.js, Prisma, NextAuth, and UI libraries.
Create a .env file in the root directory:
cp .env.example .envEdit .env with your configuration:
# Database (Supabase or local PostgreSQL)
DATABASE_URL="postgresql://user:password@host:5432/database?pgbouncer=true"
DIRECT_DATABASE_URL="postgresql://user:password@host:5432/database"
# NextAuth Configuration
NEXTAUTH_SECRET="your-secret-key-here-generate-with-openssl"
NEXTAUTH_URL="http://localhost:3000"
# Cloudflare R2 (File Storage)
CLOUDFLARE_R2_ACCOUNT_ID="your-account-id"
CLOUDFLARE_R2_ACCESS_KEY_ID="your-access-key"
CLOUDFLARE_R2_SECRET_ACCESS_KEY="your-secret-key"
CLOUDFLARE_R2_BUCKET_NAME="your-bucket-name"
CLOUDFLARE_R2_PUBLIC_URL="https://your-bucket.r2.cloudflarestorage.com"
# Resend (Email - Optional)
RESEND_API_KEY="re_your_api_key_here"
RESEND_FROM_EMAIL="noreply@yourdomain.com"
# Google Analytics (Optional)
NEXT_PUBLIC_GA_ID="G-S1F397DHHS"Generate NextAuth Secret:
openssl rand -base64 32Option A: Using Supabase (Recommended)
- Create a new project at Supabase
- Get your connection string from Project Settings → Database
- Use the pooler URL for
DATABASE_URL(for serverless) - Use the direct URL for
DIRECT_DATABASE_URL(for migrations)
Option B: Local PostgreSQL
# Create database
createdb cca_lms
# Update .env with connection string
DATABASE_URL="postgresql://localhost:5432/cca_lms"
DIRECT_DATABASE_URL="postgresql://localhost:5432/cca_lms"Generate Prisma Client:
npm run db:generateRun Database Migrations:
npm run db:pushEnable Row-Level Security:
psql $DATABASE_URL < prisma/migrations/enable_rls.sqlSeed Database with Initial Data:
npm run db:seedThis creates:
- Admin user:
admin@codezela.com/Admin@123 - Lecturer user:
lecturer@codezela.com/Lecturer@123 - Student user:
student@codezela.com/Student@123 - Sample programme with modules and lessons
- Go to Cloudflare Dashboard → R2
- Create a new bucket (e.g.,
cca-lms-files) - Generate API credentials (Access Key ID and Secret)
- Configure CORS for your bucket:
[
{
"AllowedOrigins": ["http://localhost:3000", "https://yourdomain.com"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
"AllowedHeaders": ["*"],
"MaxAgeSeconds": 3000
}
]- Update
.envwith your R2 credentials
npm run devOpen http://localhost:3000 in your browser.
-
Login as Admin:
- Email:
admin@codezela.com - Password:
Admin@123
- Email:
-
Check Features:
- Navigate to Users page
- View Programmes
- Check Analytics dashboard
- Test file upload in Resources
-
Login as Student:
- Email:
student@codezela.com - Password:
Student@123 - View assigned programmes
- Access a lesson
- Email:
cca-lms/
├── app/ # Next.js App Router
│ ├── api/ # API Routes (Edge Runtime)
│ │ ├── admin/ # Admin-only endpoints
│ │ │ ├── analytics/ # System analytics
│ │ │ ├── activity-logs/ # Audit log retrieval
│ │ │ ├── bulk-enroll/ # CSV bulk enrollment
│ │ │ │ ├── template/ # Download CSV template
│ │ │ │ ├── preview/ # Validate CSV preview
│ │ │ │ └── submit/ # Process enrollments
│ │ │ ├── dashboard-stats/ # Admin dashboard data
│ │ │ ├── lessons/ # Lesson CRUD + reorder
│ │ │ ├── modules/ # Module CRUD + reorder
│ │ │ ├── programmes/ # Programme CRUD
│ │ │ ├── quizzes/ # Quiz CRUD
│ │ │ ├── resources/ # Resource CRUD + reorder
│ │ │ └── users/ # User management CRUD
│ │ ├── auth/ # Authentication
│ │ │ ├── [...nextauth]/ # NextAuth handlers
│ │ │ ├── change-password/ # Password update
│ │ │ ├── request-reset/ # Reset request
│ │ │ └── reset-password/ # Password reset
│ │ ├── lecturer/ # Lecturer endpoints
│ │ │ ├── dashboard/ # Lecturer stats
│ │ │ ├── programmes/ # Own programmes
│ │ │ └── students/ # Enrolled students
│ │ ├── student/ # Student endpoints
│ │ │ ├── dashboard/ # Student stats
│ │ │ ├── lessons/[id]/progress/ # Mark complete
│ │ │ ├── profile/ # User profile
│ │ │ └── programmes/ # Enrolled programmes
│ │ │ ├── [id]/ # Programme details
│ │ │ ├── [id]/enroll/ # Self-enroll (disabled)
│ │ │ └── [id]/lessons/[id]/ # Lesson content
│ │ └── quizzes/ # Quiz endpoints
│ │ └── attempts/ # Quiz submissions
│ ├── activity-logs/ # Audit log viewer
│ ├── analytics/ # Analytics dashboard
│ ├── auth/ # Auth pages
│ │ ├── first-login/ # First login flow
│ │ ├── login/ # Login page
│ │ └── reset-password/ # Password reset page
│ ├── bulk-enroll/ # Bulk enrollment UI
│ ├── dashboard/ # Main dashboard (role-aware)
│ ├── learn/ # Student learning interface
│ │ └── [id]/ # Programme view
│ │ ├── lesson/[lessonId]/ # Lesson player
│ │ └── page.tsx # Programme overview
│ ├── my-programmes/ # Student programme list
│ ├── programmes/ # Programme management
│ │ ├── new/ # Create programme
│ │ └── [id]/ # Edit programme
│ ├── resources/ # Resource library
│ ├── settings/ # User settings
│ ├── students/ # Lecturer student view
│ ├── users/ # Admin user management
│ ├── globals.css # Global styles + prose
│ ├── layout.tsx # Root layout
│ └── page.tsx # Landing page
│
├── components/ # React Components
│ ├── bulk-enroll/ # Bulk enrollment components
│ │ └── bulk-enroll-client.tsx # CSV upload UI (488 lines)
│ ├── dashboards/ # Role-specific dashboards
│ │ ├── admin-dashboard.tsx # Admin overview
│ │ ├── lecturer-dashboard.tsx # Lecturer overview
│ │ └── student-dashboard.tsx # Student overview
│ ├── programmes/ # Programme components
│ │ ├── module-list.tsx # Module manager
│ │ ├── lesson-list.tsx # Lesson manager
│ │ └── content-editor.tsx # Rich text editor
│ ├── quizzes/ # Quiz components
│ │ ├── quiz-builder.tsx # Visual quiz creator (673 lines)
│ │ ├── quiz-player.tsx # Quiz taking UI (530 lines)
│ │ ├── question-editor.tsx # Question form
│ │ └── grading-interface.tsx # Manual grading
│ ├── resources/ # Resource components
│ │ ├── resource-manager.tsx # CRUD interface (468 lines)
│ │ ├── file-upload.tsx # Upload component (338 lines)
│ │ └── resource-list.tsx # Display resources
│ ├── users/ # User components
│ │ ├── user-table.tsx # User list
│ │ └── user-form.tsx # Create/edit user
│ ├── ui/ # Radix UI components
│ │ ├── button.tsx # Button variants
│ │ ├── card.tsx # Card component
│ │ ├── dialog.tsx # Modal dialogs
│ │ ├── dropdown-menu.tsx # Dropdown menus
│ │ ├── input.tsx # Form inputs
│ │ ├── select.tsx # Select dropdowns
│ │ ├── table.tsx # Data tables
│ │ ├── tabs.tsx # Tab navigation
│ │ └── ... # 20+ more components
│ ├── footer.tsx # Site footer
│ ├── navbar.tsx # Navigation (role-based)
│ ├── theme-provider.tsx # Dark/light theme
│ └── theme-toggle.tsx # Theme switcher
│
├── lib/ # Utility Libraries
│ ├── auth.ts # NextAuth configuration
│ ├── prisma.ts # Prisma client singleton
│ ├── r2.ts # Cloudflare R2 helpers
│ │ ├── uploadFile() # Upload to R2
│ │ ├── getSignedUrl() # Generate download URL
│ │ └── deleteFile() # Delete from R2
│ ├── resend.ts # Email client
│ ├── audit.ts # Audit logging
│ │ └── createAuditLog() # Log user actions
│ ├── utils.ts # Helper functions
│ │ ├── cn() # Class name merger
│ │ └── formatDate() # Date formatting
│ └── validations.ts # Zod schemas
│ ├── userSchema # User validation
│ ├── programmeSchema # Programme validation
│ ├── quizSchema # Quiz validation
│ └── ... # More schemas
│
├── prisma/ # Database
│ ├── schema.prisma # Schema definition (580 lines)
│ │ ├── 15 Models # Database tables
│ │ └── 10 Enums # Type definitions
│ ├── seed.ts # Seed script
│ │ ├── Demo users (3) # Admin, lecturer, student
│ │ ├── Sample programme (1) # With modules & lessons
│ │ └── Sample resources (5) # Various types
│ ├── migrations/ # SQL migrations
│ │ └── enable_rls.sql # RLS policies (15 tables)
│ └── verify_rls.sql # RLS verification
│
├── generated/ # Auto-generated
│ └── prisma/ # Prisma Client
│ ├── client.ts # Type-safe client
│ ├── models/ # Model types
│ └── enums.ts # Enum types
│
├── public/ # Static Assets
│ ├── robots.txt # Search engine rules
│ └── ... # Images, icons, etc.
│
├── types/ # TypeScript Definitions
│ └── next-auth.d.ts # NextAuth extensions
│
├── .env # Environment variables
├── .env.example # Example env file
├── .gitignore # Git ignore rules
├── eslint.config.mjs # ESLint configuration
├── next.config.ts # Next.js configuration
├── next-env.d.ts # Next.js types
├── package.json # Dependencies & scripts
├── postcss.config.mjs # PostCSS config
├── prisma.config.ts # Prisma config
├── README.md # This file
├── tailwind.config.ts # Tailwind configuration
└── tsconfig.json # TypeScript configuration
Login with email and password
Request Body:
{
"email": "admin@codezela.com",
"password": "Admin@123"
}Response:
{
"user": {
"id": "clx123...",
"email": "admin@codezela.com",
"name": "Admin User",
"role": "ADMIN"
}
}List all users with pagination
Query Parameters:
page(optional): Page number (default: 1)limit(optional): Items per page (default: 50)role(optional): Filter by role (ADMIN, LECTURER, STUDENT)search(optional): Search by name or email
Preview CSV bulk enrollment
Request Body (multipart/form-data):
file: CSV file with columns:Email,Programme Code,Name (optional)
Response:
{
"preview": [
{
"email": "student1@example.com",
"programmeCode": "CS101",
"name": "Student One",
"status": "valid",
"user": { "id": "...", "name": "..." },
"programme": { "id": "...", "title": "..." }
}
],
"summary": {
"total": 100,
"valid": 98,
"duplicates": 0,
"errors": 2
}
}List student's assigned programmes only
Get lesson content with resources
Response includes:
- Lesson details (title, description, video URL, duration)
- All resources (FILE, EXTERNAL_LINK, EMBEDDED, TEXT_NOTE)
- Navigation (previous/next lessons)
- Progress tracking data
The system uses 15 Prisma models:
- User - User accounts with role-based access
- Account - OAuth provider accounts (NextAuth)
- Session - Active user sessions
- VerificationToken - Email verification tokens
- Course - Main programme entity
- Module - Programme sections/chapters
- Lesson - Individual learning units
- LessonResource - Attachments and materials
- ResourceVersion - Resource version history
- Quiz - Quiz configuration and settings
- QuizQuestion - Individual questions
- QuizAnswer - Answer options for questions
- QuizAttempt - Student quiz submissions
- QuizResponse - Individual question responses
- CourseEnrollment - Student programme enrollments
- LessonProgress - Lesson completion tracking
- Notification - User notifications
- AuditLog - Action audit trail
- UploadedFile - File metadata registry
- Push to GitHub:
git add .
git commit -m "Initial commit"
git push -u origin main-
Import to Vercel:
- Go to Vercel Dashboard
- Click "Import Project"
- Select your GitHub repository
-
Set Environment Variables in Vercel project settings
-
Deploy - Vercel auto-deploys on push to main
// ✅ Always validate with Zod
import { z } from "zod";
const userSchema = z.object({
email: z.string().email(),
password: z.string().min(8).regex(/[A-Z]/).regex(/[0-9]/),
name: z.string().min(1).max(100),
role: z.enum(["ADMIN", "LECTURER", "STUDENT"]),
});// ✅ Always check session
const session = await auth();
if (!session?.user) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}// ✅ Default to server components
export default async function UsersPage() {
const users = await prisma.user.findMany();
return <UserList users={users} />;
}We welcome contributions from the community!
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Commit:
git commit -m "Add amazing feature" - Push:
git push origin feature/amazing-feature - Open a Pull Request
This project is proprietary software developed by Codezela Technologies.
Copyright © 2024-2026 Codezela Technologies. All rights reserved.
For licensing inquiries, contact: contact@codezela.com
Built with ❤️ by Codezela Technologies
- Next.js - React framework
- Prisma - Database ORM
- NextAuth.js - Authentication
- Tailwind CSS - Styling
- Radix UI - Components
- Cloudflare R2 - Storage
- Supabase - Database hosting
- Vercel - Deployment platform
Need help? Have questions?
- Website: https://codezela.com
- Email: ca@codezela.com