# muhammed1675/rentora architecture

> Architecture diagram of the GitHub repository muhammed1675/rentora, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/muhammed1675/rentora
- Repository: https://github.com/muhammed1675/rentora

## Overview

#### Purpose and Entry Points
Rentora is a LAUTECH student-housing marketplace connecting tenants to admin-verified agents and listings. The primary client entry is `frontend/src/index.js`, which mounts the React application defined by `frontend/src/App.js`. Deployment targets Vercel, including serverless API routes under `frontend/api/`.

#### Client Application and Route Domains
React 19 provides the tenant, agent, and administrator experiences. Route-level pages organize key workflows: browsing and property detail/unlock in `frontend/src/pages/Browse.jsx` and `frontend/src/pages/PropertyDetails.jsx`; authenticated account management in `frontend/src/pages/Profile.jsx`; role-specific operations in `frontend/src/pages/AgentDashboard.jsx` and `frontend/src/pages/AdminDashboard.jsx`. Shared shell and listing presentation are in `frontend/src/components/Layout.jsx` and `frontend/src/components/PropertyCard.jsx`.

#### Authentication, Authorization, and Data Boundary
The browser accesses Supabase through `frontend/src/lib/supabase.js`, with session and role behavior centralized in `frontend/src/lib/auth.js`. Supabase PostgreSQL is the system of record; its Row Level Security policies enforce tenant, agent, and admin boundaries rather than relying solely on client-side routing. Canonical schema and policy evolution are represented by `supabase_schema.sql`, `supabase_quick_fix.sql`, and `supabase_migration_v2.sql`.

#### Property Marketplace and Agent Lifecycle
Agents must be verified by admins before they can operate as trusted listers. Agents manage listings, availability, inspection pricing, and earnings via `frontend/src/pages/AgentDashboard.jsx`; admins review verification and platform activity through `frontend/src/pages/AdminDashboard.jsx`. Tenant-facing discovery, comparison, and conversion are handled by `frontend/src/pages/Browse.jsx`, `frontend/src/pages/Compare.jsx`, and `frontend/src/pages/PropertyDetails.jsx`.

#### Token Unlocks and Payment Processing
The platform gates full property/contact details behind token purchases, represented by `frontend/src/pages/BuyTokens.jsx`. Payment initiation and verification cross a server-side boundary through Vercel functions: `frontend/api/korapay-init.js`, `frontend/api/korapay-verify.js`, and `frontend/api/confirm-payment.js`. Client payment integration is encapsulated in `frontend/src/lib/korapay.js`; Korapay is the external payment provider.

#### Inspections, Rent Escrow, and Payouts
Inspection bookings and rent payments feed database-managed financial state. Rentora retains payments in escrow until tenant move-in confirmation, or automatic release after five days; agents receive 70% while Rentora retains 30%. This critical lifecycle, payout calculations, trigger/function logic, and dynamic inspection fees are defined in `supabase_migration_v2.sql`, with the payment callback UI in `frontend/src/pages/PaymentCallback.jsx`.

#### Infrastructure and Supporting Services
Vercel serves the React build and hosts API functions, configured by `frontend/vercel.json`. Supabase supplies PostgreSQL, authentication, RLS, and database-side business automation. Email/contact and reply operations are serverless endpoints in `frontend/api/send-email.js` and `frontend/api/send-reply.js`. A separate Python backend exists at `backend/server.py`, but the documented primary production architecture centers on the React/Vercel/Supabase stack.

Main entry points: [`frontend/src/App.js`](https://github.com/muhammed1675/rentora/blob/main/frontend/src/App.js) (Application routes), [`frontend/src/lib/supabase.js`](https://github.com/muhammed1675/rentora/blob/main/frontend/src/lib/supabase.js) (Supabase client), [`frontend/api/korapay-init.js`](https://github.com/muhammed1675/rentora/blob/main/frontend/api/korapay-init.js) (Payment functions), [`frontend/vercel.json`](https://github.com/muhammed1675/rentora/blob/main/frontend/vercel.json) (React deployment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_entry["Client entry<br/>React bootstrap<br/>[index.js]"]
  node_app["Application routes<br/>React app<br/>[App.js]"]
  node_shell["Shared shell<br/>UI components<br/>[Layout.jsx]"]
  node_marketplace["Property discovery<br/>tenant pages<br/>[Browse.jsx]"]
  node_property_detail["Property unlock<br/>tenant page"]
  node_account["Account profile<br/>account page<br/>[Profile.jsx]"]
  node_agent_dashboard["Agent operations<br/>agent page<br/>[AgentDashboard.jsx]"]
  node_admin_dashboard["Admin operations<br/>admin page<br/>[AdminDashboard.jsx]"]
  node_token_purchase["Token purchase<br/>payment page<br/>[BuyTokens.jsx]"]
  node_client_auth["Auth and roles<br/>client auth<br/>[auth.js]"]
  node_supabase_client["Supabase client<br/>data client<br/>[supabase.js]"]
  node_korapay_client["Korapay client<br/>payment client<br/>[korapay.js]"]
end

subgraph group_vercel["Vercel"]
  node_vercel_hosting["React deployment<br/>static hosting<br/>[vercel.json]"]
  node_payment_api{{"Payment functions<br/>serverless API<br/>[korapay-init.js]"}}
  node_email_api{{"Email functions<br/>serverless API<br/>[send-email.js]"}}
end

subgraph group_supabase["Supabase"]
  node_supabase[("Auth, RLS, and PostgreSQL<br/>backend platform")]
  node_financial_lifecycle["Escrow and payouts<br/>database automation"]
end

node_korapay["Korapay<br/>payment provider"]
node_python_backend["Python backend<br/>separate backend<br/>[server.py]"]

node_entry -->|"mounts"| node_app
node_app -->|"renders"| node_shell
node_app -->|"tenant routes"| node_marketplace
node_marketplace -->|"opens"| node_property_detail
node_app -->|"account route"| node_account
node_app -->|"agent route"| node_agent_dashboard
node_app -->|"admin route"| node_admin_dashboard
node_app -->|"purchase route"| node_token_purchase
node_app -->|"uses"| node_client_auth
node_client_auth -->|"session and role access"| node_supabase_client
node_marketplace -->|"reads listings"| node_supabase_client
node_agent_dashboard -->|"manages listings"| node_supabase_client
node_admin_dashboard -->|"verifies agents"| node_supabase_client
node_supabase_client -->|"queries under RLS"| node_supabase
node_token_purchase -->|"starts payment"| node_korapay_client
node_korapay_client -->|"calls"| node_payment_api
node_payment_api -->|"initiate and verify"| node_korapay
node_payment_api -->|"records payment state"| node_supabase
node_supabase -->|"executes automation"| node_financial_lifecycle
node_vercel_hosting -->|"serves"| node_app
node_vercel_hosting -->|"hosts"| node_payment_api
node_vercel_hosting -->|"hosts"| node_email_api

click node_entry "https://github.com/muhammed1675/rentora/blob/main/frontend/src/index.js"
click node_app "https://github.com/muhammed1675/rentora/blob/main/frontend/src/App.js"
click node_shell "https://github.com/muhammed1675/rentora/blob/main/frontend/src/components/Layout.jsx"
click node_marketplace "https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/Browse.jsx"
click node_property_detail "https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/PropertyDetails.jsx"
click node_account "https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/Profile.jsx"
click node_agent_dashboard "https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/AgentDashboard.jsx"
click node_admin_dashboard "https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_token_purchase "https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/BuyTokens.jsx"
click node_client_auth "https://github.com/muhammed1675/rentora/blob/main/frontend/src/lib/auth.js"
click node_supabase_client "https://github.com/muhammed1675/rentora/blob/main/frontend/src/lib/supabase.js"
click node_korapay_client "https://github.com/muhammed1675/rentora/blob/main/frontend/src/lib/korapay.js"
click node_vercel_hosting "https://github.com/muhammed1675/rentora/blob/main/frontend/vercel.json"
click node_payment_api "https://github.com/muhammed1675/rentora/blob/main/frontend/api/korapay-init.js"
click node_email_api "https://github.com/muhammed1675/rentora/blob/main/frontend/api/send-email.js"
click node_financial_lifecycle "https://github.com/muhammed1675/rentora/blob/main/supabase_migration_v2.sql"
click node_python_backend "https://github.com/muhammed1675/rentora/blob/main/backend/server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_app,node_shell,node_marketplace,node_property_detail,node_account,node_agent_dashboard,node_admin_dashboard,node_token_purchase,node_client_auth,node_supabase_client,node_korapay_client toneBlue
class node_vercel_hosting,node_payment_api,node_email_api toneAmber
class node_supabase,node_financial_lifecycle toneMint
class node_korapay,node_python_backend toneNeutral
```

## Components

### React client

- [Client entry](https://github.com/muhammed1675/rentora/blob/main/frontend/src/index.js): React bootstrap · `frontend/src/index.js`
- [Application routes](https://github.com/muhammed1675/rentora/blob/main/frontend/src/App.js): React app · Role-aware tenant, agent, and admin experiences. · `frontend/src/App.js`
- [Shared shell](https://github.com/muhammed1675/rentora/blob/main/frontend/src/components/Layout.jsx): UI components · `frontend/src/components/Layout.jsx`
- [Property discovery](https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/Browse.jsx): tenant pages · Browse, compare, and inspect listing details. · `frontend/src/pages/Browse.jsx`
- [Property unlock](https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/PropertyDetails.jsx): tenant page · Gates full property and contact details. · `frontend/src/pages/PropertyDetails.jsx`
- [Account profile](https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/Profile.jsx): account page · `frontend/src/pages/Profile.jsx`
- [Agent operations](https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/AgentDashboard.jsx): agent page · Listings, availability, inspection prices, and earnings. · `frontend/src/pages/AgentDashboard.jsx`
- [Admin operations](https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/AdminDashboard.jsx): admin page · Agent verification and platform oversight. · `frontend/src/pages/AdminDashboard.jsx`
- [Token purchase](https://github.com/muhammed1675/rentora/blob/main/frontend/src/pages/BuyTokens.jsx): payment page · `frontend/src/pages/BuyTokens.jsx`
- [Auth and roles](https://github.com/muhammed1675/rentora/blob/main/frontend/src/lib/auth.js): client auth · `frontend/src/lib/auth.js`
- [Supabase client](https://github.com/muhammed1675/rentora/blob/main/frontend/src/lib/supabase.js): data client · `frontend/src/lib/supabase.js`
- [Korapay client](https://github.com/muhammed1675/rentora/blob/main/frontend/src/lib/korapay.js): payment client · `frontend/src/lib/korapay.js`

### Vercel

- [React deployment](https://github.com/muhammed1675/rentora/blob/main/frontend/vercel.json): static hosting · Serves the client build. · `frontend/vercel.json`
- [Payment functions](https://github.com/muhammed1675/rentora/blob/main/frontend/api/korapay-init.js): serverless API · Initiates, verifies, and confirms payment callbacks. · `frontend/api/korapay-init.js`
- [Email functions](https://github.com/muhammed1675/rentora/blob/main/frontend/api/send-email.js): serverless API · Sends contact and reply emails. · `frontend/api/send-email.js`

### Supabase

- **Auth, RLS, and PostgreSQL**: backend platform · System of record with database-enforced role boundaries.
- [Escrow and payouts](https://github.com/muhammed1675/rentora/blob/main/supabase_migration_v2.sql): database automation · Manages inspection fees, escrow release, and 70/30 payouts. · `supabase_migration_v2.sql`

### Other components

- **Korapay**: payment provider
- [Python backend](https://github.com/muhammed1675/rentora/blob/main/backend/server.py): separate backend · Present but outside the documented primary production path. · `backend/server.py`

## Connections

- Client entry → Application routes: mounts
- Application routes → Shared shell: renders
- Application routes → Property discovery: tenant routes
- Property discovery → Property unlock: opens
- Application routes → Account profile: account route
- Application routes → Agent operations: agent route
- Application routes → Admin operations: admin route
- Application routes → Token purchase: purchase route
- Application routes → Auth and roles: uses
- Auth and roles → Supabase client: session and role access
- Property discovery → Supabase client: reads listings
- Agent operations → Supabase client: manages listings
- Admin operations → Supabase client: verifies agents
- Supabase client → Auth, RLS, and PostgreSQL: queries under RLS
- Token purchase → Korapay client: starts payment
- Korapay client → Payment functions: calls
- Payment functions → Korapay: initiate and verify
- Payment functions → Auth, RLS, and PostgreSQL: records payment state
- Auth, RLS, and PostgreSQL → Escrow and payouts: executes automation
- React deployment → Application routes: serves
- React deployment → Payment functions: hosts
- React deployment → Email functions: hosts
