A complete backend system for managing a vehicle rental service, built with Node.js, TypeScript, Express, and PostgreSQL. This API supports role-based authentication, vehicle management, customer management, and booking operations.
Live API URL: https://barik-vehicle-rental-system.vercel.app/
GitHub Repository: https://github.com/abdulbariks/Vehicle-Rental-System
- User registration and login with JWT.
- Role-based access: Admin and Customer.
- Password hashing with bcrypt.
- Admin can add, update, delete vehicles.
- Public can view available vehicles.
- Availability tracking for each vehicle.
- Admin can view all users.
- Admin or user (self) can update profile.
- Admin can delete users (if no active bookings).
- Create new rental bookings.
- Auto price calculation based on rental duration.
- Customers see only their own bookings.
- Admin sees all bookings.
- Cancel, return, or complete bookings.
- Node.js + TypeScript
- Express.js (web framework)
- PostgreSQL (database)
- bcrypt (password hashing)
- jsonwebtoken (JWT authentication)
src/
├── config/
│ └── db.ts
├── modules/
│ ├── auth/
│ ├── users/
│ ├── vehicles/
│ ├── bookings/
├── middleware/
│ ├── auth.ts
├── app.ts
└── server.tsgit clone https://github.com/abdulbariks/Vehicle-Rental-System.git
cd vehicle-rental-systemnpm installDATABASE_URL = your_database_url;
JWT_SECRET = your_jwt_secret;
PORT = 5000;npm run dev``` https://barik-vehicle-rental-system.vercel.app/api/v1 ```- POST /auth/signup
- POST /auth/signin
- POST /vehicles (Admin)
- GET /vehicles
- GET /vehicles/:vehicleId
- PUT /vehicles/:vehicleId (Admin)
- DELETE /vehicles/:vehicleId (Admin)
- GET /users (Admin)
- PUT /users/:userId (Admin or Self)
- DELETE /users/:userId (Admin)
- POST /bookings
- GET /bookings (Admin or Self)
- PUT /bookings/:bookingId (Admin or Self)
- Vercel