# sh1va-sync/nalli-bokka architecture

> Architecture diagram of the GitHub repository sh1va-sync/nalli-bokka, 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/sh1va-sync/nalli-bokka
- Repository: https://github.com/sh1va-sync/nalli-bokka

## Overview

This is a storefront and store-operations application: customers browse products, maintain a cart, pay, and track orders, while store staff manage inventory and fulfill or refund orders. The frontend exposes customer and store workspaces; its API layer connects those workflows to an Express backend. Backend stages include request routing and authentication, product and store management, payment/order processing, and persistence. The README is empty, so feature coverage comes from the source index and excerpts; some subsystem wiring is not sampled and is shown as unverified where appropriate.

Main entry points: [`backend/src/controllers/paymentController.js`](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/paymentController.js) (Payment processing), [`backend/src/controllers/orderController.js`](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/orderController.js) (Order fulfillment), [`backend/src/routes/storeRoutes.js`](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/routes/storeRoutes.js) (Store routes), [`backend/src/controllers/storeController.js`](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/storeController.js) (Store management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend workflows"]
  node_app_ui["App routing<br/>[App.jsx]"]
  node_checkout_ui["Customer checkout<br/>[CheckoutPage.jsx]"]
  node_store_dashboard["Store dashboard"]
  node_client_api["API client<br/>[api.js]"]
  node_client_state["Client state<br/>[store.js]"]
  node_session_state["Session state<br/>[authSlice.js]"]
  node_store_session["Store session<br/>[storeAuthSlice.js]"]
end

subgraph group_api["API and access"]
  node_server_app["HTTP application<br/>[app.js]"]
  node_route_index["API routes<br/>[index.js]"]
  node_store_routes["Store routes<br/>[storeRoutes.js]"]
  node_auth_middleware["Authentication<br/>[authenticate.js]"]
  node_validation["Request validation<br/>[validate.js]"]
end

subgraph group_catalog["Store and catalog"]
  node_store_controller["Store management<br/>[storeController.js]"]
  node_product_model[("Products<br/>[Product.js]")]
  node_store_model[("Stores<br/>[Store.js]")]
end

subgraph group_commerce["Checkout and fulfillment"]
  node_payment_controller["Payment processing"]
  node_order_controller["Order fulfillment<br/>[orderController.js]"]
  node_pricing["Pricing rules<br/>[pricing.js]"]
end

subgraph group_data["Persistence and integrations"]
  node_order_model[("Orders<br/>[Order.js]")]
  node_transaction_model[("Transactions<br/>[Transaction.js]")]
  node_audit_service["Audit logging<br/>[audit.js]"]
  node_razorpay["Razorpay"]
  node_database[("MongoDB<br/>[database.js]")]
end

node_customer(("Customer"))
node_store_staff(("Store staff"))

node_customer -->|"browses"| node_app_ui
node_store_staff -->|"opens workspace"| node_app_ui
node_app_ui -->|"routes to"| node_checkout_ui
node_app_ui -->|"routes to"| node_store_dashboard
node_checkout_ui -->|"requests checkout"| node_client_api
node_store_dashboard -->|"requests operations"| node_client_api
node_client_api -.->|"calls API"| node_server_app
node_server_app -->|"mounts routes"| node_route_index
node_route_index -.->|"registers store routes"| node_store_routes
node_store_routes -->|"guards requests"| node_auth_middleware
node_store_routes -->|"validates inputs"| node_validation
node_store_routes -->|"dispatches operations"| node_store_controller
node_store_controller -->|"reads and writes"| node_product_model
node_store_controller -->|"reads and writes"| node_store_model
node_checkout_ui -.->|"uses app state"| node_client_state
node_client_state -->|"combines reducers"| node_session_state
node_client_state -->|"combines reducers"| node_store_session
node_payment_controller -->|"prices selections"| node_pricing
node_payment_controller -.->|"creates payment"| node_razorpay
node_payment_controller -->|"creates or updates"| node_order_model
node_payment_controller -->|"records payment"| node_transaction_model
node_order_controller -->|"updates fulfillment"| node_order_model
node_order_controller -->|"checks refunds"| node_transaction_model
node_order_controller -->|"records changes"| node_audit_service
node_store_controller -->|"records store actions"| node_audit_service
node_audit_service -->|"persists events"| node_database
node_order_controller -.->|"refunds payments"| node_razorpay

click node_app_ui "https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/App.jsx"
click node_checkout_ui "https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/customer/pages/CheckoutPage.jsx"
click node_store_dashboard "https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/storeAdmin/pages/StoreDashboardPage.jsx"
click node_client_api "https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/api/api.js"
click node_client_state "https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/app/store.js"
click node_session_state "https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/auth/authSlice.js"
click node_store_session "https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/storeAdmin/storeAuthSlice.js"
click node_server_app "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/app.js"
click node_route_index "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/routes/index.js"
click node_store_routes "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/routes/storeRoutes.js"
click node_auth_middleware "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/middleware/authenticate.js"
click node_validation "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/middleware/validate.js"
click node_store_controller "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/storeController.js"
click node_product_model "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Product.js"
click node_store_model "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Store.js"
click node_payment_controller "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/paymentController.js"
click node_order_controller "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/orderController.js"
click node_pricing "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/utils/pricing.js"
click node_order_model "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Order.js"
click node_transaction_model "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Transaction.js"
click node_audit_service "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/services/audit.js"
click node_database "https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/config/database.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_ui,node_checkout_ui,node_store_dashboard,node_client_api,node_client_state,node_session_state,node_store_session toneBlue
class node_server_app,node_route_index,node_store_routes,node_auth_middleware,node_validation toneAmber
class node_store_controller,node_product_model,node_store_model toneMint
class node_payment_controller,node_order_controller,node_pricing toneRose
class node_order_model,node_transaction_model,node_audit_service,node_razorpay,node_database,node_customer,node_store_staff toneIndigo
```

## Components

### Frontend workflows

- [App routing](https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Customer checkout](https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/customer/pages/CheckoutPage.jsx): `frontend/src/features/customer/pages/CheckoutPage.jsx`
- [Store dashboard](https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/storeAdmin/pages/StoreDashboardPage.jsx): `frontend/src/features/storeAdmin/pages/StoreDashboardPage.jsx`
- [API client](https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/api/api.js): `frontend/src/features/api/api.js`
- [Client state](https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/app/store.js): `frontend/src/app/store.js`
- [Session state](https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/auth/authSlice.js): `frontend/src/features/auth/authSlice.js`
- [Store session](https://github.com/sh1va-sync/nalli-bokka/blob/main/frontend/src/features/storeAdmin/storeAuthSlice.js): `frontend/src/features/storeAdmin/storeAuthSlice.js`

### API and access

- [HTTP application](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/app.js): `backend/src/app.js`
- [API routes](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/routes/index.js): `backend/src/routes/index.js`
- [Store routes](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/routes/storeRoutes.js): `backend/src/routes/storeRoutes.js`
- [Authentication](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/middleware/authenticate.js): `backend/src/middleware/authenticate.js`
- [Request validation](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/middleware/validate.js): `backend/src/middleware/validate.js`

### Store and catalog

- [Store management](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/storeController.js): `backend/src/controllers/storeController.js`
- [Products](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Product.js): `backend/src/models/Product.js`
- [Stores](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Store.js): `backend/src/models/Store.js`

### Checkout and fulfillment

- [Payment processing](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/paymentController.js): `backend/src/controllers/paymentController.js`
- [Order fulfillment](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/controllers/orderController.js): `backend/src/controllers/orderController.js`
- [Pricing rules](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/utils/pricing.js): `backend/src/utils/pricing.js`

### Persistence and integrations

- [Orders](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Order.js): `backend/src/models/Order.js`
- [Transactions](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/models/Transaction.js): `backend/src/models/Transaction.js`
- [Audit logging](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/services/audit.js): `backend/src/services/audit.js`
- **Razorpay**
- [MongoDB](https://github.com/sh1va-sync/nalli-bokka/blob/main/backend/src/config/database.js): `backend/src/config/database.js`

### Other components

- **Customer**
- **Store staff**

## Connections

- Customer → App routing: browses (evidence: `frontend/src/App.jsx`)
- Store staff → App routing: opens workspace (evidence: `frontend/src/App.jsx`)
- App routing → Customer checkout: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Store dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Customer checkout → API client: requests checkout (evidence: `frontend/src/features/customer/pages/CheckoutPage.jsx`)
- Store dashboard → API client: requests operations (evidence: `frontend/src/features/storeAdmin/pages/StoreDashboardPage.jsx`)
- API client → HTTP application: calls API
- HTTP application → API routes: mounts routes (evidence: `backend/src/app.js`)
- API routes → Store routes: registers store routes
- Store routes → Authentication: guards requests (evidence: `backend/src/routes/storeRoutes.js`)
- Store routes → Request validation: validates inputs (evidence: `backend/src/routes/storeRoutes.js`)
- Store routes → Store management: dispatches operations (evidence: `backend/src/routes/storeRoutes.js`)
- Store management → Products: reads and writes (evidence: `backend/src/controllers/storeController.js`)
- Store management → Stores: reads and writes (evidence: `backend/src/controllers/storeController.js`)
- Customer checkout → Client state: uses app state
- Client state → Session state: combines reducers (evidence: `frontend/src/app/store.js`)
- Client state → Store session: combines reducers (evidence: `frontend/src/app/store.js`)
- Payment processing → Pricing rules: prices selections (evidence: `backend/src/controllers/paymentController.js`)
- Payment processing → Razorpay: creates payment
- Payment processing → Orders: creates or updates (evidence: `backend/src/controllers/paymentController.js`)
- Payment processing → Transactions: records payment (evidence: `backend/src/controllers/paymentController.js`)
- Order fulfillment → Orders: updates fulfillment (evidence: `backend/src/controllers/orderController.js`)
- Order fulfillment → Transactions: checks refunds (evidence: `backend/src/controllers/orderController.js`)
- Order fulfillment → Audit logging: records changes (evidence: `backend/src/controllers/orderController.js`)
- Store management → Audit logging: records store actions (evidence: `backend/src/controllers/storeController.js`)
- Audit logging → MongoDB: persists events (evidence: `backend/src/services/audit.js`)
- Order fulfillment → Razorpay: refunds payments
