A modern, interactive full-stack web application for learning calculus concepts including linear equations, linear inequalities, and non-linear systems with 2 variables. Built with Next.js, React, and Express.js with Supabase database.
In the loving memory of Muhammad Aidan Fathullah - 18223002,
this project is developed and maintained by Muhamad Hasbullah Faris - 18223014
- 4 Comprehensive Lessons: Linear Equations, Linear Inequalities, Non-Linear Systems, and Calculus Applications
- Interactive Simulations: Real-time graph visualizations using HTML5 Canvas and SVG
- Drag & Drop Quizzes: HTML5 native drag-and-drop API for interactive learning
- Mathematical Content: LaTeX-style equations and step-by-step examples
- Practice Problems: Database-driven practice questions for each lesson
- Instant Feedback: Real-time validation of answers
- Progress Tracking: Track completion percentage and correct answers
- Previous Attempts: View your answer history
- Stats Overview: Lessons completed, problems solved, accuracy rate, and current streak
- Progress Charts: Visual representation using Recharts (Bar & Line charts)
- Weekly Accuracy Trends: Track your performance over time
- Recent Activity: View your latest practice sessions
- Google OAuth: Sign in with Google using NextAuth.js
- Email/Password: Traditional authentication with Supabase
- Session Management: Secure JWT-based authentication
- Profile Management: Update name, email, and password
- Framework: Next.js 15.0.4 (App Router)
- Language: TypeScript 5
- UI Library: React 19
- UI Components: shadcn/ui
- Styling: Tailwind CSS 3.4
- Authentication: NextAuth.js 5
- Runtime: Node.js
- Framework: Express.js 4.21
- Language: JavaScript
- Database: Supabase (PostgreSQL)
- Authentication: Supabase Auth + JWT
- Security:
- CORS configured
- Rate limiting (express-rate-limit)
- JWT token verification
- Input validation & sanitization
- Canvas API: Real-time graph rendering
- Drag & Drop API: Interactive quiz components
- Semantic Elements: header, nav, main, section, article, aside, footer
- users: User profiles and authentication
- lessons: Lesson metadata
- practice_problems: Questions and answers
- practice_attempts: User attempt records
- user_lesson_progress: Progress tracking
TubesPAWM1-II3140/
├── backend/ # Express.js API
│ ├── server.js # Main server file
│ ├── config/
│ │ └── database.js # Database configuration
│ ├── scripts/
│ │ └── supabase-schema.sql # Database schema
│ ├── .env # Environment variables
│ └── package.json
│
├── frontend/ # Next.js Application
│ ├── src/
│ │ ├── app/ # App router pages
│ │ │ ├── page.tsx # Homepage
│ │ │ ├── layout.tsx # Root layout
│ │ │ ├── dashboard/ # Dashboard page
│ │ │ ├── lessons/ # Lesson pages
│ │ │ │ ├── linear-equations/
│ │ │ │ ├── linear-inequalities/
│ │ │ │ ├── nonlinear-systems/
│ │ │ │ └── calculus-applications/
│ │ │ ├── practice/ # Practice page
│ │ │ ├── settings/ # Settings page
│ │ │ └── api/
│ │ │ └── auth/ # NextAuth API routes
│ │ ├── components/
│ │ │ ├── ui/ # shadcn/ui components
│ │ │ ├── auth-modal.tsx # Authentication modal
│ │ │ ├── canvas-graph.tsx # Canvas component
│ │ │ ├── drag-drop-quiz.tsx # Drag & Drop component
│ │ │ ├── lesson-layout.tsx # Lesson wrapper
│ │ │ ├── math-content.tsx # Math content renderer
│ │ │ ├── progress-chart.tsx # Chart component
│ │ │ ├── quiz-card.tsx # Quiz component
│ │ │ ├── sidebar.tsx # Navigation sidebar
│ │ │ └── stats-overview.tsx # Stats cards
│ │ ├── hooks/
│ │ │ ├── use-auth.tsx # Authentication hook
│ │ │ ├── use-data.tsx # Data fetching hooks
│ │ │ └── use-mobile.ts # Mobile detection
│ │ ├── lib/
│ │ │ ├── api.ts # API client functions
│ │ │ └── utils.ts # Utility functions
│ │ └── types/
│ │ └── next-auth.d.ts # NextAuth types
│ ├── public/ # Static assets
│ ├── .env.local # Environment variables
│ └── package.json
│
└── README.md
- Node.js 18+
- pnpm (recommended) or npm
- Supabase Account (for database)
- Google Cloud Console (for OAuth - optional)
-
Clone the repository
git clone <repository-url> cd TubesPAWM1-II3140
-
Set up Backend
cd backend npm installCreate
.envfile inbackend/directory:SUPABASE_URL=your_supabase_project_url SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key JWT_SECRET=your_jwt_secret_key FRONTEND_URL=http://localhost:3000 PORT=5000 NODE_ENV=development
-
Set up Database
- Create a Supabase project at supabase.com
- Run the SQL schema from
backend/scripts/supabase-schema.sqlin Supabase SQL Editor - The schema will create all necessary tables and relationships
-
Set up Frontend
cd frontend pnpm installCreate
.env.localfile infrontend/directory:NEXT_PUBLIC_API_URL=http://localhost:5000 NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=your_nextauth_secret GOOGLE_CLIENT_ID=your_google_oauth_client_id GOOGLE_CLIENT_SECRET=your_google_oauth_client_secret
Generate
NEXTAUTH_SECRET:openssl rand -base64 32
-
Configure Google OAuth (Optional)
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Copy Client ID and Client Secret to
.env.local
-
Start Backend Server
cd backend npm run devBackend will run on
http://localhost:5000 -
Start Frontend (in a new terminal)
cd frontend pnpm devFrontend will run on
http://localhost:3000 -
Open your browser Navigate to http://localhost:3000
npm run dev # Start development server with nodemon
npm start # Start production serverpnpm dev # Start development server
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Run ESLint-
Sign Up / Sign In
- Click "Sign In / Sign Up" button
- Use Google OAuth or email/password
-
Explore Lessons
- Navigate to lessons from sidebar
- Read interactive content
- Use interactive simulations (Linear Equations, Linear Inequalities)
- Try drag-and-drop quiz (Calculus Applications)
-
Practice Problems
- Go to Practice page
- Select a lesson
- Answer questions and get instant feedback
- Track your progress
-
View Dashboard
- Monitor your stats (completion, accuracy, streak)
- View progress charts
- Check recent activity
-
Manage Settings
- Update profile information
- Change password
- Delete account (if needed)
POST /api/auth/signup- Register new userPOST /api/auth/signin- Login userPOST /api/auth/google- Google OAuthGET /api/me- Get current user
GET /api/lessons- Get all lessonsGET /api/lessons/:slug- Get specific lesson (disabled)
GET /api/practice/:lessonId- Get practice problemsPOST /api/practice/attempt- Submit answerGET /api/practice/attempts/:lessonId- Get previous attempts
GET /api/user/progress- Get user progressPOST /api/user/progress- Update progressGET /api/user/dashboard-stats- Get dashboard statistics
PUT /api/user/profile- Update profilePOST /api/user/change-password- Change passwordDELETE /api/user/account- Delete account
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
The code in this project is licensed under MIT license.