How mrinal-kr/nit-rental works
Project Type and Purpose
• Full-stack web application (browser-based SPA for car rentals)
• Users browse cars, authenticate, book rentals, and manage bookings via a dashboard
File Structure
• At top level:
– index.html (SPA entry point)
– main.js (frontend logic and API calls)
– styles.css (presentation)
• No backend code present in this tree ⇒ frontend interacts with external backend services/APIs
README for Additional Insights
• Core features imply components beyond the static front end:
– Authentication service
– Booking management service
– Car-inventory/catalog service
– Database for users, cars, bookings
– Potential payment gateway (if “secure booking” includes payments)
Main Components
a. Frontend (Browser/SPA)
• index.html, main.js, styles.css loaded from a web server or CDN
• UI modules: Car catalog, filters, calendar picker, login/signup form, dashboard
b. Backend API Layer
• Authentication Service (e.g. REST endpoints: /signup, /login, token management)
• Car Inventory Service (e.g. /cars, /cars/categories, /cars/availability)
• Booking Service (e.g. /bookings, /bookings/{user})
• (Optional) Payment Gateway integration
c. Data Layer
• Relational DB (Users, Cars, Bookings tables)
• Caching layer or in-memory store (for availability lookups)
d. External Services
• Email/SMS service (booking confirmations)
• Analytics or logging service
Relationships and Data Flows
• Browser → Web server/CDN: GET index.html, CSS, JS, assets
• main.js (SPA) → Backend API:
– Auth calls return JWT or session cookie
– Catalog calls fetch car listings (with filters)
– Booking calls reserve a car, confirm dates
• Backend services → Database: CRUD operations on entities
• Booking service → Payment gateway (if processing payments)
• Booking service → Email/SMS service for notifications
Architectural Patterns and Design Principles
• Separation of Concerns:
– UI layer (frontend) vs Business Logic/API layer vs Data layer
• RESTful API design for services
• Single-Page Application (SPA) for seamless user experience
• Stateless backend services with token-based authentication
• Microservices-style decomposition (optional; can be grouped as a monolith API)