How subrata-2002/vehicle-rental-system works
1. Repository shape
- This is a classic two-tier vehicle rental application with a React client in ClientSide/ and an Express/MongoDB backend in ServerSide/.
- The main domain objects are users, admins, cars, bookings/orders, and payments.
2. Client application boundary
- The client is a single-page app built from src/index.js and src/App.js, with route composition in src/AppRouter.js.
- public/index.html and manifest.json indicate a standard browser SPA deployment model rather than server-side rendering.
3. User-facing flow
- The user experience is organized around browsing cars, filtering results, making bookings, and handling order/payment steps.
- Relevant modules include src/Components/Home.js, Header.js, Navigation.js, Cards.js, FilterHeader.js, Map.js, and booking-related pages under src/Booking/ such as OrderPage.js, Page3.js, and ExistBookings.js.
4. Authentication and role split on the client
- The UI has separate entry points for user and admin authentication:
- src/User/UserLogin.js, UserSign.js
- src/Admin/AdminLogin.js, AdminSign.js
- This suggests role-specific routing and access control in the frontend, with different post-login experiences for each role.
5. Admin management flow
- Administrative car management lives under src/Components/AdminpageAllDetail/.
- The core admin screens are AdminPage.js, AddCarDetails.js, EditCarDetails.js, and FormStructure.js, with admin navigation in AdminpageNav.js.
- This part of the UI likely drives CRUD operations over the vehicle inventory and related metadata.
6. Payments and booking state
- Payment-related client code is grouped under src/Components/Payent/ with Payment.js, PaymentCard.js, and EditPaymentDetails.js.
- Booking state appears to be shared across pages via src/Context/CarContext.js, which likely carries selected car, filters, and booking details across the multi-step flow.
- The client also contains utility wrappers in src/Utils/ApiUtilAdmin.js, ApiUtilUser.js, and ApiUtils.js, indicating a separate API abstraction layer for role-specific calls.
7. Backend API surface
- The server is an Express app rooted at src/app.js, with routes split by domain:
- router/UserRouts.js
- router/AdminRouter.js
- router/CarRouts.js
- router/OrderRouter.js
- router/Newbooking.js
- router/booking.js
- router/MapRoute.js
- Controllers mirror those routes in src/Controllers/, which keeps request handling separated by business area.
8. Data model layer
- MongoDB persistence is modeled through Mongoose schemas in src/model/:
- UserSchema.js
- AdminSchema.js
- CarSchema.js
- PlacedOrdersSchema.js
- This makes the main persisted entities explicit: authenticated principals, inventory records, and booking/order records.
9. Authentication and request validation
- GernerateToken.js suggests token-based authentication for login/session handling.
- ValidateID.js indicates custom ID validation, likely used to protect update/delete/order operations against invalid or malformed resource references.
- The presence of distinct admin/user schemas implies authorization is role-aware, not just generic login.
10. Database and infrastructure
- src/db/connection.js is the database integration point, and the rest of the server depends on it for persistence.
- The app structure strongly suggests MongoDB as the primary datastore, with the backend acting as the API layer between the SPA and the database.
11. External/auxiliary services
- src/Components/Map.js and src/router/MapRoute.js imply a mapping/location feature; the exact provider is not shown, but map rendering is a distinct subsystem from booking/payment.
- No other third-party infrastructure is obvious from the tree, so the main architectural dependencies appear to be the browser, the Node/Express API, and the database.
12. End-to-end data flow
- The typical flow is: React UI → role-specific API utility → Express route → controller → Mongoose model → MongoDB, then responses return to the UI for rendering and state updates.
- Booking and payment are multi-step flows on the client, while inventory/admin operations are CRUD-style flows backed by the same API and schema layer.
Main entry points: AppRouter.js Routes · app.js Express app · connection.js Database link · UserController.js User controller
Components 28
Client SPA
React single-page application for user and admin flows
- App shell · SPA bootstrap and root composition
ClientSide/src/index.js - Routes · Top-level client route composition
ClientSide/src/AppRouter.js - Home UI · Main browsing experience and landing flow
ClientSide/src/Components/Home.js - Booking flow · Multi-step booking and order screens
ClientSide/src/Booking/OrderPage.js - Payments · Payment entry and edit screens
ClientSide/src/Components/Payent/Payment.js - User auth · User login and signup entry points
ClientSide/src/User/UserLogin.js - Admin auth · Admin login and signup entry points
ClientSide/src/Admin/AdminLogin.js - Admin panel · Inventory management screens for admins
ClientSide/src/Components/AdminpageAllDetail/AdminPage.js - Browse and filter · Cards, filters, and map-based discovery
ClientSide/src/Booking/Cards.js - Shared state · Cross-page booking and selection state
ClientSide/src/Context/CarContext.js - User API · Client-side wrapper for user-facing backend calls
ClientSide/src/Utils/ApiUtilUser.js - Admin API · Client-side wrapper for admin/backend management calls
ClientSide/src/Utils/ApiUtilAdmin.js
Server API
Express backend with routes, controllers, auth, and persistence
- Express app · Backend application bootstrap
ServerSide/src/app.js - User routes · User authentication and user-facing endpoints
ServerSide/src/router/UserRouts.js - Admin routes · Admin authentication and admin management endpoints
ServerSide/src/router/AdminRouter.js - Car routes · Vehicle inventory endpoints
ServerSide/src/router/CarRouts.js - Order routes · Booking and order endpoints
ServerSide/src/router/OrderRouter.js - User controller · User account and auth request handling
ServerSide/src/Controllers/UserController.js - Admin controller · Admin account and inventory management handling
ServerSide/src/Controllers/AdminController.js - Car controller · Vehicle lookup and CRUD request handling
ServerSide/src/Controllers/CarController.js - Order controller · Booking, order, and payment related handling
ServerSide/src/Controllers/OrderController.js - Token auth · Token generation and validation support
ServerSide/src/GernerateToken.js - ID validation · Resource ID checking for protected operations
ServerSide/src/ValidateID.js
Persistence
MongoDB models and database connection
- Database link · MongoDB connection setup
ServerSide/src/db/connection.js - Users · Persisted user accounts
ServerSide/src/model/UserSchema.js - Admins · Persisted admin accounts
ServerSide/src/model/AdminSchema.js - Cars · Persisted vehicle inventory
ServerSide/src/model/CarSchema.js - Orders · Persisted bookings and placed orders
ServerSide/src/model/PlacedOrdersSchema.js
Connections 36
- App shell → Routes: mounts · Bootstraps the SPA and hands off to routing
- Routes → Home UI: routes to · Composes the browsing and landing experience
- Routes → Booking flow: routes to · Composes booking and order screens
- Routes → Payments: routes to · Composes payment screens
- Routes → User auth: routes to · Exposes user auth entry points
- Routes → Admin auth: routes to · Exposes admin auth entry points
- Routes → Admin panel: routes to · Exposes admin inventory management
- Home UI → Browse and filter: uses · Home assembles browse/filter/map components
- Booking flow → Shared state: reads/writes · Shares selected car and booking state across steps
- Payments → Shared state: reads/writes · Shares payment and booking state across steps
- User auth → User API: calls · Uses user-facing API wrapper
- Admin auth → Admin API: calls · Uses admin-facing API wrapper
- Admin panel → Admin API: calls · Performs admin CRUD operations through API wrapper
- Browse and filter → User API: calls · Fetches inventory and booking data
- User API → Express app: HTTP · User client talks to backend API
- Admin API → Express app: HTTP · Admin client talks to backend API
- Express app → User routes: mounts · Registers user-related routes
- Express app → Admin routes: mounts · Registers admin-related routes
- Express app → Car routes: mounts · Registers vehicle routes
- Express app → Order routes: mounts · Registers booking and order routes
- User routes → User controller: delegates · Route handlers forward to user controller
- Admin routes → Admin controller: delegates · Route handlers forward to admin controller
- Car routes → Car controller: delegates · Route handlers forward to car controller
- Order routes → Order controller: delegates · Route handlers forward to order controller
- User controller → Token auth: uses · Auth helper supports login/session flows
- Admin controller → Token auth: uses · Auth helper supports role-aware login/session flows
- Car controller → ID validation: uses · Validates resource identifiers on CRUD operations
- Order controller → ID validation: uses · Validates order and booking identifiers
- User controller → Users: reads/writes · Persists user accounts
- Admin controller → Admins: reads/writes · Persists admin accounts
- Car controller → Cars: reads/writes · Persists vehicle inventory
- Order controller → Orders: reads/writes · Persists bookings and placed orders
- Users → Database link: uses · Mongoose models depend on the database connection
- Admins → Database link: uses · Mongoose models depend on the database connection
- Cars → Database link: uses · Mongoose models depend on the database connection
- Orders → Database link: uses · Mongoose models depend on the database connection