How hungnguyen3205/car_rental_website works
Purpose and topology
Midnight Luxury is a decoupled car-rental platform: a Vue client/admin SPA, Laravel JSON API and MySQL persistence, plus a separate Python chatbot service. Docker assets and a top-level load-balancer configuration support multi-service deployment: docker-compose.yml, nginx_lb/nginx.conf, BE/Dockerfile.
Frontend application
The Vue/Vite SPA is the user-facing entry point, bootstrapped at FE/src/main.js and composed through FE/src/App.vue. Route selection separates public/client flows from administration in FE/src/router/index.js; layouts establish the role-specific shells in FE/src/layout/wrapper/Client/index.vue and FE/src/layout/wrapper/Admin/index.vue.
Rental and customer journey
Client pages present fleet discovery, booking/trip history, authentication, and profile flows. Fleet and booking views consume API data through the shared request layer at FE/src/core/baseRequest.js. The principal user path is browse vehicles → submit booking → inspect trip/detail, represented by FE/src/pages/Fleet/index.vue, FE/src/pages/Client/MyTrips/index.vue, and FE/src/pages/Client/MyTrips/BookingDetail.vue.
Laravel API and domain boundary
Laravel is the authoritative business/API layer, entered through BE/public/index.php and API route definitions in BE/routes/api.php. Controllers partition client, admin, and authentication responsibilities: BE/app/Http/Controllers/Client/BookingController.php, BE/app/Http/Controllers/Admin/BookingController.php, and BE/app/Http/Controllers/Auth/AuthController.php. Social login is isolated in BE/app/Http/Controllers/Auth/SocialAuthController.php.
Persistence and operational workflows
Eloquent domain models define the core rental records—cars, categories, bookings, users, and separate admins—at BE/app/Models/Car.php, BE/app/Models/Booking.php, and BE/app/Models/Admin.php. MySQL schema evolution establishes booking locations and uploaded bill images via BE/database/migrations/2026_04_30_094849_add_locations_to_bookings_table.php and BE/database/migrations/2026_04_30_085549_add_bill_image_to_bookings_table.php; bill artifacts are exposed under BE/public/uploads/bills.
Administration
Admin-only UI handles dashboard, fleet, and booking operations through the admin layout and corresponding Laravel controller boundary: FE/src/pages/Admin/Dashboard/index.vue, FE/src/pages/Admin/Cars/index.vue, FE/src/pages/Admin/Bookings/index.vue; BE/app/Http/Controllers/Admin/DashboardController.php, BE/app/Http/Controllers/Admin/CarController.php.
AI assistant service
The chatbot is an independently deployable FastAPI/Python service, started at AI_Assistant/main.py. It classifies customer intents defined in AI_Assistant/intents.json using custom model and NLP preprocessing modules: AI_Assistant/model.py, AI_Assistant/nltk_utils.py. Training produces/uses the model artifact AI_Assistant/data.pth; the client chat surface is FE/src/components/Common/ChatWidget.vue. This is a direct frontend-to-AI HTTP boundary, distinct from Laravel’s rental authority.
Main entry points: api.php API routes · docker-compose.yml Service deployment · index.js Role router · BookingController.php Client booking API
Components 20
Vue SPA
Client and admin single-page application.
- SPA bootstrap
FE/src/main.js - App shell
FE/src/App.vue - Role router · Separates client and admin routes.
FE/src/router/index.js - Client layout
FE/src/layout/wrapper/Client/index.vue - Admin layout
FE/src/layout/wrapper/Admin/index.vue - Fleet and trips · Browse vehicles, submit bookings, and inspect trip details.
FE/src/pages/Fleet/index.vue - API request layer
FE/src/core/baseRequest.js - Admin operations · Dashboard, car, and booking management.
FE/src/pages/Admin/Dashboard/index.vue - Chat widget
FE/src/components/Common/ChatWidget.vue
Laravel API
Authoritative rental and administration API.
- Laravel entry
BE/public/index.php - API routes
BE/routes/api.php - Client booking API
BE/app/Http/Controllers/Client/BookingController.php - Admin API · Dashboard, fleet, and booking administration.
BE/app/Http/Controllers/Admin/CarController.php - Auth and social login
BE/app/Http/Controllers/Auth/AuthController.php - Rental domain models · Cars, bookings, users, admins, and categories.
BE/app/Models/Booking.php - MySQL rental schema · Booking locations and bill-image fields evolve through migrations.
BE/database/migrations/2026_04_30_094849_add_locations_to_bookings_table.php - Bill uploads
BE/public/uploads/bills
AI Assistant
Independent intent-classification chatbot service.
- FastAPI chatbot · Serves customer intent responses independently of Laravel.
AI_Assistant/main.py - Intent model · Intent definitions, preprocessing, and trained model artifact.
AI_Assistant/model.py
Other components
- Service deployment · Composes services behind the top-level load balancer.
docker-compose.yml
Connections 22
- SPA bootstrap → App shell: mounts
- App shell → Role router: uses
- Role router → Client layout: client routes
- Role router → Admin layout: admin routes
- Client layout → Fleet and trips: renders
- Admin layout → Admin operations: renders
- Fleet and trips → API request layer: rental requests
- Admin operations → API request layer: admin requests
- API request layer → Laravel entry: JSON HTTP
- Laravel entry → API routes: dispatches
- API routes → Client booking API: client booking
- API routes → Admin API: admin operations
- API routes → Auth and social login: authentication
- Client booking API → Rental domain models: reads and writes
- Admin API → Rental domain models: manages
- Rental domain models → MySQL rental schema: persists
- Client booking API → Bill uploads: stores bill images
- Chat widget → FastAPI chatbot: direct HTTP · Bypasses Laravel rental authority.
- FastAPI chatbot → Intent model: classifies intents
- Service deployment → SPA bootstrap: deploys frontend
- Service deployment → Laravel entry: deploys API
- Service deployment → FastAPI chatbot: deploys chatbot