A modern, feature-rich e-learning platform built with Next.js, featuring course management, assignment tracking, analytics, and user authentication.
- User Authentication: Secure login/signup system with role-based access
- Course Management: Create, enroll, and manage courses with lessons
- Assignment System: Submit assignments with tracking and grading
- Learning Analytics: Comprehensive progress tracking and performance insights
- User Profiles: Customizable profiles with learning preferences
- Responsive Design: Mobile-first design with Tailwind CSS
- Real-time Updates: Live assignment submissions and progress tracking
- Frontend: Next.js 14 (App Router), React 18, TypeScript
- Styling: Tailwind CSS, Shadcn UI components
- Authentication: NextAuth.js with custom credentials
- Database: Prisma ORM with SQLite/PostgreSQL
- Charts: Recharts for data visualization
- State Management: React hooks, tRPC for type-safe APIs
- Node.js 18+
- npm or yarn
- Git
git clone <your-repo-url>
cd elearning_researchnpm installCreate a .env file in the root directory:
# Database
DATABASE_URL="file:./db.sqlite"
# Authentication
NEXTAUTH_SECRET="your-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"
# Optional: For production databases
# DATABASE_URL="postgresql://username:password@localhost:5432/skilled_db"Generate a secure secret key:
openssl rand -base64 32# Generate Prisma client
npx prisma generate
# Push schema to database
npx prisma db push
# Seed the database with sample data
npm run db:seed# Create a new migration
npx prisma migrate dev --name "migration_name"
# Apply migrations
npx prisma migrate deploy
# Reset database (development only)
npx prisma migrate resetnpm run devOpen http://localhost:3000 in your browser.
src/
├── app/ # Next.js App Router pages
│ ├── api/ # API routes
│ ├── auth/ # Authentication pages
│ ├── courses/ # Course-related pages
│ ├── assignments/ # Assignment pages
│ ├── analytics/ # Analytics dashboard
│ └── profile/ # User profile pages
├── components/ # Reusable UI components
│ ├── ui/ # Base UI components
│ ├── courses/ # Course-related components
│ ├── assignments/ # Assignment components
│ ├── analytics/ # Analytics components
│ └── profile/ # Profile components
├── server/ # Server-side code
│ ├── api/ # tRPC API routers
│ ├── auth/ # Authentication configuration
│ └── db.ts # Database connection
└── types/ # TypeScript type definitions
The platform uses the following main models:
- User: User accounts with roles (student, instructor, admin)
- Course: Courses with lessons, enrollments, and metadata
- Lesson: Individual learning units within courses
- Assignment: Course assignments with due dates and submissions
- AssignmentSubmission: Student submissions with grading
- UserProgress: Learning progress tracking
- Analytics: Performance metrics and learning data
- Visit
/auth/signupto create an account - Use
/auth/signinto log in - Protected routes automatically redirect to login
- Browse available courses at
/explore - Enroll in courses from the course detail page
- Access enrolled courses from
/dashboard
- View assignments in course detail pages
- Submit assignments with files and text content
- Track submission status and grades
- Monitor learning progress at
/analytics - View performance trends and achievements
- Set weekly learning goals
- Customize profile information at
/profile - Set learning preferences and study times
- Update account settings and password
# Development
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
# Database
npm run db:push # Push schema changes
npm run db:studio # Open Prisma Studio
npm run db:seed # Seed database with sample data
# Linting & Formatting
npm run lint # Run ESLint
npm run format # Format code with PrettierPOST /api/auth/signup- User registrationPOST /api/auth/signin- User loginGET /api/auth/check- Check authentication status
GET /api/courses- List all coursesGET /api/courses/[courseId]- Get course detailsPOST /api/courses/[courseId]/enroll- Enroll in course
GET /api/assignments- List user assignmentsGET /api/assignments/[assignmentId]- Get assignment detailsPOST /api/assignments/submit- Submit assignment
PUT /api/profile/update- Update user profilePUT /api/profile/preferences- Update learning preferencesPOST /api/profile/check-username- Check username availability
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
Database connection string | Yes |
NEXTAUTH_SECRET |
Secret key for JWT tokens | Yes |
NEXTAUTH_URL |
Base URL for authentication | Yes |
-
Database Connection Error
- Ensure
.envfile exists with correctDATABASE_URL - Run
npx prisma generateandnpx prisma db push
- Ensure
-
Authentication Issues
- Check
NEXTAUTH_SECRETis set correctly - Verify
NEXTAUTH_URLmatches your development URL
- Check
-
Build Errors
- Clear
.nextfolder:rm -rf .next - Reinstall dependencies:
rm -rf node_modules && npm install
- Clear
-
TypeScript Errors
- Run
npx prisma generateto update Prisma client types - Check for missing imports or type definitions
- Run