Skip to content

Arpan-Dey-Web/skillbridge-client-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ LearnHub

A Production-Ready Tutoring Marketplace Platform

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.


πŸš€ Live Demo

πŸ”— https://skillbridge-client-app.vercel.app/


πŸ” Demo Credentials

πŸ›‘οΈ Admin

Email: admin@gmail.com
Password: 12345678

πŸ‘¨β€πŸ« Tutor

Email: jk@gmail.com
Password: 12345678

πŸ‘¨β€πŸŽ“ Student

Email: student@gmail.com
Password: 12345678

These accounts are seeded for evaluation purposes.


πŸ— Tech Stack

Frontend

  • Next.js 16 (Latest Version)
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
  • TanStack Query
  • Better Auth (Client)

Backend

  • Node.js
  • Express.js
  • Vercel Serverless API Routes
  • Prisma ORM
  • PostgreSQL (NeonDB)
  • Better Auth (Server)

πŸ” Authentication & Authorization

  • Secure session-based authentication using Better Auth
  • HTTP-only cookie sessions
  • Role-based access control (RBAC)
  • Middleware-protected routes
  • Admin route isolation

Roles

  • STUDENT
  • TUTOR
  • ADMIN

✨ Key Features

πŸ‘¨β€πŸŽ“ Student Features

  • Smart search & filtering
  • Instant booking system
  • Review submission after completed sessions
  • Dashboard with booking history
  • Profile management

πŸ‘¨β€πŸ« Tutor Features

  • Profile customization
  • Hourly rate management
  • Availability slot creation
  • Session tracking
  • Ratings overview

πŸ›‘οΈ Admin Features

  • View all users
  • Ban / Unban accounts
  • Manage categories
  • View all bookings

πŸ—„ Database Schema Overview

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


πŸ” Authentication & Session Models (Better Auth)

User

Primary entity representing all platform users.

  • id – String (Primary Key)
  • email – Unique email
  • name – Optional full name
  • phone – Optional phone
  • image – Profile image URL
  • emailVerified – Boolean
  • role – Enum (STUDENT | TUTOR | ADMIN)
  • status – Enum (ACTIVE | BANNED)
  • createdAt
  • updatedAt

Relations

  • One-to-One β†’ TutorProfile
  • One-to-Many β†’ Booking (as student)
  • One-to-Many β†’ Review
  • One-to-Many β†’ Session
  • One-to-Many β†’ Account

Session

Stores authenticated session data.

  • id
  • token (Unique)
  • expiresAt
  • ipAddress
  • userAgent
  • userId β†’ FK β†’ User

Account

Handles provider-based authentication (Better Auth support).

  • id
  • providerId
  • accountId
  • accessToken
  • refreshToken
  • password (if credentials-based)
  • userId β†’ FK β†’ User

Verification

Stores email verification / token-based flows.

  • id
  • identifier
  • value
  • expiresAt

πŸŽ“ Core Domain Models

Category

Defines tutoring subject categories.

  • id (UUID)
  • name (Unique)

Relations

  • One-to-Many β†’ TutorProfile

TutorProfile

Extends User with tutor-specific data.

  • id (UUID)
  • bio (Text)
  • hourlyRate
  • averageRating
  • userId (Unique FK β†’ User)
  • categoryId (FK β†’ Category)

Relations

  • One-to-One β†’ User
  • One-to-Many β†’ Availability
  • One-to-Many β†’ Booking

Availability

Stores recurring weekly time slots.

  • id (UUID)
  • dayOfWeek (0–6)
  • startTime (String)
  • endTime (String)
  • tutorProfileId β†’ FK β†’ TutorProfile

Booking

Represents a tutoring session between student and tutor.

  • id (UUID)
  • startTime
  • endTime
  • duration
  • totalPrice
  • status (PENDING | CONFIRMED | COMPLETED | CANCELLED)
  • meetLink
  • studentId β†’ FK β†’ User
  • tutorProfileId β†’ FK β†’ TutorProfile
  • createdAt

Relations

  • Many-to-One β†’ User (Student)
  • Many-to-One β†’ TutorProfile
  • One-to-One β†’ Review

Review

Stores verified student feedback.

  • id (UUID)
  • rating (Integer)
  • comment (Text)
  • bookingId (Unique FK β†’ Booking)
  • studentId β†’ FK β†’ User
  • createdAt

Design Constraint

  • A review is linked to a specific booking.
  • One booking can only have one review.
  • Only verified students can leave feedback.

πŸ“Š Booking Status Flow

PENDING β†’ CONFIRMED β†’ COMPLETED
       β†˜
        CANCELLED

πŸ”Ž Schema Design Highlights

  • βœ… 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

🧠 Architectural Strengths

  • Clear separation between authentication models and domain models
  • Scalable availability modeling
  • Extensible booking lifecycle
  • Enforced review authenticity via booking relation
  • Serverless-compatible PostgreSQL design

πŸ“‘ API Structure

Authentication

POST   /api/auth/register
POST   /api/auth/login
GET    /api/auth/me

Tutors

GET    /api/tutors
GET    /api/tutors/:id

Bookings

POST   /api/bookings
GET    /api/bookings
PATCH  /api/bookings/:id

Admin

GET    /api/admin/users
PATCH  /api/admin/users/:id

⚠️ Error Handling & UX

Backend

  • Zod validation
  • Centralized error middleware
  • Proper HTTP status codes

Frontend

  • TanStack Query loading states
  • Skeleton components
  • Toast notifications
  • Form validation feedback

⚑ Performance Optimizations

  • Server-side rendering (SSR)
  • Query caching via TanStack Query
  • Optimized Prisma queries
  • Lazy-loaded components
  • Serverless auto-scaling

πŸ›  Local Setup

1️⃣ Clone Repository

git clone https://github.com/yourusername/learnhub.git
cd learnhub

2️⃣ Environment Variables

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

3️⃣ Install Dependencies

npm install

4️⃣ Prisma Setup

npx prisma generate
npx prisma migrate dev

5️⃣ Run Development Server

npm run dev

πŸ›‘ Security Measures

  • Server-side session verification
  • Role-based middleware enforcement
  • Banned-user restriction
  • Environment variable protection
  • Verified reviews linked to bookings

πŸ“ˆ Future Improvements

  • Payment integration
  • Real-time chat
  • Email notifications
  • Calendar sync
  • Advanced filtering & pagination
  • Analytics dashboard

πŸ‘¨β€πŸ’» Author

Arpan Dey
Full Stack Developer

GitHub: https://github.com/Arpan-Dey-Web
Portfolio: https://arpandeyweb.vercel.app

About

LearnHub is a scalable, role-based tutoring marketplace built with a modern serverless architecture.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors