# deeksha0219/madlab1 architecture

> Architecture diagram of the GitHub repository deeksha0219/madlab1, 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/deeksha0219/madlab1
- Repository: https://github.com/deeksha0219/madlab1

## Overview

MADLAB1 is a campus food-ordering mobile app with a small Express backend. Its principal user flow is account setup and role selection, browsing canteen food by category, adding items to a cart, and proceeding through payment, confirmation, and order history. The app also exposes profile/account screens and separate admin/library menu screens. The backend provides OTP endpoints and in-memory cart and order routes. The excerpts show Firestore reads/writes from selected browsing screens, but do not establish how the other screens or backend APIs connect; those links are omitted.

Main entry points: [`src/navigation/AppNavigator.tsx`](https://github.com/deeksha0219/madlab1/blob/main/src/navigation/AppNavigator.tsx) (App navigation), [`src/styles/Studentstyles.ts`](https://github.com/deeksha0219/madlab1/blob/main/src/styles/Studentstyles.ts) (Screen styles), [`src/screens/CartScreen.tsx`](https://github.com/deeksha0219/madlab1/blob/main/src/screens/CartScreen.tsx) (Cart screen), [`src/screens/HomeScreen.tsx`](https://github.com/deeksha0219/madlab1/blob/main/src/screens/HomeScreen.tsx) (Food home)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Mobile app"]
  node_app_root["App entry<br/>[App.tsx]"]
  node_navigation["App navigation<br/>[AppNavigator.tsx]"]
  node_splash["Splash<br/>[SplashScreen.tsx]"]
  node_account["Account setup<br/>[AccountScreen.tsx]"]
  node_login["Role login<br/>[LoginScreen.tsx]"]
  node_profile["Profile<br/>[ProfilScreen.tsx]"]
end

subgraph group_browse["Food browsing"]
  node_home["Food home<br/>[HomeScreen.tsx]"]
  node_category["Food category<br/>[CategoryScreen.tsx]"]
  node_admin_block["Admin block menu"]
  node_admin_category["Admin category"]
  node_library_menu["Library menu"]
  node_library_category["Library category"]
end

subgraph group_checkout["Cart and orders"]
  node_cart_screen["Cart screen<br/>[CartScreen.tsx]"]
  node_payment["Payment<br/>[PaymentScreen.tsx]"]
  node_confirmed["Order confirmation"]
  node_history["Order history"]
end

subgraph group_backend["Backend services"]
  node_api_server["Express server<br/>[server.js]"]
  node_cart_routes["Cart routes<br/>[cartRoutes.js]"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
end

subgraph group_shared["Shared UI state"]
  node_cart_context["Cart context<br/>[CartContext.tsx]"]
  node_styles["Screen styles<br/>[Studentstyles.ts]"]
end

node_user(("Student"))
node_firebase[("Cloud Firestore")]

node_user -->|"uses"| node_app_root
node_app_root -->|"renders"| node_navigation
node_app_root -->|"wraps with"| node_cart_context
node_navigation -->|"routes to"| node_splash
node_navigation -->|"routes to"| node_account
node_navigation -->|"routes to"| node_login
node_navigation -->|"routes to"| node_profile
node_navigation -->|"routes to"| node_home
node_navigation -->|"routes to"| node_category
node_navigation -->|"routes to"| node_cart_screen
node_navigation -->|"routes to"| node_payment
node_navigation -->|"routes to"| node_confirmed
node_navigation -->|"routes to"| node_history
node_navigation -->|"routes to"| node_admin_block
node_navigation -->|"routes to"| node_admin_category
node_navigation -->|"routes to"| node_library_menu
node_navigation -->|"routes to"| node_library_category
node_home -->|"updates cart"| node_firebase
node_category -->|"reads menu; updates cart"| node_firebase
node_library_menu -->|"updates cart"| node_firebase
node_home -->|"opens cart"| node_cart_screen
node_category -->|"opens cart"| node_cart_screen
node_library_menu -->|"opens cart"| node_cart_screen
node_api_server -->|"mounts routes"| node_cart_routes
node_api_server -->|"mounts routes"| node_order_routes
node_account -->|"uses styles"| node_styles
node_login -->|"uses styles"| node_styles
node_home -->|"uses styles"| node_styles
node_category -->|"uses styles"| node_styles
node_admin_block -->|"uses styles"| node_styles
node_admin_category -->|"uses styles"| node_styles
node_library_menu -->|"uses styles"| node_styles
node_library_category -->|"uses styles"| node_styles
node_cart_screen -->|"uses styles"| node_styles
node_confirmed -->|"uses styles"| node_styles
node_history -->|"uses styles"| node_styles

click node_app_root "https://github.com/deeksha0219/madlab1/blob/main/App.tsx"
click node_navigation "https://github.com/deeksha0219/madlab1/blob/main/src/navigation/AppNavigator.tsx"
click node_splash "https://github.com/deeksha0219/madlab1/blob/main/src/screens/SplashScreen.tsx"
click node_account "https://github.com/deeksha0219/madlab1/blob/main/src/screens/AccountScreen.tsx"
click node_login "https://github.com/deeksha0219/madlab1/blob/main/src/screens/LoginScreen.tsx"
click node_profile "https://github.com/deeksha0219/madlab1/blob/main/src/screens/ProfilScreen.tsx"
click node_home "https://github.com/deeksha0219/madlab1/blob/main/src/screens/HomeScreen.tsx"
click node_category "https://github.com/deeksha0219/madlab1/blob/main/src/screens/CategoryScreen.tsx"
click node_admin_block "https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMAdminBlockScreen.tsx"
click node_admin_category "https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMAdminCategoryScreen.tsx"
click node_library_menu "https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMLibraryScreen.tsx"
click node_library_category "https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMLibraryCategoryScreen.tsx"
click node_cart_screen "https://github.com/deeksha0219/madlab1/blob/main/src/screens/CartScreen.tsx"
click node_payment "https://github.com/deeksha0219/madlab1/blob/main/src/screens/PaymentScreen.tsx"
click node_confirmed "https://github.com/deeksha0219/madlab1/blob/main/src/screens/OrderConfirmedScreen.tsx"
click node_history "https://github.com/deeksha0219/madlab1/blob/main/src/screens/OrderHistoryScreen.tsx"
click node_cart_context "https://github.com/deeksha0219/madlab1/blob/main/src/screens/CartContext.tsx"
click node_styles "https://github.com/deeksha0219/madlab1/blob/main/src/styles/Studentstyles.ts"
click node_api_server "https://github.com/deeksha0219/madlab1/blob/main/backend/server.js"
click node_cart_routes "https://github.com/deeksha0219/madlab1/blob/main/backend/routes/cartRoutes.js"
click node_order_routes "https://github.com/deeksha0219/madlab1/blob/main/backend/routes/orderRoutes.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_app_root,node_navigation,node_splash,node_account,node_login,node_profile toneBlue
class node_home,node_category,node_admin_block,node_admin_category,node_library_menu,node_library_category,node_firebase toneAmber
class node_cart_screen,node_payment,node_confirmed,node_history toneMint
class node_api_server,node_cart_routes,node_order_routes toneRose
class node_cart_context,node_styles,node_user toneIndigo
```

## Components

### Mobile app

- [App entry](https://github.com/deeksha0219/madlab1/blob/main/App.tsx): `App.tsx`
- [App navigation](https://github.com/deeksha0219/madlab1/blob/main/src/navigation/AppNavigator.tsx): `src/navigation/AppNavigator.tsx`
- [Splash](https://github.com/deeksha0219/madlab1/blob/main/src/screens/SplashScreen.tsx): `src/screens/SplashScreen.tsx`
- [Account setup](https://github.com/deeksha0219/madlab1/blob/main/src/screens/AccountScreen.tsx): `src/screens/AccountScreen.tsx`
- [Role login](https://github.com/deeksha0219/madlab1/blob/main/src/screens/LoginScreen.tsx): `src/screens/LoginScreen.tsx`
- [Profile](https://github.com/deeksha0219/madlab1/blob/main/src/screens/ProfilScreen.tsx): `src/screens/ProfilScreen.tsx`

### Food browsing

- [Food home](https://github.com/deeksha0219/madlab1/blob/main/src/screens/HomeScreen.tsx): `src/screens/HomeScreen.tsx`
- [Food category](https://github.com/deeksha0219/madlab1/blob/main/src/screens/CategoryScreen.tsx): `src/screens/CategoryScreen.tsx`
- [Admin block menu](https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMAdminBlockScreen.tsx): `src/screens/MMAdminBlockScreen.tsx`
- [Admin category](https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMAdminCategoryScreen.tsx): `src/screens/MMAdminCategoryScreen.tsx`
- [Library menu](https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMLibraryScreen.tsx): `src/screens/MMLibraryScreen.tsx`
- [Library category](https://github.com/deeksha0219/madlab1/blob/main/src/screens/MMLibraryCategoryScreen.tsx): `src/screens/MMLibraryCategoryScreen.tsx`

### Cart and orders

- [Cart screen](https://github.com/deeksha0219/madlab1/blob/main/src/screens/CartScreen.tsx): `src/screens/CartScreen.tsx`
- [Payment](https://github.com/deeksha0219/madlab1/blob/main/src/screens/PaymentScreen.tsx): `src/screens/PaymentScreen.tsx`
- [Order confirmation](https://github.com/deeksha0219/madlab1/blob/main/src/screens/OrderConfirmedScreen.tsx): `src/screens/OrderConfirmedScreen.tsx`
- [Order history](https://github.com/deeksha0219/madlab1/blob/main/src/screens/OrderHistoryScreen.tsx): `src/screens/OrderHistoryScreen.tsx`

### Backend services

- [Express server](https://github.com/deeksha0219/madlab1/blob/main/backend/server.js): `backend/server.js`
- [Cart routes](https://github.com/deeksha0219/madlab1/blob/main/backend/routes/cartRoutes.js): `backend/routes/cartRoutes.js`
- [Order routes](https://github.com/deeksha0219/madlab1/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`

### Shared UI state

- [Cart context](https://github.com/deeksha0219/madlab1/blob/main/src/screens/CartContext.tsx): `src/screens/CartContext.tsx`
- [Screen styles](https://github.com/deeksha0219/madlab1/blob/main/src/styles/Studentstyles.ts): `src/styles/Studentstyles.ts`

### Other components

- **Student**
- **Cloud Firestore**

## Connections

- Student → App entry: uses
- App entry → App navigation: renders (evidence: `App.tsx`)
- App entry → Cart context: wraps with (evidence: `App.tsx`)
- App navigation → Splash: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Account setup: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Role login: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Profile: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Food home: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Food category: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Cart screen: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Payment: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Order confirmation: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Order history: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Admin block menu: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Admin category: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Library menu: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- App navigation → Library category: routes to (evidence: `src/navigation/AppNavigator.tsx`)
- Food home → Cloud Firestore: updates cart (evidence: `src/screens/HomeScreen.tsx`)
- Food category → Cloud Firestore: reads menu; updates cart (evidence: `src/screens/CategoryScreen.tsx`)
- Library menu → Cloud Firestore: updates cart (evidence: `src/screens/MMLibraryScreen.tsx`)
- Food home → Cart screen: opens cart (evidence: `src/screens/HomeScreen.tsx`)
- Food category → Cart screen: opens cart (evidence: `src/screens/CategoryScreen.tsx`)
- Library menu → Cart screen: opens cart (evidence: `src/screens/MMLibraryScreen.tsx`)
- Express server → Cart routes: mounts routes (evidence: `backend/server.js`)
- Express server → Order routes: mounts routes (evidence: `backend/server.js`)
- Account setup → Screen styles: uses styles (evidence: `src/screens/AccountScreen.tsx`)
- Role login → Screen styles: uses styles (evidence: `src/screens/LoginScreen.tsx`)
- Food home → Screen styles: uses styles (evidence: `src/screens/HomeScreen.tsx`)
- Food category → Screen styles: uses styles (evidence: `src/screens/CategoryScreen.tsx`)
- Admin block menu → Screen styles: uses styles (evidence: `src/screens/MMAdminBlockScreen.tsx`)
- Admin category → Screen styles: uses styles (evidence: `src/screens/MMAdminCategoryScreen.tsx`)
- Library menu → Screen styles: uses styles (evidence: `src/screens/MMLibraryScreen.tsx`)
- Library category → Screen styles: uses styles (evidence: `src/screens/MMLibraryCategoryScreen.tsx`)
- Cart screen → Screen styles: uses styles (evidence: `src/screens/CartScreen.tsx`)
- Order confirmation → Screen styles: uses styles (evidence: `src/screens/OrderConfirmedScreen.tsx`)
- Order history → Screen styles: uses styles (evidence: `src/screens/OrderHistoryScreen.tsx`)
