Skip to content

Latest commit

ย 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš— AutoCare โ€” Car Service Booking System

A full-stack car service booking platform built with Next.js, React, TypeScript, PostgreSQL, and Prisma.

The application allows customers to manage their vehicles, browse available automotive services, and create and track service bookings. Administrators can manage bookings and update their status throughout the service lifecycle.

โœจ Features

๐Ÿ‘ค Authentication & User Management

  • User registration and login
  • Secure password hashing with bcryptjs
  • Role-based access control
  • User profiles
  • Customer and administrator roles

๐Ÿš˜ Vehicle Management

Customers can:

  • Add vehicles
  • Store vehicle make, model, year, and color
  • Store license plate and VIN information
  • Manage multiple vehicles
  • Associate vehicles with service bookings

๐Ÿ”ง Service Management

The system supports configurable automotive services including:

  • Oil changes
  • Brake services
  • Tire services
  • Vehicle maintenance
  • Other custom automotive services

Each service contains:

  • Service name
  • Description
  • Category
  • Price
  • Estimated duration
  • Active/inactive status

๐Ÿ“… Booking System

Customers can:

  • Select a vehicle
  • Select one or more services
  • Schedule a service
  • Add booking notes
  • View booking details
  • Track booking status

Bookings support the following statuses:

  • Pending
  • Approved
  • Rejected
  • In Progress
  • Completed
  • Cancelled

๐Ÿ› ๏ธ Admin Management

Administrators can manage the booking workflow and update booking statuses.

The system also supports administrator notes and stores the total booking price.


๐Ÿ—๏ธ Tech Stack

Frontend

  • Next.js 16
  • React 19
  • TypeScript
  • Tailwind CSS
  • Lucide React

Backend

  • Next.js
  • Node.js
  • Prisma ORM
  • PostgreSQL

Authentication & Security

  • bcryptjs for password hashing
  • jose for authentication/token functionality
  • Role-based authorization

Development Tools

  • ESLint
  • TypeScript
  • Prisma Studio
  • npm

The project uses Prisma 7.9.1 and PostgreSQL, with database generation handled automatically during installation/build.


๐Ÿ—„๏ธ Database Architecture

The application uses PostgreSQL with Prisma ORM.

Main Entities

User
 โ”‚
 โ”œโ”€โ”€ Vehicle
 โ”‚     โ”‚
 โ”‚     โ””โ”€โ”€ Booking
 โ”‚            โ”‚
 โ”‚            โ””โ”€โ”€ BookingService
 โ”‚                    โ”‚
 โ”‚                    โ””โ”€โ”€ Service
 โ”‚
 โ””โ”€โ”€ Booking

User

Stores customer and administrator accounts.

User
โ”œโ”€โ”€ id
โ”œโ”€โ”€ name
โ”œโ”€โ”€ email
โ”œโ”€โ”€ passwordHash
โ”œโ”€โ”€ phone
โ”œโ”€โ”€ role
โ”œโ”€โ”€ createdAt
โ””โ”€โ”€ updatedAt

Vehicle

Stores customer vehicle information.

Vehicle
โ”œโ”€โ”€ id
โ”œโ”€โ”€ userId
โ”œโ”€โ”€ make
โ”œโ”€โ”€ model
โ”œโ”€โ”€ year
โ”œโ”€โ”€ color
โ”œโ”€โ”€ licensePlate
โ”œโ”€โ”€ vin
โ””โ”€โ”€ createdAt

Service

Stores available automotive services.

Service
โ”œโ”€โ”€ id
โ”œโ”€โ”€ name
โ”œโ”€โ”€ description
โ”œโ”€โ”€ price
โ”œโ”€โ”€ durationMinutes
โ”œโ”€โ”€ category
โ”œโ”€โ”€ isActive
โ””โ”€โ”€ createdAt

Booking

Stores customer service appointments.

Booking
โ”œโ”€โ”€ id
โ”œโ”€โ”€ userId
โ”œโ”€โ”€ vehicleId
โ”œโ”€โ”€ status
โ”œโ”€โ”€ scheduledDate
โ”œโ”€โ”€ notes
โ”œโ”€โ”€ adminNotes
โ”œโ”€โ”€ totalPrice
โ”œโ”€โ”€ createdAt
โ””โ”€โ”€ updatedAt

BookingService

Connects bookings with the services selected by the customer while preserving the service price at the time of booking.

This allows service prices to change later without changing historical booking records.

The database schema defines these relationships using Prisma and PostgreSQL.


๐Ÿ“ Project Structure

booking-system/
โ”‚
โ”œโ”€โ”€ prisma/
โ”‚   โ””โ”€โ”€ schema.prisma
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/
โ”‚   โ”‚   โ”œโ”€โ”€ login/
โ”‚   โ”‚   โ”œโ”€โ”€ register/
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ db/
โ”‚   โ”‚   โ””โ”€โ”€ seed.ts
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ generated/
โ”‚       โ””โ”€โ”€ prisma/
โ”‚
โ”œโ”€โ”€ .env.example
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ eslint.config.mjs
โ”œโ”€โ”€ next.config.ts
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ postcss.config.mjs
โ”œโ”€โ”€ prisma.config.ts
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ README.md

๐Ÿš€ Getting Started

1. Clone the repository

git clone https://github.com/ghost2468developer/booking-system.git

Navigate into the project:

cd booking-system

2. Install dependencies

npm install

The project's postinstall script automatically runs Prisma Client generation after installation.

3. Configure environment variables

Create a .env file in the root directory:

DATABASE_URL="postgresql://USERNAME:PASSWORD@localhost:5432/postgres"

The repository includes a .env.example file with the expected PostgreSQL connection format.

โš ๏ธ Never commit your .env file or database credentials to GitHub.

4. Set up the database

Make sure PostgreSQL is running, then run:

npm run db:push

This synchronizes the Prisma schema with your PostgreSQL database.

5. Seed the database

To populate the database with sample services:

npm run db:seed

You can also use:

npm run seed

6. Start the development server

npm run dev

The application will be available at:

http://localhost:3000

๐Ÿงช Available Scripts

Command Description
npm run dev Start the development server
npm run build Generate Prisma Client and build the application
npm start Start the production server
npm run lint Run ESLint
npm run typecheck Run TypeScript type checking
npm run db:push Push Prisma schema to the database
npm run db:seed Seed the database
npm run db:reset Reset the database and reseed
npm run studio Open Prisma Studio

These scripts are defined in the project's package.json.


๐Ÿ” User Roles

The application currently supports two roles:

Customer

Customers can:

  • Register and log in
  • Manage their vehicles
  • Browse services
  • Create bookings
  • View their bookings
  • Track booking status

Administrator

Administrators can:

  • View bookings
  • Manage booking statuses
  • Add administrative notes
  • Manage the booking workflow

The Prisma schema defines the available roles as admin and user.


๐Ÿ“Š Booking Lifecycle

A booking can move through the following lifecycle:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Pending โ”‚
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
     โ”‚
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Approved โ”‚
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ In Progress โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Completed โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

A booking can also be:

Pending โ†’ Rejected
Pending โ†’ Cancelled
Approved โ†’ Cancelled

๐Ÿ’ก Key Technical Highlights

This project demonstrates practical full-stack development concepts including:

  • Full-stack application architecture
  • Authentication and authorization
  • Role-based access control
  • Relational database design
  • Prisma ORM
  • PostgreSQL
  • Database relationships
  • Many-to-many relationships through join tables
  • CRUD operations
  • Booking state management
  • Form handling
  • Server-side functionality with Next.js
  • Type-safe development with TypeScript
  • Environment variable management
  • Database seeding
  • Responsive UI development

๐Ÿ”ฎ Future Improvements

Potential improvements for future versions include:

  • Email notifications for booking updates
  • SMS notifications
  • Online payments
  • Customer booking cancellation/rescheduling
  • Admin analytics dashboard
  • Mechanic-specific accounts
  • Mechanic assignment to bookings
  • Service availability management
  • Calendar-based scheduling
  • Booking conflict prevention
  • Customer reviews and ratings
  • Invoice generation
  • Service history per vehicle
  • Automated testing
  • CI/CD pipeline
  • Production deployment

๐Ÿ–ฅ๏ธ Screenshots

Add screenshots of the application here:

docs/
โ”œโ”€โ”€ dashboard.png
โ”œโ”€โ”€ booking.png
โ”œโ”€โ”€ vehicles.png
โ”œโ”€โ”€ services.png
โ””โ”€โ”€ login.png

Example:

![Dashboard](docs/dashboard.png)

Screenshots are highly recommended for portfolio projects because they allow recruiters to understand the application without running it locally.


๐ŸŒ Live Demo

Live Demo: Coming soon

GitHub Repository: https://github.com/ghost2468developer/booking-system


Releases

Packages

Contributors

Languages