LearnHub is a scalable, role-based tutoring marketplace built with a modern serverless architecture. The platform connects students with tutors, enables structured booking workflows, and provides secure administrative control.
This project demonstrates full-stack engineering practices including authentication architecture, relational database modeling, serverless deployment, and scalable UI design.
🔗 https://skillbridge-client-app.vercel.app/
Email: admin@gmail.com
Password: 12345678
Email: jk@gmail.com
Password: 12345678
Email: student@gmail.com
Password: 12345678
These accounts are seeded for evaluation purposes.
- Next.js 16 (Latest Version)
- TypeScript
- Tailwind CSS
- shadcn/ui
- TanStack Query
- Better Auth (Client)
- Node.js
- Express.js
- Vercel Serverless API Routes
- Prisma ORM
- PostgreSQL (NeonDB)
- Better Auth (Server)
- Secure session-based authentication using Better Auth
- HTTP-only cookie sessions
- Role-based access control (RBAC)
- Middleware-protected routes
- Admin route isolation
- STUDENT
- TUTOR
- ADMIN
- Smart search & filtering
- Instant booking system
- Review submission after completed sessions
- Dashboard with booking history
- Profile management
- Profile customization
- Hourly rate management
- Availability slot creation
- Session tracking
- Ratings overview
- View all users
- Ban / Unban accounts
- Manage categories
- View all bookings
LearnHub uses PostgreSQL (NeonDB) with Prisma ORM to maintain strict relational integrity, role-based access, and authentication session management.
🔗 Full ER Diagram (DrawSQL):
https://drawsql.app/teams/arpan-dey-workspace/diagrams/learnhub-app-database-schema-design
Primary entity representing all platform users.
id– String (Primary Key)email– Unique emailname– Optional full namephone– Optional phoneimage– Profile image URLemailVerified– Booleanrole– Enum (STUDENT | TUTOR | ADMIN)status– Enum (ACTIVE | BANNED)createdAtupdatedAt
- One-to-One → TutorProfile
- One-to-Many → Booking (as student)
- One-to-Many → Review
- One-to-Many → Session
- One-to-Many → Account
Stores authenticated session data.
idtoken(Unique)expiresAtipAddressuserAgentuserId→ FK → User
Handles provider-based authentication (Better Auth support).
idproviderIdaccountIdaccessTokenrefreshTokenpassword(if credentials-based)userId→ FK → User
Stores email verification / token-based flows.
ididentifiervalueexpiresAt
Defines tutoring subject categories.
id(UUID)name(Unique)
- One-to-Many → TutorProfile
Extends User with tutor-specific data.
id(UUID)bio(Text)hourlyRateaverageRatinguserId(Unique FK → User)categoryId(FK → Category)
- One-to-One → User
- One-to-Many → Availability
- One-to-Many → Booking
Stores recurring weekly time slots.
id(UUID)dayOfWeek(0–6)startTime(String)endTime(String)tutorProfileId→ FK → TutorProfile
Represents a tutoring session between student and tutor.
id(UUID)startTimeendTimedurationtotalPricestatus(PENDING | CONFIRMED | COMPLETED | CANCELLED)meetLinkstudentId→ FK → UsertutorProfileId→ FK → TutorProfilecreatedAt
- Many-to-One → User (Student)
- Many-to-One → TutorProfile
- One-to-One → Review
Stores verified student feedback.
id(UUID)rating(Integer)comment(Text)bookingId(Unique FK → Booking)studentId→ FK → UsercreatedAt
- A review is linked to a specific booking.
- One booking can only have one review.
- Only verified students can leave feedback.
PENDING → CONFIRMED → COMPLETED
↘
CANCELLED
- ✅ Strict relational integrity via foreign keys
- ✅ Unique constraint on TutorProfile per user
- ✅ One review per booking (verified feedback enforcement)
- ✅ Role-based access controlled at application layer
- ✅ Authentication session persistence
- ✅ Normalized relational schema
- ✅ Enum-based state management
- Clear separation between authentication models and domain models
- Scalable availability modeling
- Extensible booking lifecycle
- Enforced review authenticity via booking relation
- Serverless-compatible PostgreSQL design
POST /api/auth/register
POST /api/auth/login
GET /api/auth/me
GET /api/tutors
GET /api/tutors/:id
POST /api/bookings
GET /api/bookings
PATCH /api/bookings/:id
GET /api/admin/users
PATCH /api/admin/users/:id
- Zod validation
- Centralized error middleware
- Proper HTTP status codes
- TanStack Query loading states
- Skeleton components
- Toast notifications
- Form validation feedback
- Server-side rendering (SSR)
- Query caching via TanStack Query
- Optimized Prisma queries
- Lazy-loaded components
- Serverless auto-scaling
git clone https://github.com/yourusername/learnhub.git
cd learnhub
Create .env file:
DATABASE_URL=Your Database URL
BETTER_AUTH_SECRET=Better auth Secret
NEXT_PUBLIC_CLIENT_URL=Your frontend url
NEXT_PUBLIC_BACKEND_URL=Your backend url
npm install
npx prisma generate
npx prisma migrate dev
npm run dev
- Server-side session verification
- Role-based middleware enforcement
- Banned-user restriction
- Environment variable protection
- Verified reviews linked to bookings
- Payment integration
- Real-time chat
- Email notifications
- Calendar sync
- Advanced filtering & pagination
- Analytics dashboard
Arpan Dey
Full Stack Developer
GitHub: https://github.com/Arpan-Dey-Web
Portfolio: https://arpandeyweb.vercel.app