A complete backend API for managing vehicles, bookings, users, and role-based access control.
Built with Node.js, Express, TypeScript, PostgreSQL, and JWT Authentication.
Live URL: https://vehicle-rental-system-server.vercel.app/
- User registration & login
- JWT-based authentication
- Role-based access (admin, customer)
- Add, update & delete vehicles (Admin only)
- Vehicle name, type, daily rent price, status, registration number
- Endpoints:
/api/v1/vehicle/add/api/v1/vehicle/:id/update/api/v1/vehicle/:id/delete
- Customers can book vehicles
- Validates availability
- Calculates total price automatically
- Updates vehicle status after booking
- Customers can cancel before start date
- Admin can mark booking as returned
- System prevents invalid actions
- Encrypted passwords
- JWT authentication
- Role-based middleware
| Layer | Technology |
|---|---|
| Language | TypeScript |
| Runtime | Node.js |
| Framework | Express.js |
| Database | PostgreSQL |
| ORM / Query | pg (node-postgres) |
| Auth | JWT |
| Deployment | Vercel |
git clone https://github.com/osmangonirabbi13/vehicle-rental-system-server.git
cd your-repo-namenpm installCreate a .env file:
CONNECTION_STR=postgresql://neondb_owner:<password>@<host>.pooler.<region>.neon.tech/<db>?sslmode=require
PORT=5000
JWT_SECRET="YOUR_JWT_SECRET_KEY"
npm run devhttp://localhost:5000/api/v1
https://github.com/osmangonirabbi13/vehicle-rental-system-server.git