# balachandru-ai/demo architecture

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

- Interactive diagram: https://gitdiagram.com/balachandru-ai/demo
- Repository: https://github.com/balachandru-ai/demo

## Overview

This is a small full-stack CRUD application for managing users and products. The browser loads and displays both collections and submits create/delete actions to an Express API; the API uses Mongoose models backed by MongoDB. The backend also exposes a health endpoint, which the browser checks to show connection status. The excerpts show user update and product update API routes, though the sampled browser code does not expose those actions. Deployment configuration is omitted from this runtime view.

Main entry points: [`backend/routes/api.js`](https://github.com/balachandru-ai/demo/blob/main/backend/routes/api.js) (User/product routes), [`frontend/app.js`](https://github.com/balachandru-ai/demo/blob/main/frontend/app.js) (CRUD interface), [`backend/server.js`](https://github.com/balachandru-ai/demo/blob/main/backend/server.js) (HTTP server), [`backend/models/user.js`](https://github.com/balachandru-ai/demo/blob/main/backend/models/user.js) (User model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_webapp["CRUD interface<br/>[app.js]"]
end

subgraph group_backend["Backend API"]
  node_server["HTTP server<br/>[server.js]"]
  node_api["User/product routes<br/>[api.js]"]
end

subgraph group_persistence["Data persistence"]
  node_users["User model<br/>[user.js]"]
  node_products["Product model<br/>[product.js]"]
  node_mongodb[("MongoDB")]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_webapp
node_webapp -->|"requests CRUD"| node_api
node_webapp -->|"checks health"| node_server
node_server -->|"mounts routes"| node_api
node_server -->|"connects"| node_mongodb
node_api -->|"queries and saves"| node_users
node_api -->|"queries and saves"| node_products
node_api -->|"reads and writes"| node_mongodb

click node_webapp "https://github.com/balachandru-ai/demo/blob/main/frontend/app.js"
click node_server "https://github.com/balachandru-ai/demo/blob/main/backend/server.js"
click node_api "https://github.com/balachandru-ai/demo/blob/main/backend/routes/api.js"
click node_users "https://github.com/balachandru-ai/demo/blob/main/backend/models/user.js"
click node_products "https://github.com/balachandru-ai/demo/blob/main/backend/models/product.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_webapp toneBlue
class node_server,node_api toneAmber
class node_users,node_products,node_mongodb toneMint
class node_visitor toneIndigo
```

## Components

### Browser client

- [CRUD interface](https://github.com/balachandru-ai/demo/blob/main/frontend/app.js): `frontend/app.js`

### Backend API

- [HTTP server](https://github.com/balachandru-ai/demo/blob/main/backend/server.js): `backend/server.js`
- [User/product routes](https://github.com/balachandru-ai/demo/blob/main/backend/routes/api.js): `backend/routes/api.js`

### Data persistence

- [User model](https://github.com/balachandru-ai/demo/blob/main/backend/models/user.js): `backend/models/user.js`
- [Product model](https://github.com/balachandru-ai/demo/blob/main/backend/models/product.js): `backend/models/product.js`
- **MongoDB**

### Other components

- **Visitor**

## Connections

- Visitor → CRUD interface: uses (evidence: `frontend/app.js`)
- CRUD interface → User/product routes: requests CRUD (evidence: `frontend/app.js`)
- CRUD interface → HTTP server: checks health (evidence: `frontend/app.js`)
- HTTP server → User/product routes: mounts routes (evidence: `backend/server.js`)
- HTTP server → MongoDB: connects (evidence: `backend/server.js`)
- User/product routes → User model: queries and saves (evidence: `backend/routes/api.js`)
- User/product routes → Product model: queries and saves (evidence: `backend/routes/api.js`)
- User/product routes → MongoDB: reads and writes (evidence: `backend/routes/api.js`)
