FixItNow is a home service marketplace backend built with Node.js, Express, TypeScript, PostgreSQL, Prisma, JWT authentication, and Stripe payment integration.
This repository contains API endpoints for:
- User registration and login
- Role-based access for Customer, Technician, and Admin
- Service and category management
- Booking creation and status management
- Stripe payment session creation and confirmation
- Reviews for completed bookings
- Install dependencies
npm install- Create
.envwith these values:
PORT=5000
DATABASE_URL=your_postgres_url
FRONTEND_URL=http://localhost:5173
BACKEND_URL=http://localhost:5000
BCRYPT_SALT_ROUNDS=10
JWT_ACCESS_SECRET=your_access_secret
JWT_REFRESH_SECRET=your_refresh_secret
JWT_ACCESS_EXPIRES_IN=1d
JWT_REFRESH_EXPIRES_IN=7d
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
NODE_ENV=development- Run the server
npm run dev- API base URL
http://localhost:5000/api
Import the file FixItNow.postman_collection.json into Postman to create the full API collection.
POST /api/auth/register
Body example:
{
"name": "tashrif",
"email": "tashrif@gmail.com",
"password": "password123",
"phone": "01712345678",
"role": "CUSTOMER"
}POST /api/auth/login
Body example:
{
"email": "tashrif@gmail.com",
"password": "password123"
}POST /api/auth/refresh-token
Uses the cookie refreshToken set by login.
GET /api/auth/me
Requires header:
Authorization: Bearer {{accessToken}} and cookiesGET /api/users/me
PATCH /api/users/me
Body example:
{
"name": "Tashrif Miaji",
"phone": "01712345678"
}GET /api/admin/users
Requires admin role.
GET /api/category
GET /api/category/:id
POST /api/category
Body example:
{
"name": "Plumbing",
"description": "Home plumbing and pipe repair services"
}PATCH /api/category/:id
Body example:
{
"name": "Electrical",
"description": "Electrical wiring and repair services"
}DELETE /api/category/:id
Requires admin role.
GET /api/service
GET /api/service/:id
POST /api/service
Body example:
{
"title": "House Wiring",
"description": "Full house wiring and electrical maintenance",
"price": 2500,
"categoryId": "<category-id>"
}PATCH /api/service/:id
Body example:
{
"price": 3000
}DELETE /api/service/:id
GET /api/technician
GET /api/technician/:id
POST /api/technician/profile
Body example:
{
"bio": "Experienced electrician and handyman.",
"experience": 4,
"location": "Dhaka"
}PUT /api/technician/profile
Body example:
{
"bio": "Experienced electrician and handyman with 5 years of work.",
"experience": 5
}POST /api/booking
Body example:
{
"serviceId": "<service-id>",
"bookingDate": "2026-08-10T10:00:00.000Z"
}GET /api/booking
GET /api/booking/:id
PATCH /api/booking/:id
Body example:
{
"status": "ACCEPTED"
}POST /api/payment/create
Body example:
{
"bookingId": "<booking-id>"
}POST /api/payment/confirm
Body example:
{
"sessionId": "<stripe-session-id>"
}GET /api/payment
GET /api/payment/:id
GET /api/review
POST /api/review
Body example:
{
"bookingId": "<booking-id>",
"rating": 5,
"comment": "Excellent job, very professional."
}PATCH /api/review/:id
Body example:
{
"rating": 4,
"comment": "Work was good, but arrival was slightly delayed."
}GET /api/admin/bookings
PATCH /api/admin/users/:id
Body example:
{
"status": "BANNED"
}All errors return structured JSON:
{
"success": false,
"statusCode": 400,
"message": "Validation Error",
"errorDetails": [
{
"path": "body.email",
"message": "Invalid email address"
}
]
}- Use
Authorization: Bearer <token>header for protected routes. - Stripe webhook endpoint is available at
POST /api/payments/webhook/stripe. - Register any user role using
/api/auth/register, includingADMIN,CUSTOMER, andTECHNICIAN.