How gautamkr-10/rentify works
Project type and purpose
• This is a full-stack real estate rental application (“Rentify”) that provides both Next.js and Vite-based React frontends, a set of shareable UI components, multiple Express-based API services, and a MongoDB database. Its purpose is to connect property owners and tenants via authentication, property listings, filtering, dashboard management, email notifications, and file uploads.
File structure
• Top-level directories:
• app/ → Next.js 13 “app router” frontend
• frontend/ → Vite + React SPA frontend
• backend/ → Express API (auth, properties, users)
• server/ → Secondary Express API (similar structure)
• components/ → Shared UI library (Radix/Tailwind components)
• hooks/ → Custom React hooks (use-mobile, use-toast)
• lib/ → Shared utilities (utils.ts)
• Common patterns:
• Frontends organized by pages, components, context, services
• Backend organized as MVC: routes → controllers → models, plus middleware
• Shared code (components, hooks, lib) used by both frontends
• Config files: pnpm-lock.yaml, tsconfig.json, tailwind.config.*
README
• Confirms core features: authentication, property listing & filtering, dashboards, image upload, email notifications
• Tech stack: React, Next.js, Axios, Tailwind; Node.js, Express, MongoDB, JWT, Nodemailer, Multer
a. Main Components
• Next.js “app” frontend
• Vite React “frontend” SPA
• Shared UI Component Library (components/)
• Shared Hooks & Utilities (hooks/, lib/)
• API Services (backend/ and server/)
– Auth Service (login, register, JWT)
– Property Service (CRUD, filtering, image uploads)
– User Service (profile, saved/liked properties)
• MongoDB Database (atlas or self-hosted)
• External Services
– Email Service (Nodemailer SMTP)
– File Storage (local disk or cloud via Multer)
b. Relationships & Interactions
1. Clients (Next.js & Vite SPA) → send HTTP/HTTPS requests (Axios/Fetch) → API Gateway or direct API endpoints
2. AuthContext in clients manages JWT, injects Authorization header
3. API routes → invoke Express middleware (auth.js) → controllers → mongoose models → MongoDB
4. File uploads handled by Multer → stored in disk or cloud bucket → file URLs saved in DB
5. Controllers trigger Nodemailer to send email notifications on interest expressed
6. Both frontends import shared components, hooks, utils via monorepo workspace
c. Architectural Patterns & Principles
• Layered / MVC pattern in backend
• Component-driven UI architecture in frontends
• Monorepo modularization for code sharing (PNPM workspaces)
• Context API for global state (authentication)
• Separation of concerns: UI ↔ services/API ↔ data layer
d. Key Technologies & Frameworks to annotate
• Next.js 13 (app router)
• React + Vite
• Tailwind CSS
• Express.js
• Mongoose / MongoDB
• JSON Web Tokens
• Nodemailer, Multer