# rumi-13/feasty architecture

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

- Interactive diagram: https://gitdiagram.com/rumi-13/feasty
- Repository: https://github.com/rumi-13/feasty

## Overview

1. **System shape**
   - Feasty is a two-tier MERN application: a **Node/Express backend** exposes REST APIs, and a **React/Vite frontend** renders the user experience.
   - The domain is centered on **short food reels** with **two roles**: regular users and food partners.

2. **Backend runtime and entry points**
   - `backend/server.js` is the process entry point, and `backend/src/app.js` likely assembles the Express app.
   - The backend is organized by classic Express layers: **routes → controllers → models/middleware/services**.

3. **API boundary and request flow**
   - Route files under `backend/src/routes` define the public API surface:
     - `auth.routes.js`
     - `food.routes.js`
     - `food-partner.routes.js`
   - Incoming requests are handled by controllers in `backend/src/controllers`, keeping transport concerns separated from business logic.

4. **Authentication and access control**
   - `backend/src/controllers/auth.controller.js` and `backend/src/middlewares/auth.middleware.js` indicate JWT-based login and authorization.
   - The middleware is the key security boundary for protecting role-specific endpoints, especially around partner content creation and user-only actions like saving or liking.

5. **Data model layer**
   - MongoDB access is abstracted through Mongoose models in `backend/src/models`.
   - The model set shows the core domain entities:
     - `user.model.js`
     - `foodpartner.model.js`
     - `food.model.js`
     - `like.model.js`
     - `save.model.js`
   - This suggests the backend stores both identity/role data and reel interaction state separately.

6. **Media handling and external storage**
   - `backend/src/services/storage.service.js` is a dedicated integration boundary for media storage.
   - Combined with the README, the system relies on **ImageKit** for video delivery, transformation, and thumbnail/poster generation rather than serving raw media from the app server.

7. **Backend functional domains**
   - `food.controller.js` and `food-partner.controller.js` indicate a split between:
     - partner-facing content management
     - general food reel retrieval and interaction
   - The backend likely orchestrates content upload, listing, and engagement events such as likes and saves.

8. **Frontend application shell**
   - The frontend is a Vite-powered React app with its own routing and styling pipeline.
   - `frontend/src/main.jsx` bootstraps the app, `App.jsx` is the top-level component, and `routes/AppRoutes.jsx` handles page-level navigation.

9. **Frontend page structure**
   - The UI is organized by user journey:
     - `pages/auth/*` for login/register flows
     - `pages/general/*` for landing and welcome screens
     - `pages/food-partner/*` for partner onboarding/profile/content creation
     - `pages/components/*` for reel playback and saved-content views
   - This mirrors the backend role split and makes the architecture role-driven rather than purely feature-driven.

10. **Frontend-to-backend communication**
   - `frontend/src/utils/axios.js` centralizes HTTP requests, so API calls likely share a common base URL and auth header behavior.
   - That utility is the main boundary between the React UI and Express API.

11. **Reel/feed experience**
   - The README describes a reel engine with **preloading, sticky caching, autoplay, and buffering management**.
   - In architecture terms, the frontend reel components are responsible for the high-performance playback experience, while the backend mainly supplies metadata and media URLs.

12. **Data flow summary**
   - A typical flow is:
     - user or partner authenticates
     - JWT is issued and reused in API calls
     - partner uploads or manages food reels
     - backend stores metadata in MongoDB and media in ImageKit
     - frontend fetches reel data, renders the feed, and tracks like/save interactions
   - This creates a clean separation between **identity, content metadata, engagement state, and media delivery**.

13. **Practical diagram boundaries**
   - For an architecture diagram, the main boxes are:
     - **React frontend**
     - **Express API**
     - **MongoDB/Mongoose data layer**
     - **ImageKit media/CDN service**
   - The most important arrows are auth, reel retrieval, upload/media delivery, and engagement updates.

Main entry points: [`backend/src/controllers/food.controller.js`](https://github.com/rumi-13/feasty/blob/main/backend/src/controllers/food.controller.js) (Food logic), [`frontend/src/routes/AppRoutes.jsx`](https://github.com/rumi-13/feasty/blob/main/frontend/src/routes/AppRoutes.jsx) (UI routes), [`backend/src/db/db.js`](https://github.com/rumi-13/feasty/blob/main/backend/src/db/db.js) (MongoDB), [`backend/src/routes`](https://github.com/rumi-13/feasty/tree/main/backend/src/routes) (Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_backend_entry["Server<br/>express entry<br/>[server.js]"]
  node_backend_app["App setup<br/>express app<br/>[app.js]"]
  node_backend_routes["Routes"]
  node_auth_routes["Auth API<br/>route module<br/>[auth.routes.js]"]
  node_food_routes["Food API<br/>route module<br/>[food.routes.js]"]
  node_partner_routes["Partner API<br/>route module"]
  node_backend_controllers["Controllers<br/>request handlers"]
  node_auth_ctrl["Auth logic<br/>controller<br/>[auth.controller.js]"]
  node_food_ctrl["Food logic<br/>controller<br/>[food.controller.js]"]
  node_partner_ctrl["Partner logic<br/>controller"]
  node_auth_mw["Auth guard<br/>middleware<br/>[auth.middleware.js]"]
  node_models[("Models<br/>mongoose schema")]
  node_food_model[("Food reel<br/>model<br/>[food.model.js]")]
  node_partner_model[("Food partner<br/>model")]
  node_user_model[("User<br/>model<br/>[user.model.js]")]
  node_like_model[("Likes<br/>model<br/>[like.model.js]")]
  node_save_model[("Saves<br/>model<br/>[save.model.js]")]
end

subgraph group_frontend["Frontend"]
  node_frontend_main["Main<br/>react entry<br/>[main.jsx]"]
  node_frontend_app["App shell<br/>react app<br/>[App.jsx]"]
  node_frontend_routes["UI routes<br/>route config<br/>[AppRoutes.jsx]"]
  node_axios_util["API client<br/>http client<br/>[axios.js]"]
  node_auth_pages["Auth pages<br/>page group"]
  node_general_pages["Landing pages<br/>page group"]
  node_partner_pages["Partner pages<br/>page group"]
  node_reel_pages["Reel views<br/>page group"]
end

subgraph group_external["External services"]
  node_storage["Media store<br/>storage service<br/>[storage.service.js]"]
  node_db[("MongoDB<br/>database connection<br/>[db.js]")]
  node_imagekit(("ImageKit<br/>cdn/media"))
end

node_backend_entry -->|"starts"| node_backend_app
node_backend_app -->|"mounts"| node_backend_routes
node_backend_routes -->|"includes"| node_auth_routes
node_backend_routes -->|"includes"| node_food_routes
node_backend_routes -->|"includes"| node_partner_routes
node_auth_routes -->|"delegates"| node_auth_ctrl
node_food_routes -->|"delegates"| node_food_ctrl
node_partner_routes -->|"delegates"| node_partner_ctrl
node_auth_routes -->|"protects"| node_auth_mw
node_food_routes -->|"protects"| node_auth_mw
node_partner_routes -->|"protects"| node_auth_mw
node_auth_ctrl -->|"reads/writes"| node_user_model
node_partner_ctrl -->|"reads/writes"| node_partner_model
node_food_ctrl -->|"reads/writes"| node_food_model
node_food_ctrl -->|"tracks"| node_like_model
node_food_ctrl -->|"tracks"| node_save_model
node_partner_ctrl -->|"creates"| node_food_model
node_food_model -->|"persists"| node_db
node_partner_model -->|"persists"| node_db
node_user_model -->|"persists"| node_db
node_like_model -->|"persists"| node_db
node_save_model -->|"persists"| node_db
node_partner_ctrl -->|"uploads media"| node_storage
node_storage -->|"delivers"| node_imagekit
node_frontend_main -->|"boots"| node_frontend_app
node_frontend_app -->|"uses"| node_frontend_routes
node_frontend_routes -->|"shows"| node_auth_pages
node_frontend_routes -->|"shows"| node_general_pages
node_frontend_routes -->|"shows"| node_partner_pages
node_frontend_routes -->|"shows"| node_reel_pages
node_auth_pages -->|"calls"| node_axios_util
node_partner_pages -->|"calls"| node_axios_util
node_reel_pages -->|"calls"| node_axios_util
node_axios_util -->|"requests"| node_backend_app
node_food_ctrl -->|"references media"| node_imagekit

click node_backend_entry "https://github.com/rumi-13/feasty/blob/main/backend/server.js"
click node_backend_app "https://github.com/rumi-13/feasty/blob/main/backend/src/app.js"
click node_backend_routes "https://github.com/rumi-13/feasty/tree/main/backend/src/routes"
click node_auth_routes "https://github.com/rumi-13/feasty/blob/main/backend/src/routes/auth.routes.js"
click node_food_routes "https://github.com/rumi-13/feasty/blob/main/backend/src/routes/food.routes.js"
click node_partner_routes "https://github.com/rumi-13/feasty/blob/main/backend/src/routes/food-partner.routes.js"
click node_backend_controllers "https://github.com/rumi-13/feasty/tree/main/backend/src/controllers"
click node_auth_ctrl "https://github.com/rumi-13/feasty/blob/main/backend/src/controllers/auth.controller.js"
click node_food_ctrl "https://github.com/rumi-13/feasty/blob/main/backend/src/controllers/food.controller.js"
click node_partner_ctrl "https://github.com/rumi-13/feasty/blob/main/backend/src/controllers/food-partner.controller.js"
click node_auth_mw "https://github.com/rumi-13/feasty/blob/main/backend/src/middlewares/auth.middleware.js"
click node_models "https://github.com/rumi-13/feasty/tree/main/backend/src/models"
click node_food_model "https://github.com/rumi-13/feasty/blob/main/backend/src/models/food.model.js"
click node_partner_model "https://github.com/rumi-13/feasty/blob/main/backend/src/models/foodpartner.model.js"
click node_user_model "https://github.com/rumi-13/feasty/blob/main/backend/src/models/user.model.js"
click node_like_model "https://github.com/rumi-13/feasty/blob/main/backend/src/models/like.model.js"
click node_save_model "https://github.com/rumi-13/feasty/blob/main/backend/src/models/save.model.js"
click node_storage "https://github.com/rumi-13/feasty/blob/main/backend/src/services/storage.service.js"
click node_db "https://github.com/rumi-13/feasty/blob/main/backend/src/db/db.js"
click node_frontend_main "https://github.com/rumi-13/feasty/blob/main/frontend/src/main.jsx"
click node_frontend_app "https://github.com/rumi-13/feasty/blob/main/frontend/src/App.jsx"
click node_frontend_routes "https://github.com/rumi-13/feasty/blob/main/frontend/src/routes/AppRoutes.jsx"
click node_axios_util "https://github.com/rumi-13/feasty/blob/main/frontend/src/utils/axios.js"
click node_auth_pages "https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/auth"
click node_general_pages "https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/general"
click node_partner_pages "https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/food-partner"
click node_reel_pages "https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/components"

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_backend_entry,node_backend_app,node_backend_routes,node_auth_routes,node_food_routes,node_partner_routes,node_backend_controllers,node_auth_ctrl,node_food_ctrl,node_partner_ctrl,node_auth_mw,node_models,node_food_model,node_partner_model,node_user_model,node_like_model,node_save_model toneBlue
class node_frontend_main,node_frontend_app,node_frontend_routes,node_axios_util,node_auth_pages,node_general_pages,node_partner_pages,node_reel_pages toneAmber
class node_storage,node_db,node_imagekit toneMint
```

## Components

### Backend

Express API, domain logic, and MongoDB data access

- [Server](https://github.com/rumi-13/feasty/blob/main/backend/server.js): express entry · Process entry point that starts the API · `backend/server.js`
- [App setup](https://github.com/rumi-13/feasty/blob/main/backend/src/app.js): express app · Assembles middleware, routes, and runtime configuration · `backend/src/app.js`
- [Routes](https://github.com/rumi-13/feasty/tree/main/backend/src/routes): api routes · Public REST surface for auth, food, and partner actions · `backend/src/routes`
- [Auth API](https://github.com/rumi-13/feasty/blob/main/backend/src/routes/auth.routes.js): route module · Login and registration endpoints · `backend/src/routes/auth.routes.js`
- [Food API](https://github.com/rumi-13/feasty/blob/main/backend/src/routes/food.routes.js): route module · Reel and engagement endpoints · `backend/src/routes/food.routes.js`
- [Partner API](https://github.com/rumi-13/feasty/blob/main/backend/src/routes/food-partner.routes.js): route module · Food partner endpoints for content management · `backend/src/routes/food-partner.routes.js`
- [Controllers](https://github.com/rumi-13/feasty/tree/main/backend/src/controllers): request handlers · HTTP handlers that coordinate business actions · `backend/src/controllers`
- [Auth logic](https://github.com/rumi-13/feasty/blob/main/backend/src/controllers/auth.controller.js): controller · Authentication and token issuance · `backend/src/controllers/auth.controller.js`
- [Food logic](https://github.com/rumi-13/feasty/blob/main/backend/src/controllers/food.controller.js): controller · Reel retrieval and engagement actions · `backend/src/controllers/food.controller.js`
- [Partner logic](https://github.com/rumi-13/feasty/blob/main/backend/src/controllers/food-partner.controller.js): controller · Partner onboarding and reel creation workflows · `backend/src/controllers/food-partner.controller.js`
- [Auth guard](https://github.com/rumi-13/feasty/blob/main/backend/src/middlewares/auth.middleware.js): middleware · JWT-based access control for protected routes · `backend/src/middlewares/auth.middleware.js`
- [Models](https://github.com/rumi-13/feasty/tree/main/backend/src/models): mongoose schema · Core domain entities persisted in MongoDB · `backend/src/models`
- [Food reel](https://github.com/rumi-13/feasty/blob/main/backend/src/models/food.model.js): model · Food reel metadata and content records · `backend/src/models/food.model.js`
- [Food partner](https://github.com/rumi-13/feasty/blob/main/backend/src/models/foodpartner.model.js): model · Partner account and profile records · `backend/src/models/foodpartner.model.js`
- [User](https://github.com/rumi-13/feasty/blob/main/backend/src/models/user.model.js): model · Regular user account records · `backend/src/models/user.model.js`
- [Likes](https://github.com/rumi-13/feasty/blob/main/backend/src/models/like.model.js): model · Per-user like state for reels · `backend/src/models/like.model.js`
- [Saves](https://github.com/rumi-13/feasty/blob/main/backend/src/models/save.model.js): model · Per-user saved reel state · `backend/src/models/save.model.js`

### Frontend

React/Vite app for user and partner journeys

- [Main](https://github.com/rumi-13/feasty/blob/main/frontend/src/main.jsx): react entry · Frontend bootstrap entry point · `frontend/src/main.jsx`
- [App shell](https://github.com/rumi-13/feasty/blob/main/frontend/src/App.jsx): react app · Top-level React component and layout composition · `frontend/src/App.jsx`
- [UI routes](https://github.com/rumi-13/feasty/blob/main/frontend/src/routes/AppRoutes.jsx): route config · Page-level navigation and protected route structure · `frontend/src/routes/AppRoutes.jsx`
- [API client](https://github.com/rumi-13/feasty/blob/main/frontend/src/utils/axios.js): http client · Shared Axios configuration for backend requests · `frontend/src/utils/axios.js`
- [Auth pages](https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/auth): page group · Login and registration screens for both roles · `frontend/src/pages/auth`
- [Landing pages](https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/general): page group · Welcome and home screens · `frontend/src/pages/general`
- [Partner pages](https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/food-partner): page group · Partner onboarding, profile, and content creation screens · `frontend/src/pages/food-partner`
- [Reel views](https://github.com/rumi-13/feasty/tree/main/frontend/src/pages/components): page group · Feed playback and saved reel views · `frontend/src/pages/components`

### External services

Infrastructure and third-party media delivery

- [Media store](https://github.com/rumi-13/feasty/blob/main/backend/src/services/storage.service.js): storage service · Integration boundary for uploading and serving video assets · `backend/src/services/storage.service.js`
- [MongoDB](https://github.com/rumi-13/feasty/blob/main/backend/src/db/db.js): database connection · Backend database connection and persistence layer · `backend/src/db/db.js`
- **ImageKit**: cdn/media · External media delivery, transformation, and thumbnail generation

## Connections

- Server → App setup: starts · Process entry initializes the Express application
- App setup → Routes: mounts · App registers the API route modules
- Routes → Auth API: includes · Authentication endpoints
- Routes → Food API: includes · Food reel and engagement endpoints
- Routes → Partner API: includes · Partner-specific endpoints
- Auth API → Auth logic: delegates · Auth requests are handled by controller logic
- Food API → Food logic: delegates · Food requests are handled by controller logic
- Partner API → Partner logic: delegates · Partner requests are handled by controller logic
- Auth API → Auth guard: protects · Protected auth-adjacent flows use access control
- Food API → Auth guard: protects · Engagement and user actions are guarded
- Partner API → Auth guard: protects · Partner actions require authorization
- Auth logic → User: reads/writes · Creates and authenticates users
- Partner logic → Food partner: reads/writes · Manages partner account data
- Food logic → Food reel: reads/writes · Fetches and updates reel records
- Food logic → Likes: tracks · Persists like state
- Food logic → Saves: tracks · Persists saved reel state
- Partner logic → Food reel: creates · Creates food reel metadata
- Food reel → MongoDB: persists · Mongoose models store data in MongoDB
- Food partner → MongoDB: persists · Mongoose models store data in MongoDB
- User → MongoDB: persists · Mongoose models store data in MongoDB
- Likes → MongoDB: persists · Mongoose models store data in MongoDB
- Saves → MongoDB: persists · Mongoose models store data in MongoDB
- Partner logic → Media store: uploads media · Partner workflows send assets to the storage boundary
- Media store → ImageKit: delivers · Media is hosted and transformed by ImageKit
- Main → App shell: boots · Main entry renders the application shell
- App shell → UI routes: uses · Shell delegates page selection to route config
- UI routes → Auth pages: shows · Authentication screens
- UI routes → Landing pages: shows · Landing and welcome screens
- UI routes → Partner pages: shows · Partner onboarding and creation screens
- UI routes → Reel views: shows · Reel playback and saved content screens
- Auth pages → API client: calls · Auth screens call the shared API client
- Partner pages → API client: calls · Partner screens call the shared API client
- Reel views → API client: calls · Reel views load and update content through the API client
- API client → App setup: requests · Frontend communicates with the Express API
- Food logic → ImageKit: references media · Food payloads include externally hosted media URLs
