# adityakamble69/tiffin-hub architecture

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

- Interactive diagram: https://gitdiagram.com/adityakamble69/tiffin-hub
- Repository: https://github.com/adityakamble69/tiffin-hub

## Overview

Tiffin Hub is a homemade-food marketplace: customers discover kitchen plans and subscribe, while community NGOs accept meal sponsorships and volunteer requests. Kitchen owners manage plans and incoming orders; administrators verify organizations and oversee users and platform activity. The backend exposes the API and implements orders, payment, review, notification, and account behavior over Supabase, with optional Razorpay and email integrations. The README documents the user flows; several frontend pages and backend controllers were not sampled, so links between those layers are shown only where documentation or excerpts support them.

Main entry points: [`backend/src/services/requests.service.js`](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/requests.service.js) (Orders and subscriptions), [`backend/src/services/payments.service.js`](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/payments.service.js) (Payment processing), [`backend/src/config/supabase.js`](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/config/supabase.js) (Supabase database and auth), [`backend/src/services/notifications.service.js`](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/notifications.service.js) (Notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Marketplace web"]
  node_web_catalog["Kitchen and plan discovery<br/>[page.tsx]"]
  node_checkout_ui["Subscription checkout<br/>[Checkout.tsx]"]
  node_order_ui["Order tracking<br/>[OrderDetail.tsx]"]
  node_kitchen_ui["Kitchen workspace<br/>[PlanManager.tsx]"]
  node_ngo_ui["NGO support<br/>[SupportPanel.tsx]"]
  node_admin_ui["Admin console<br/>[AdminConsole.tsx]"]
  node_web_api["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_api_app["HTTP application<br/>[app.js]"]
  node_api_routes["API routes<br/>[index.js]"]
  node_controllers["Request controllers<br/>[index.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_profiles["User profiles"]
end

subgraph group_commerce["Orders and payments"]
  node_requests["Orders and subscriptions"]
  node_payments["Payment processing"]
  node_razorpay["Razorpay gateway"]
  node_reviews["Kitchen reviews<br/>[reviews.service.js]"]
end

subgraph group_community["Organizations and community"]
  node_organizations["Kitchens and NGOs"]
  node_plans["Kitchen plans<br/>[plans.service.js]"]
end

subgraph group_platform["Platform services"]
  node_supabase[("Supabase database and auth<br/>[supabase.js]")]
  node_notifications["Notifications"]
  node_email["Email delivery<br/>[email.service.js]"]
  node_audit["Audit logging<br/>[audit.service.js]"]
  node_env["Runtime configuration<br/>[env.js]"]
  node_db_helpers["Database helpers<br/>[db.js]"]
end

node_customer(("Customer"))
node_kitchen_owner(("Kitchen owner"))
node_admin_actor(("Administrator"))

node_customer -->|"browses kitchens"| node_web_catalog
node_web_catalog -->|"chooses a plan"| node_checkout_ui
node_customer -->|"subscribes"| node_checkout_ui
node_customer -->|"tracks order"| node_order_ui
node_kitchen_owner -->|"manages plans"| node_kitchen_ui
node_kitchen_owner -->|"manages incoming orders"| node_order_ui
node_customer -->|"sponsors meals"| node_ngo_ui
node_admin_actor -->|"reviews organizations"| node_admin_ui
node_web_api -.->|"calls API"| node_api_app
node_api_app -->|"mounts routes"| node_api_routes
node_api_routes -->|"dispatches"| node_controllers
node_api_routes -->|"applies auth"| node_auth
node_auth -->|"validates token"| node_supabase
node_auth -->|"resolves profile"| node_profiles
node_requests -->|"reads and writes"| node_supabase
node_requests -->|"notifies parties"| node_notifications
node_requests -->|"records admin actions"| node_audit
node_payments -->|"loads order"| node_requests
node_payments -->|"updates payment state"| node_supabase
node_payments -->|"creates and verifies payments"| node_razorpay
node_payments -->|"notifies payment"| node_notifications
node_reviews -->|"checks order"| node_requests
node_reviews -->|"notifies kitchen"| node_notifications
node_notifications -->|"sends email"| node_email
node_notifications -->|"stores and reads"| node_supabase
node_profiles -->|"reads and writes"| node_supabase
node_env -->|"configures client"| node_supabase
node_requests -->|"unwraps database results"| node_db_helpers
node_payments -->|"reads gateway settings"| node_env

click node_web_catalog "https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/app/providers/page.tsx"
click node_checkout_ui "https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/orders/Checkout.tsx"
click node_order_ui "https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/orders/OrderDetail.tsx"
click node_kitchen_ui "https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/kitchen/PlanManager.tsx"
click node_ngo_ui "https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/ngo/SupportPanel.tsx"
click node_admin_ui "https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/admin/AdminConsole.tsx"
click node_web_api "https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/lib/api.ts"
click node_api_app "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/app.js"
click node_api_routes "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/routes/index.js"
click node_controllers "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/controllers/index.js"
click node_auth "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/middleware/auth.js"
click node_profiles "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/profiles.service.js"
click node_supabase "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/config/supabase.js"
click node_requests "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/requests.service.js"
click node_payments "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/payments.service.js"
click node_reviews "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/reviews.service.js"
click node_organizations "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/organizations.service.js"
click node_plans "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/plans.service.js"
click node_notifications "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/notifications.service.js"
click node_email "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/email.service.js"
click node_audit "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/audit.service.js"
click node_env "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/config/env.js"
click node_db_helpers "https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/utils/db.js"

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_web_catalog,node_checkout_ui,node_order_ui,node_kitchen_ui,node_ngo_ui,node_admin_ui,node_web_api toneBlue
class node_api_app,node_api_routes,node_controllers,node_auth,node_profiles toneAmber
class node_requests,node_payments,node_razorpay,node_reviews toneMint
class node_organizations,node_plans toneRose
class node_supabase,node_notifications,node_email,node_audit,node_env,node_db_helpers,node_customer,node_kitchen_owner,node_admin_actor toneIndigo
```

## Components

### Marketplace web

- [Kitchen and plan discovery](https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/app/providers/page.tsx): `frontend/app/providers/page.tsx`
- [Subscription checkout](https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/orders/Checkout.tsx): `frontend/features/orders/Checkout.tsx`
- [Order tracking](https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/orders/OrderDetail.tsx): `frontend/features/orders/OrderDetail.tsx`
- [Kitchen workspace](https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/kitchen/PlanManager.tsx): `frontend/features/kitchen/PlanManager.tsx`
- [NGO support](https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/ngo/SupportPanel.tsx): `frontend/features/ngo/SupportPanel.tsx`
- [Admin console](https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/features/admin/AdminConsole.tsx): `frontend/features/admin/AdminConsole.tsx`
- [API client](https://github.com/adityakamble69/tiffin-hub/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### API and identity

- [HTTP application](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/app.js): `backend/src/app.js`
- [API routes](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/routes/index.js): `backend/src/routes/index.js`
- [Request controllers](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/controllers/index.js): `backend/src/controllers/index.js`
- [Authentication](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [User profiles](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/profiles.service.js): `backend/src/services/profiles.service.js`

### Orders and payments

- [Orders and subscriptions](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/requests.service.js): `backend/src/services/requests.service.js`
- [Payment processing](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/payments.service.js): `backend/src/services/payments.service.js`
- **Razorpay gateway**
- [Kitchen reviews](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/reviews.service.js): `backend/src/services/reviews.service.js`

### Organizations and community

- [Kitchens and NGOs](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/organizations.service.js): `backend/src/services/organizations.service.js`
- [Kitchen plans](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/plans.service.js): `backend/src/services/plans.service.js`

### Platform services

- [Supabase database and auth](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/config/supabase.js): `backend/src/config/supabase.js`
- [Notifications](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/notifications.service.js): `backend/src/services/notifications.service.js`
- [Email delivery](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/email.service.js): `backend/src/services/email.service.js`
- [Audit logging](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/services/audit.service.js): `backend/src/services/audit.service.js`
- [Runtime configuration](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/config/env.js): `backend/src/config/env.js`
- [Database helpers](https://github.com/adityakamble69/tiffin-hub/blob/main/backend/src/utils/db.js): `backend/src/utils/db.js`

### Other components

- **Customer**
- **Kitchen owner**
- **Administrator**

## Connections

- Customer → Kitchen and plan discovery: browses kitchens
- Kitchen and plan discovery → Subscription checkout: chooses a plan
- Customer → Subscription checkout: subscribes
- Customer → Order tracking: tracks order
- Kitchen owner → Kitchen workspace: manages plans
- Kitchen owner → Order tracking: manages incoming orders
- Customer → NGO support: sponsors meals
- Administrator → Admin console: reviews organizations
- API client → HTTP application: calls API
- HTTP application → API routes: mounts routes (evidence: `backend/src/app.js`)
- API routes → Request controllers: dispatches (evidence: `backend/src/routes/index.js`)
- API routes → Authentication: applies auth (evidence: `backend/src/routes/index.js`)
- Authentication → Supabase database and auth: validates token (evidence: `backend/src/middleware/auth.js`)
- Authentication → User profiles: resolves profile (evidence: `backend/src/middleware/auth.js`)
- Orders and subscriptions → Supabase database and auth: reads and writes (evidence: `backend/src/services/requests.service.js`)
- Orders and subscriptions → Notifications: notifies parties (evidence: `backend/src/services/requests.service.js`)
- Orders and subscriptions → Audit logging: records admin actions (evidence: `backend/src/services/requests.service.js`)
- Payment processing → Orders and subscriptions: loads order (evidence: `backend/src/services/payments.service.js`)
- Payment processing → Supabase database and auth: updates payment state (evidence: `backend/src/services/payments.service.js`)
- Payment processing → Razorpay gateway: creates and verifies payments (evidence: `backend/src/services/payments.service.js`)
- Payment processing → Notifications: notifies payment (evidence: `backend/src/services/payments.service.js`)
- Kitchen reviews → Orders and subscriptions: checks order (evidence: `backend/src/services/reviews.service.js`)
- Kitchen reviews → Notifications: notifies kitchen (evidence: `backend/src/services/reviews.service.js`)
- Notifications → Email delivery: sends email (evidence: `backend/src/services/notifications.service.js`)
- Notifications → Supabase database and auth: stores and reads (evidence: `backend/src/services/notifications.service.js`)
- User profiles → Supabase database and auth: reads and writes (evidence: `backend/src/services/profiles.service.js`)
- Runtime configuration → Supabase database and auth: configures client (evidence: `backend/src/config/supabase.js`)
- Orders and subscriptions → Database helpers: unwraps database results (evidence: `backend/src/services/requests.service.js`)
- Payment processing → Runtime configuration: reads gateway settings (evidence: `backend/src/services/payments.service.js`)
