How santhosh-svss2018/passage works
Purpose and entry points
Passage is a full-stack rental marketplace for foreign tenants in India, covering property discovery, bookings, payments, identity documents, and role-specific operations. The local Express entry point is server.js; static SPA assets are served from public/index.html. Serverless deployment wraps the backend at netlify/functions/server.js.
Application shell and client flow
The browser app is a React SPA rooted in public/js/App.jsx, with shared API access in public/js/api.js. Navigation exposes public search/detail pages and authenticated tenant, owner, and admin workspaces. Key booking UI stages span public/js/pages/SearchPage.jsx, public/js/pages/PropertyDetailPage.jsx, public/js/pages/BookingPage.jsx, and public/js/pages/PaymentPage.jsx.
API boundary, identity, and roles
Express routes in routes/ form the backend boundary for the SPA. Authentication issues/consumes JWTs and enforces tenant, owner, and admin permissions through routes/authRoutes.js and middleware/authMiddleware.js. Upload handling is isolated in middleware/uploadMiddleware.js; document access and verification workflows are exposed through routes/documentRoutes.js and admin APIs.
Core rental domain
Mongo/Mongoose models represent the durable marketplace state: users, listings, availability, booking lifecycle, payments, reviews, inquiries, wishlists, and audit/notification records. Primary booking control flow is property selection → availability/double-booking validation → booking creation → payment record/status updates. Architectural anchors include models/Property.js, models/Availability.js, models/Booking.js, routes/propertyRoutes.js, and routes/bookingRoutes.js.
Payments, currency, and compliance
Payment routes support Razorpay and Stripe-oriented integration with a mock/test fallback; transaction data is stored separately from bookings in models/Payment.js and exposed by routes/paymentRoutes.js. INR is the base pricing model with conversion rates held in models/CurrencyRate.js and served by routes/currencyRoutes.js. Passport/visa metadata and verification status are managed through models/Document.js, supporting an admin review queue.
Operations and role workspaces
Owners manage listings, availability blocks, and booking requests through property, availability, and booking APIs. Admins operate platform metrics, moderation/approval queues, user controls, and document verification via routes/adminRoutes.js. Corresponding client boundaries are public/js/pages/OwnerDashboard.jsx and public/js/pages/AdminDashboard.jsx.
AI and deployment/runtime
The relocation assistant calls backend AI endpoints, intended for Gemini/OpenAI with a rule-based fallback: public/js/aiChatbot.js, public/js/components/AIAssistantModal.jsx, and routes/aiRoutes.js. Runtime is Node.js/Express with MongoDB; config/db.js provides a MongoDB Memory Server fallback. Seeded demo data enters through seed.js. Deployment targets include container/process hosting (Dockerfile, Procfile, render.yaml) and Netlify serverless/static hosting (netlify.toml, netlify/functions/server.js).
Main entry points: server.js Express application · App.jsx React application shell · OwnerDashboard.jsx Owner & admin workspaces · paymentRoutes.js Payment APIs
Components 19
React SPA
- Browser
- React application shell
public/js/App.jsx - API client
public/js/api.js - Search, detail & booking flow · Search through payment screens drive rental reservations.
public/js/pages/SearchPage.jsx - Owner & admin workspaces
public/js/pages/OwnerDashboard.jsx - Relocation assistant
public/js/aiChatbot.js
Express API
- Express application
server.js - JWT auth & role guard · Authenticates users and enforces tenant, owner, and admin access.
middleware/authMiddleware.js - Property & booking APIs
routes/bookingRoutes.js - Payment APIs
routes/paymentRoutes.js - Document & admin APIs
routes/documentRoutes.js - AI APIs · Uses Gemini/OpenAI when available, with rule-based fallback.
routes/aiRoutes.js
Marketplace Data
- Listings, availability & bookings · Availability validation prevents double booking before booking creation.
models/Booking.js - Payment records · Transactions are stored separately from bookings.
models/Payment.js - Documents & currency rates · Holds verification metadata and INR conversion rates.
models/Document.js
Runtime & Deployment
- MongoDB · Memory Server fallback is configured for local runtime.
config/db.js - Netlify serverless entry
netlify/functions/server.js - Static SPA entry
public/index.html
Other components
- Razorpay, Stripe & mock
Connections 23
- Browser → Static SPA entry: loads
- Static SPA entry → React application shell: boots
- React application shell → Search, detail & booking flow: navigates to
- React application shell → Owner & admin workspaces: role-based navigation
- React application shell → Relocation assistant: opens
- React application shell → API client: uses
- API client → Express application: HTTP requests
- Netlify serverless entry → Express application: wraps
- Express application → JWT auth & role guard: protects routes with
- Express application → Property & booking APIs: serves
- Express application → Payment APIs: serves
- Express application → Document & admin APIs: serves
- Express application → AI APIs: serves
- Property & booking APIs → Listings, availability & bookings: validates and persists
- Payment APIs → Payment records: records status
- Payment APIs → Razorpay, Stripe & mock: charges via
- Document & admin APIs → Documents & currency rates: reviews and serves
- Relocation assistant → AI APIs: assistant requests
- Listings, availability & bookings → MongoDB: persists in
- Payment records → MongoDB: persists in
- Documents & currency rates → MongoDB: persists in
- Owner & admin workspaces → Property & booking APIs: manages marketplace
- Owner & admin workspaces → Document & admin APIs: operates review queues