Skip to content

Repository files navigation

FixService Payment Solution For Home Services


Project Overview

FixService-Payment is a End-to-End backend API that provide a Home Service Platform With a Stripe Payment System.

Customers can browse services, hire technicians, make secure online payments, and review completed work.

Technicians can create professional profiles, manage services, accept bookings, and complete jobs.

Admin manage users, service categories, bookings, and platform moderation.


Features 3/3

01. Customer

  • Register & Login
  • Browse all services
  • Search & Filter technicians
  • Book technicians
  • Track booking status
  • Stripe Payment Integration
  • Payment History
  • Review completed services
  • Profile Management

02. Technician

  • Register as Technician
  • Create Technician Profile
  • Add Services
  • Manage Availability
  • Accept/Reject Bookings
  • Update Booking Status
  • Complete Jobs
  • Dashboard Analytics

03. Admin

  • User Management
  • Ban / Unban Users
  • Manage Categories
  • View All Bookings
  • Monitor Payments
  • Platform Moderation

Tech Stack

TechnologyUsage
Node.jsRuntime
Express.jsBackend Framework
TypeScriptLanguage
PostgreSQLDatabase
Prisma ORMORM
JWTAuthentication
BcryptPassword Hashing
StripePayment Gateway
Cookie ParserAuthentication
CORSCross Origin Support

Prisma ORM Database Relation 8/8

TableHas ManyBelongs ToHas One
UserBooking, Payment, Review-TechnicianProfile
TechnicianProfileService, Availability, Booking, ReviewUser-
CategoryService--
ServiceBookingCategory, TechnicianProfile-
Booking-Customer(User), TechnicianProfile, ServicePayment, Review
Payment-Booking, User-
Review-Booking, Customer(User), TechnicianProfile-
Availability-TechnicianProfile-


Project Architecture

fixitnow-Payment-backend/
│
├── prisma/
│ ├── migrations/ # Prisma migration history
│ ├── schema/
│ │ ├── availability.prisma
│ │ ├── booking.prisma
│ │ ├── category.prisma
│ │ ├── enums.prisma
│ │ ├── payment.prisma
│ │ ├── review.prisma
│ │ ├── schema.prisma # Main Prisma schema
│ │ ├── service.prisma
│ │ ├── technicianProfile.prisma
│ │ └── user.prisma
│ └── seed.ts # Database seeding
│
├── src/
│ ├── config/
│ │ └── index.ts # Environment configuration
│ │
│ ├── lib/
│ │ ├── prisma.ts # Prisma Client instance
│ │ └── stripe.ts # Stripe configuration
│ │
│ ├── middlewares/
│ │ ├── ApiError.ts # Custom API error class
│ │ ├── auth.ts # JWT Authentication & Role Authorization
│ │ ├── globalErrorHandler.ts # Global error handler
│ │ ├── notFound.ts # 404 handler
│ │ └── validationRequest.ts # Zod request validation middleware
│ │
│ ├── modules/
│ │ ├── admin/
│ │ │ ├── admin.controller.ts
│ │ │ ├── admin.route.ts
│ │ │ └── admin.service.ts
│ │ │
│ │ ├── auth/
│ │ │ ├── auth.controller.ts
│ │ │ ├── auth.interface.ts
│ │ │ ├── auth.route.ts
│ │ │ ├── auth.service.ts
│ │ │ └── auth.validation.ts
│ │ │
│ │ ├── booking/
│ │ │ ├── booking.controller.ts
│ │ │ ├── booking.route.ts
│ │ │ ├── booking.service.ts
│ │ │ └── booking.validation.ts
│ │ │
│ │ ├── category/
│ │ │ ├── category.controller.ts
│ │ │ ├── category.route.ts
│ │ │ └── category.service.ts
│ │ │
│ │ ├── payment/
│ │ │ ├── payment.controller.ts
│ │ │ ├── payment.route.ts
│ │ │ ├── payment.service.ts
│ │ │ └── payment.validation.ts
│ │ │
│ │ ├── review/
│ │ │ ├── review.controller.ts
│ │ │ ├── review.route.ts
│ │ │ ├── review.service.ts
│ │ │ └── review.validation.ts
│ │ │
│ │ ├── service/
│ │ │ ├── service.controller.ts
│ │ │ ├── service.route.ts
│ │ │ ├── service.service.ts
│ │ │ └── service.validation.ts
│ │ │
│ │ ├── technician/
│ │ │ ├── technician.controller.ts
│ │ │ ├── technician.interface.ts
│ │ │ ├── technician.route.ts
│ │ │ ├── technician.service.ts
│ │ │ └── technician.validation.ts
│ │ │
│ │ └── user/
│ │ ├── user.controller.ts
│ │ ├── user.interface.ts
│ │ ├── user.route.ts
│ │ └── user.service.ts
│ │
│ ├── utils/
│ │ ├── catchAsync.ts # Async error wrapper
│ │ ├── jwt.ts # JWT helper functions
│ │ ├── paginationHelper.ts # Pagination utility
│ │ └── sendResponse.ts # Standard API response formatter
│ │
│ ├── app.ts # Express application
│ └── server.ts # Server entry point
│
├── .env.example
├── .gitignore
├── README.md
├── package.json
├── package-lock.json
├── prisma.config.ts
├── tsconfig.json
├── tsup.config.ts
└── vercel.json

Authorization Matrix

APICustomerTechnicianAdmin
RegisterCanCanCan't
LoginCanCanCan
Browse ServicesCanCanCan
Create BookingCanCan'tCan
PaymentCanCan'tCan't
ReviewCanCan'tCan't
Manage ServicesCan'tCanCan't
Update AvailabilityCan'tCanCan't
Manage CategoriesCan'tCan'tCan
Manage UsersCan'tCan'tCan

API Endpoints

Authentication

MethodEndpointDescription
POST/api/auth/registerRegister new user (customer/technician)
POST/api/auth/loginLogin user, return JWT
GET/api/auth/meGet current authenticated user

Services & Technicians (Public)

MethodEndpointDescription
GET/api/servicesGet all services with filters (type, location, rating)
GET/api/techniciansGet all technicians with filters
GET/api/technicians/:idGet technician profile with reviews
GET/api/categoriesGet all service categories

Bookings

MethodEndpointDescription
POST/api/bookingsCreate new booking (customer)
GET/api/bookingsGet user's bookings
GET/api/bookings/:idGet booking details

Payments (Stripe / SSLCommerz)

MethodEndpointDescription
POST/api/payments/createCreate a payment intent/session for an accepted booking
POST/api/payments/confirmConfirm/verify payment (webhook or callback)
GET/api/paymentsGet user's payment history
GET/api/payments/single/:idGet payment details

Technician Management

MethodEndpointDescription
PUT/api/technician/profileUpdate technician profile
PUT/api/technician/availabilityUpdate availability slots
GET/api/technician/bookingsGet technician's bookings
PATCH/api/technician/bookings/:idUpdate booking status (accept/decline/complete)

Reviews

MethodEndpointDescription
POST/api/reviewsCreate review (after job completion)

Admin

MethodEndpointDescription
GET/api/admin/usersGet all users
PATCH/api/admin/users/:idUpdate user status (ban/unban)
GET/api/admin/bookingsGet all bookings
GET/api/admin/categoriesGet all categories
POST/api/admin/categoriesCreate new service category

Future Improvements

  • Email Notifications
  • SMS Notifications
  • Real-time Booking Updates
  • Chat Between Customer & Technician
  • AI Technician Recommendation
  • Multi-language Support
  • Admin Dashboard Analytics

Author

MD MUSTAFIZUR RAHMAN

Computer Science & Engineering Student

Backend Developer | TypeScript | Node.js | Express | PostgreSQL | Prisma