# dgowthamreddy1432/ayu architecture

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

- Interactive diagram: https://gitdiagram.com/dgowthamreddy1432/ayu
- Repository: https://github.com/dgowthamreddy1432/ayu

## Overview

AYU is a meal-browsing and ordering web app with a browser client and an Express/MongoDB backend. Users enter through the splash page, browse meals, save favorites or build a local cart, then proceed through checkout and payment; accounts and meal data have backend routes. The excerpts confirm meal browsing, cart reads, authentication routes, and server wiring. Checkout, payment, favorites, and order-history behavior is represented from the file tree and SOURCE INDEX, so their connections are marked unverified where needed.

Main entry points: [`client/js/home.js`](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/home.js) (Meal catalog), [`server/server.js`](https://github.com/dgowthamreddy1432/ayu/blob/main/server/server.js) (API server), [`server/routes/user.js`](https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/user.js) (Profile route), [`server/routes/meals.js`](https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/meals.js) (Meal API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_entry["App entry<br/>[app.js]"]
  node_splash["Splash screen<br/>[splash.js]"]
end

subgraph group_discovery["Meal discovery"]
  node_home["Meal catalog<br/>[home.js]"]
  node_meal_detail["Meal details<br/>[meal-details.js]"]
  node_favorites["Favorites<br/>[favorites.js]"]
end

subgraph group_ordering["Ordering"]
  node_cart["Cart<br/>[cart.js]"]
  node_checkout["Checkout<br/>[checkout.js]"]
  node_payment["Payment<br/>[payment.js]"]
  node_order_success["Order confirmation<br/>[order-success.js]"]
  node_orders["Order history<br/>[orders.js]"]
end

subgraph group_identity["Accounts"]
  node_login["Login<br/>[login.js]"]
  node_register["Registration<br/>[register.js]"]
  node_profile["User profile<br/>[profile.js]"]
end

subgraph group_backend["Backend and data"]
  node_meal_api["Meal API<br/>[meals.js]"]
  node_meal_model[("Meal records<br/>[Meal.js]")]
  node_auth_api["Auth routes<br/>[auth.js]"]
  node_user_api["Profile route<br/>[user.js]"]
  node_auth_middleware["JWT validation<br/>[auth.js]"]
  node_user_model[("User records<br/>[User.js]")]
  node_api_server["API server<br/>[server.js]"]
  node_db_connect["Mongo connection<br/>[db.js]"]
end

node_shopper(("Shopper"))

node_shopper -->|"opens app"| node_entry
node_entry -->|"redirects to"| node_splash
node_shopper -.->|"browses meals"| node_home
node_home -->|"fetches meals"| node_meal_api
node_api_server -->|"mounts route"| node_meal_api
node_meal_api -->|"queries meals"| node_meal_model
node_home -->|"opens details"| node_meal_detail
node_home -->|"adds items"| node_cart
node_home -->|"saves favorites"| node_favorites
node_cart -->|"loads meal data"| node_meal_api
node_shopper -.->|"starts checkout"| node_checkout
node_checkout -.->|"continues to"| node_payment
node_payment -.->|"confirms purchase"| node_order_success
node_shopper -.->|"views orders"| node_orders
node_shopper -.->|"signs in"| node_login
node_shopper -.->|"creates account"| node_register
node_login -.->|"authenticates"| node_auth_api
node_register -.->|"registers account"| node_auth_api
node_api_server -->|"mounts route"| node_auth_api
node_auth_api -->|"reads and writes"| node_user_model
node_shopper -.->|"views profile"| node_profile
node_profile -.->|"requests profile"| node_user_api
node_api_server -->|"mounts route"| node_user_api
node_user_api -->|"checks token"| node_auth_middleware
node_user_api -->|"loads profile"| node_user_model
node_api_server -->|"connects database"| node_db_connect

click node_entry "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/app.js"
click node_splash "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/splash.js"
click node_home "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/home.js"
click node_meal_detail "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/meal-details.js"
click node_favorites "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/favorites.js"
click node_meal_api "https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/meals.js"
click node_meal_model "https://github.com/dgowthamreddy1432/ayu/blob/main/server/models/Meal.js"
click node_cart "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/cart.js"
click node_checkout "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/checkout.js"
click node_payment "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/payment.js"
click node_order_success "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/order-success.js"
click node_orders "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/orders.js"
click node_login "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/login.js"
click node_register "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/register.js"
click node_profile "https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/profile.js"
click node_auth_api "https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/auth.js"
click node_user_api "https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/user.js"
click node_auth_middleware "https://github.com/dgowthamreddy1432/ayu/blob/main/server/middleware/auth.js"
click node_user_model "https://github.com/dgowthamreddy1432/ayu/blob/main/server/models/User.js"
click node_api_server "https://github.com/dgowthamreddy1432/ayu/blob/main/server/server.js"
click node_db_connect "https://github.com/dgowthamreddy1432/ayu/blob/main/server/config/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_entry,node_splash toneBlue
class node_home,node_meal_detail,node_favorites toneAmber
class node_cart,node_checkout,node_payment,node_order_success,node_orders toneMint
class node_login,node_register,node_profile toneRose
class node_meal_api,node_meal_model,node_auth_api,node_user_api,node_auth_middleware,node_user_model,node_api_server,node_db_connect,node_shopper toneIndigo
```

## Components

### Browser experience

- [App entry](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/app.js): `client/js/app.js`
- [Splash screen](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/splash.js): `client/js/splash.js`

### Meal discovery

- [Meal catalog](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/home.js): `client/js/home.js`
- [Meal details](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/meal-details.js): `client/js/meal-details.js`
- [Favorites](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/favorites.js): `client/js/favorites.js`

### Ordering

- [Cart](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/cart.js): `client/js/cart.js`
- [Checkout](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/checkout.js): `client/js/checkout.js`
- [Payment](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/payment.js): `client/js/payment.js`
- [Order confirmation](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/order-success.js): `client/js/order-success.js`
- [Order history](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/orders.js): `client/js/orders.js`

### Accounts

- [Login](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/login.js): `client/js/login.js`
- [Registration](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/register.js): `client/js/register.js`
- [User profile](https://github.com/dgowthamreddy1432/ayu/blob/main/client/js/profile.js): `client/js/profile.js`

### Backend and data

- [Meal API](https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/meals.js): `server/routes/meals.js`
- [Meal records](https://github.com/dgowthamreddy1432/ayu/blob/main/server/models/Meal.js): `server/models/Meal.js`
- [Auth routes](https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Profile route](https://github.com/dgowthamreddy1432/ayu/blob/main/server/routes/user.js): `server/routes/user.js`
- [JWT validation](https://github.com/dgowthamreddy1432/ayu/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [User records](https://github.com/dgowthamreddy1432/ayu/blob/main/server/models/User.js): `server/models/User.js`
- [API server](https://github.com/dgowthamreddy1432/ayu/blob/main/server/server.js): `server/server.js`
- [Mongo connection](https://github.com/dgowthamreddy1432/ayu/blob/main/server/config/db.js): `server/config/db.js`

### Other components

- **Shopper**

## Connections

- Shopper → App entry: opens app
- App entry → Splash screen: redirects to (evidence: `client/js/app.js`)
- Shopper → Meal catalog: browses meals
- Meal catalog → Meal API: fetches meals (evidence: `client/js/home.js`)
- API server → Meal API: mounts route (evidence: `server/server.js`)
- Meal API → Meal records: queries meals (evidence: `server/routes/meals.js`)
- Meal catalog → Meal details: opens details (evidence: `client/js/home.js`)
- Meal catalog → Cart: adds items (evidence: `client/js/home.js`)
- Meal catalog → Favorites: saves favorites (evidence: `client/js/home.js`)
- Cart → Meal API: loads meal data (evidence: `client/js/cart.js`)
- Shopper → Checkout: starts checkout
- Checkout → Payment: continues to
- Payment → Order confirmation: confirms purchase
- Shopper → Order history: views orders
- Shopper → Login: signs in
- Shopper → Registration: creates account
- Login → Auth routes: authenticates
- Registration → Auth routes: registers account
- API server → Auth routes: mounts route (evidence: `server/server.js`)
- Auth routes → User records: reads and writes (evidence: `server/routes/auth.js`)
- Shopper → User profile: views profile
- User profile → Profile route: requests profile
- API server → Profile route: mounts route (evidence: `server/server.js`)
- Profile route → JWT validation: checks token (evidence: `server/routes/user.js`)
- Profile route → User records: loads profile (evidence: `server/routes/user.js`)
- API server → Mongo connection: connects database (evidence: `server/server.js`)
