How parmesh-bhatt/furniture-rentals works
Purpose and Topology
This is a full-stack furniture-rental application. A React/Vite single-page client lets users browse products, manage accounts, book rentals, and complete payments; an Express API persists users, products, and bookings in MongoDB. Repository roots separate deployable client and server applications: client/src/main.jsx, server/index.js, and vercel.json.
Client Application Entry and Navigation
The browser application starts at client/src/main.jsx and composes its screens from client/src/App.jsx. Feature views cover public catalog and product detail flows, authentication/profile flows, and rental/payment confirmation: client/src/components/Products.jsx, client/src/components/Product-Single.jsx, and client/src/components/PaymentVerify.jsx. client/src/backend.jsx is the likely client-to-API boundary.
Catalog and Product Management
Products are the central rentable inventory domain. Customer-facing browsing and detail presentation reside in client/src/components/Products.jsx and client/src/components/Product-Single.jsx; server product CRUD is exposed through server/src/routes/productRoute.js and modeled in server/src/model/product.js. Administrative product creation is isolated in client/src/components/Admin/CreateProduct.jsx, separating catalog administration from consumer flows.
Identity and Access Boundary
User registration, sign-in, password recovery, and profile management are client concerns represented by client/src/components/SignUp.jsx, client/src/components/SignIn.jsx, and client/src/components/Profile.jsx. The API owns account persistence and authentication endpoints in server/src/routes/userRoute.js and server/src/model/user.js. JWT-based request protection is centralized in server/src/middlewares/auth.js, creating the authorization boundary for protected API operations.
Rental Booking Lifecycle
A rental is represented as a booking connecting a user and furniture/product for a requested period. Client dashboard surfaces likely provide rental/account state via client/src/components/Dashboard.jsx and client/src/components/Setting.jsx. Booking creation and retrieval are handled server-side by server/src/routes/bookRoute.js, with durable booking records defined in server/src/model/booking.js.
Payment Integration
Payment is a distinct stage after or alongside booking. The client receives/verifies the payment outcome in client/src/components/PaymentVerify.jsx; payment API endpoints are isolated in server/src/routes/paymentRoute.js. Razorpay is the declared external payment service, so payment-provider interaction belongs behind this server route boundary rather than in persisted frontend state.
Runtime and Infrastructure
The frontend runs as a Vite-built React application with Tailwind/PostCSS styling configuration in client/vite.config.js and client/tailwind.config.js. The backend is Node.js/Express, bootstrapped in server/index.js, with MongoDB connection setup isolated in server/config/connect.js. Mongoose models in server/src/model/user.js, server/src/model/product.js, and server/src/model/booking.js form the persistence boundary; CORS enables browser-to-API access.
Main entry points: backend.jsx API client boundary · App.jsx App navigation · index.js API bootstrap · Products.jsx Catalog and detail
Components 20
React client
Vite single-page application.
- Client entry
client/src/main.jsx - App navigation
client/src/App.jsx - Catalog and detail
client/src/components/Products.jsx - Product detail
client/src/components/Product-Single.jsx - Product creation
client/src/components/Admin/CreateProduct.jsx - Account flows · Registration, sign-in, and profile management.
client/src/components/SignIn.jsx - Rental dashboard
client/src/components/Dashboard.jsx - Payment verification
client/src/components/PaymentVerify.jsx - API client boundary
client/src/backend.jsx
Express API
Node.js backend and domain endpoints.
- API bootstrap · Configures Express, CORS, routes, and database connection.
server/index.js - JWT authorization · Protects authenticated API operations.
server/src/middlewares/auth.js - User endpoints
server/src/routes/userRoute.js - Product CRUD
server/src/routes/productRoute.js - Booking lifecycle · Creates and retrieves rentals.
server/src/routes/bookRoute.js - Payment endpoints · Server-side boundary for Razorpay interaction.
server/src/routes/paymentRoute.js
Persistence
MongoDB-backed Mongoose models.
- User model
server/src/model/user.js - Product model
server/src/model/product.js - Booking model · Links a user, product, and rental period.
server/src/model/booking.js - MongoDB · Connected by the server runtime.
server/config/connect.js
Other components
- Razorpay
Connections 25
- Client entry → App navigation: mounts
- App navigation → Catalog and detail: renders
- Catalog and detail → Product detail: opens product
- App navigation → Account flows: routes to
- App navigation → Rental dashboard: routes to
- App navigation → Payment verification: routes to
- Catalog and detail → API client boundary: loads inventory
- Product creation → API client boundary: manages inventory
- Account flows → API client boundary: account requests
- Rental dashboard → API client boundary: booking requests
- Payment verification → API client boundary: verifies payment
- API client boundary → API bootstrap: HTTP/CORS
- API bootstrap → User endpoints: mounts
- API bootstrap → Product CRUD: mounts
- API bootstrap → Booking lifecycle: mounts
- API bootstrap → Payment endpoints: mounts
- JWT authorization → User endpoints: guards protected access
- JWT authorization → Booking lifecycle: guards rental operations
- Product CRUD → Product model: CRUD
- User endpoints → User model: accounts
- Booking lifecycle → Booking model: rental records
- Payment endpoints → Razorpay: payment provider API
- User model → MongoDB: persists
- Product model → MongoDB: persists
- Booking model → MongoDB: persists