Skip to content

rahmancoder/FixService_payment

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

Technology Usage
Node.js Runtime
Express.js Backend Framework
TypeScript Language
PostgreSQL Database
Prisma ORM ORM
JWT Authentication
Bcrypt Password Hashing
Stripe Payment Gateway
Cookie Parser Authentication
CORS Cross Origin Support

Prisma ORM Database Relation 8/8

Table Has Many Belongs To Has One
User Booking, Payment, Review - TechnicianProfile
TechnicianProfile Service, Availability, Booking, Review User -
Category Service - -
Service Booking Category, TechnicianProfile -
Booking - Customer(User), TechnicianProfile, Service Payment, 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

API Customer Technician Admin
Register Can Can Can't
Login Can Can Can
Browse Services Can Can Can
Create Booking Can Can't Can
Payment Can Can't Can't
Review Can Can't Can't
Manage Services Can't Can Can't
Update Availability Can't Can Can't
Manage Categories Can't Can't Can
Manage Users Can't Can't Can

API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register Register new user (customer/technician)
POST /api/auth/login Login user, return JWT
GET /api/auth/me Get current authenticated user

Services & Technicians (Public)

Method Endpoint Description
GET /api/services Get all services with filters (type, location, rating)
GET /api/technicians Get all technicians with filters
GET /api/technicians/:id Get technician profile with reviews
GET /api/categories Get all service categories

Bookings

Method Endpoint Description
POST /api/bookings Create new booking (customer)
GET /api/bookings Get user's bookings
GET /api/bookings/:id Get booking details

Payments (Stripe / SSLCommerz)

Method Endpoint Description
POST /api/payments/create Create a payment intent/session for an accepted booking
POST /api/payments/confirm Confirm/verify payment (webhook or callback)
GET /api/payments Get user's payment history
GET /api/payments/single/:id Get payment details

Technician Management

Method Endpoint Description
PUT /api/technician/profile Update technician profile
PUT /api/technician/availability Update availability slots
GET /api/technician/bookings Get technician's bookings
PATCH /api/technician/bookings/:id Update booking status (accept/decline/complete)

Reviews

Method Endpoint Description
POST /api/reviews Create review (after job completion)

Admin

Method Endpoint Description
GET /api/admin/users Get all users
PATCH /api/admin/users/:id Update user status (ban/unban)
GET /api/admin/bookings Get all bookings
GET /api/admin/categories Get all categories
POST /api/admin/categories Create 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


Releases

No releases published

Packages

 
 
 

Contributors