A full-stack car reservation system built with NestJS (backend) and Angular (frontend), featuring user authentication, car management, and reservation functionality.
- Authentication & Authorization: JWT-based authentication with role-based access control
- User Management: User registration, login, and profile management
- Car Management: CRUD operations for car inventory with filtering capabilities
- Reservation System: Car reservation and release functionality
- Database: MongoDB with Mongoose ODM
- Security: Password hashing with bcrypt, CORS enabled
- Validation: Class-validator for request validation
- Modern UI: Built with Angular 18 and Tailwind CSS
- Responsive Design: Mobile-first approach with modern UX
- Authentication: Login and registration forms with guards
- Car Browsing: Search and filter cars by various criteria
- Reservation Management: View and manage car reservations
- Admin Panel: Administrative interface for car management
- SSR Support: Server-side rendering capabilities
- Framework: NestJS 11.x
- Database: MongoDB with Mongoose
- Authentication: JWT with Passport
- Validation: class-validator, class-transformer
- Security: bcrypt for password hashing
- Runtime: Node.js 24 (Alpine)
- Framework: Angular 18.x
- Styling: Tailwind CSS 4.x
- HTTP Client: Angular HttpClient with interceptors
- State Management: Angular services
- Build Tool: Angular CLI
- SSR: Angular Universal
- Package Manager: pnpm
- Linting: ESLint with Prettier
- Containerization: Docker & Docker Compose
- Node.js 18+
- pnpm (recommended) or npm
- MongoDB (local or cloud)
- Docker & Docker Compose (optional)
-
Clone the repository
git clone https://github.com/Mirian97/car-reservation-system.git cd car-reservation-system -
Backend Setup
cd server pnpm install -
Frontend Setup
cd ../web pnpm install -
Environment Variables
Create a
.envfile in theserverdirectory:# If you are running on Docker Compose, use: MONGODB_URI=mongodb://mongodb:27017/car-reservation # If you are running locally (without Docker), use: # MONGODB_URI=mongodb://localhost:27017/car-reservation JWT_SECRET=your-jwt-secret-key JWT_EXPIRES=7d PORT=3000
# From the project root
cd server
docker-compose up -dThis will start:
- MongoDB on port 27017
- NestJS API on port 3005
Backend:
cd server
pnpm run start:devFrontend:
cd web
pnpm startDatabase:
Make sure MongoDB is running locally or update the MONGODB_URI in your environment variables.
- Frontend: http://localhost:4200
- Backend API: http://localhost:3005
- MongoDB: localhost:27017
POST /auth/login- User loginPOST /auth/register- User registrationPUT /auth/edit/:id- Update user profile
GET /cars- Get all available carsPOST /cars- Create new car (Admin only)PUT /cars/:id- Update car (Admin only)DELETE /cars/:id- Delete car (Admin only)
GET /reservations- Get all reservationsGET /reservations/user/:userId- Get user's reservationsPOST /reservations- Create new reservationPUT /reservations/:id- Update reservationDELETE /reservations/:id- Cancel reservation
- User: Can browse cars, make reservations, view their profile
- Admin: Full access to car management and all reservations
Cars can be filtered by:
- Name (text search)
- Type (Sedan, SUV, CoupΓ©, etc.)
- Engine size
- Vehicle size (passenger capacity)
- Users can only have one active reservation at a time
- Cars can only be reserved by one user at a time
- Reservations can be cancelled, which releases the car
- JWT tokens for authentication
- Password hashing with bcrypt
- Role-based access control
- Input validation and sanitization
- CORS protection
Backend:
cd server
pnpm run build
pnpm run start:prodFrontend:
cd web
pnpm run buildThe project includes sample car data in assets/carros.json with various car types including:
- Sedans (Compact, Medium, Large)
- SUVs and Crossovers
- Pickup trucks
- Utility vehicles
- Sports cars (CoupΓ©)
Built with β€οΈ using NestJS and Angular