You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SkillBridge is a full-stack tutoring platform where students can discover expert tutors, book lesson slots, and pay securely via Stripe. This repository contains the backend REST API powering the platform.
Follow these steps to set up and run the backend server locally.
Prerequisites
Node.js v20+
PostgreSQL database
Stripe account (for payment features)
1. Clone & Install
git clone https://github.com/Rezwan66/skillbridge-backend.git
cd skillbridge-backend
npm install
2. Configure Environment Variables
Create a .env file in the project root:
# DatabaseDATABASE_URL="postgresql://username:password@localhost:5432/skillbridge?schema=public"# ServerPORT=5000# Better AuthBETTER_AUTH_SECRET=your-secret-key# β οΈ IMPORTANT FOR PROD: This MUST strictly equal your Frontend Domain (because the Frontend Edge Proxy rewrites requests, so Better Auth expects the host to match the origin proxy)BETTER_AUTH_URL=http://localhost:5000BACKEND_URL=http://localhost:5000# Frontend URL (CORS / Proxy Origin)APP_URL=http://localhost:3000# StripeSTRIPE_SECRET_KEY=sk_test_your_stripe_secret_keySTRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret# Admin CredentialsADMIN_NAME='SkillBridge Admin 1'ADMIN_EMAIL=admin1@skillbridge.comADMIN_PASS=admin1234
3. Database Setup
# Generate Prisma client types
npx prisma generate
# Run database migrations
npx prisma migrate dev
# (Optional) Seed admin user
npm run seed:admin
# (Optional) Open Prisma Studio to inspect data
npx prisma studio
4. Run the Server
npm run dev
The server will start at http://localhost:5000.
π§ͺ Useful Commands
Command
Description
npm run dev
Start development server with hot reload
npm run build
Build for Vercel deployment
npm run seed:admin
Seed the admin user
npx prisma generate
Regenerate Prisma client types
npx prisma migrate dev
Apply schema migrations
npx prisma studio
Open Prisma Studio GUI
npx @better-auth/cli generate
Regenerate Better Auth user models
π Error Handling
The API uses a centralized global error handler that returns consistent error responses: