# ayush35099-cloud/bharatstore architecture

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

- Interactive diagram: https://gitdiagram.com/ayush35099-cloud/bharatstore
- Repository: https://github.com/ayush35099-cloud/bharatstore

## Overview

BharatStore is a Flask omnichannel retail storefront. Shoppers discover and filter products, manage carts and wishlists, then check out; staff also manage products, inventory, and orders. The documented platform includes typo-tolerant search, regional fulfillment, payment verification, and order-event streaming. The graph separates browser behavior, web/API orchestration, domain services, and persistence. Some README capabilities are represented at subsystem level because their implementation was not sampled; edges are limited to relationships shown in excerpts or documented in the README.

Main entry points: [`app/routes.py`](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/routes.py) (Flask routes), [`app/database.py`](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/database.py) (Catalog and inventory), [`static/js/app.js`](https://github.com/ayush35099-cloud/bharatstore/blob/main/static/js/app.js) (Storefront UI), [`app/payment_service.py`](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/payment_service.py) (Payment verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_browser["Storefront UI<br/>[app.js]"]
  node_live_events["Live events UI<br/>[live-events.js]"]
  node_templates["Store pages"]
end

subgraph group_web["Web application"]
  node_routes["Flask routes<br/>[routes.py]"]
  node_app_factory["App setup<br/>[__init__.py]"]
end

subgraph group_domain["Commerce services"]
  node_catalog_seed["Catalog and hubs<br/>[seed_data.py]"]
  node_catalog_ops["Catalog and inventory<br/>[database.py]"]
  node_checkout["Checkout and orders<br/>[database.py]"]
  node_payments["Payment verification<br/>[payment_service.py]"]
  node_search["Product search"]
  node_events["Order event stream<br/>[kafka_service.py]"]
end

subgraph group_data["Data and events"]
  node_schema["Relational schema<br/>[schema.py]"]
  node_database[("Relational store")]
  node_kafka_broker["Kafka broker"]
  node_opensearch_store[("OpenSearch index")]
end

node_shopper(("Shopper"))
node_razorpay["Razorpay"]

node_shopper -->|"uses"| node_browser
node_browser -->|"calls REST API"| node_routes
node_routes -->|"renders pages"| node_templates
node_app_factory -->|"registers routes"| node_routes
node_browser -->|"fetches products"| node_routes
node_routes -->|"reads catalog"| node_catalog_ops
node_routes -->|"searches catalog"| node_search
node_routes -->|"processes checkout"| node_checkout
node_routes -->|"verifies payments"| node_payments
node_routes -->|"publishes orders"| node_events
node_catalog_ops -->|"loads sample data"| node_catalog_seed
node_catalog_ops -->|"runs migrations"| node_schema
node_catalog_ops -->|"reads and writes"| node_database
node_checkout -->|"commits orders"| node_database
node_search -.->|"queries index"| node_opensearch_store
node_events -.->|"streams events"| node_kafka_broker
node_payments -.->|"validates gateway signatures"| node_razorpay
node_live_events -.->|"streams event updates"| node_routes

click node_browser "https://github.com/ayush35099-cloud/bharatstore/blob/main/static/js/app.js"
click node_live_events "https://github.com/ayush35099-cloud/bharatstore/blob/main/static/js/live-events.js"
click node_templates "https://github.com/ayush35099-cloud/bharatstore/tree/main/templates"
click node_routes "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/routes.py"
click node_app_factory "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/__init__.py"
click node_catalog_seed "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/seed_data.py"
click node_catalog_ops "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/database.py"
click node_checkout "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/database.py"
click node_payments "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/payment_service.py"
click node_search "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/opensearch_service.py"
click node_events "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/kafka_service.py"
click node_schema "https://github.com/ayush35099-cloud/bharatstore/blob/main/app/schema.py"

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_browser,node_live_events,node_templates toneBlue
class node_routes,node_app_factory toneAmber
class node_catalog_seed,node_catalog_ops,node_checkout,node_payments,node_search,node_events toneMint
class node_schema,node_database,node_kafka_broker,node_opensearch_store toneRose
class node_shopper,node_razorpay toneIndigo
```

## Components

### Storefront

- [Storefront UI](https://github.com/ayush35099-cloud/bharatstore/blob/main/static/js/app.js): `static/js/app.js`
- [Live events UI](https://github.com/ayush35099-cloud/bharatstore/blob/main/static/js/live-events.js): `static/js/live-events.js`
- [Store pages](https://github.com/ayush35099-cloud/bharatstore/tree/main/templates): `templates`

### Web application

- [Flask routes](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/routes.py): `app/routes.py`
- [App setup](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/__init__.py): `app/__init__.py`

### Commerce services

- [Catalog and hubs](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/seed_data.py): `app/seed_data.py`
- [Catalog and inventory](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/database.py): `app/database.py`
- [Checkout and orders](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/database.py): `app/database.py`
- [Payment verification](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/payment_service.py): `app/payment_service.py`
- [Product search](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/opensearch_service.py): `app/opensearch_service.py`
- [Order event stream](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/kafka_service.py): `app/kafka_service.py`

### Data and events

- [Relational schema](https://github.com/ayush35099-cloud/bharatstore/blob/main/app/schema.py): `app/schema.py`
- **Relational store**
- **Kafka broker**
- **OpenSearch index**

### Other components

- **Shopper**
- **Razorpay**

## Connections

- Shopper → Storefront UI: uses (evidence: `README.md`)
- Storefront UI → Flask routes: calls REST API (evidence: `README.md`)
- Flask routes → Store pages: renders pages (evidence: `app/routes.py`)
- App setup → Flask routes: registers routes (evidence: `app/__init__.py`)
- Storefront UI → Flask routes: fetches products (evidence: `static/js/app.js`)
- Flask routes → Catalog and inventory: reads catalog (evidence: `app/routes.py`)
- Flask routes → Product search: searches catalog (evidence: `app/routes.py`)
- Flask routes → Checkout and orders: processes checkout (evidence: `app/routes.py`)
- Flask routes → Payment verification: verifies payments (evidence: `app/routes.py`)
- Flask routes → Order event stream: publishes orders (evidence: `app/routes.py`)
- Catalog and inventory → Catalog and hubs: loads sample data (evidence: `app/database.py`)
- Catalog and inventory → Relational schema: runs migrations (evidence: `app/database.py`)
- Catalog and inventory → Relational store: reads and writes (evidence: `app/database.py`)
- Checkout and orders → Relational store: commits orders (evidence: `app/database.py`)
- Product search → OpenSearch index: queries index
- Order event stream → Kafka broker: streams events
- Payment verification → Razorpay: validates gateway signatures
- Live events UI → Flask routes: streams event updates
