# kirantm36/sajilo_byapar architecture

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

- Interactive diagram: https://gitdiagram.com/kirantm36/sajilo_byapar
- Repository: https://github.com/kirantm36/sajilo_byapar

## Overview

Sajilo Byapar is a shop-management application with a React frontend and Express/MySQL backend. The main user workflow spans customer and product records, inventory, sales, and credit tracking. The sampled source confirms dashboard inventory loading, user authentication requests, server route mounting, and several database operations. Other frontend pages and domain slices indicate additional capabilities, but their request wiring was not sampled, so those connections are left out.

Main entry points: [`frontend/src/App.tsx`](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/App.tsx) (Route shell), [`sqlServer/app.js`](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/app.js) (Express server), [`sqlServer/db.js`](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/db.js) (MySQL database), [`frontend/src/pages/Dashboard.tsx`](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Dashboard.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Shop interface"]
  node_main["Frontend entry<br/>[main.tsx]"]
  node_app["Route shell<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_sales_ui["Sales screen<br/>[Sales.tsx]"]
  node_products_ui["Products screen<br/>[Products.tsx]"]
  node_customers_ui["Customer screens<br/>[Customer.tsx]"]
  node_credit_ui["Credit screen<br/>[Credit.tsx]"]
  node_inventory_ui["Inventory screen<br/>[Inventory.tsx]"]
  node_auth_ui["Customer auth<br/>[CustomerLogin.tsx]"]
  node_inventory_state["Inventory state<br/>[inventorySlice.ts]"]
  node_user_state["User state<br/>[userSlice.ts]"]
end

subgraph group_backend["API server"]
  node_server["Express server<br/>[app.js]"]
  node_user_routes["User routes<br/>[user.route.js]"]
  node_category_routes["Category routes<br/>[category.route.js]"]
  node_product_routes["Product routes<br/>[product.route.js]"]
  node_sales_routes["Sales routes<br/>[sales.route.js]"]
  node_inventory_routes["Inventory routes<br/>[invetory.route.js]"]
end

subgraph group_domain["Shop operations"]
  node_user_ops["User operations<br/>[userController.js]"]
  node_category_ops["Category operations"]
  node_product_ops["Product operations"]
  node_sales_ops["Sales and credit<br/>[salesController.js]"]
  node_inventory_ops["Inventory operations"]
end

subgraph group_data["Persistence"]
  node_database[("MySQL database<br/>[db.js]")]
end

node_staff(("Shop staff"))

node_staff -->|"uses"| node_app
node_main -->|"renders"| node_app
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_sales_ui
node_app -->|"routes"| node_products_ui
node_app -->|"routes"| node_customers_ui
node_app -->|"routes"| node_credit_ui
node_app -->|"routes"| node_inventory_ui
node_app -->|"routes"| node_auth_ui
node_dashboard -->|"dispatches"| node_inventory_state
node_user_state -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_category_routes
node_server -->|"mounts"| node_product_routes
node_server -->|"mounts"| node_sales_routes
node_server -->|"mounts"| node_inventory_routes
node_user_ops -->|"queries"| node_database
node_category_ops -->|"queries"| node_database
node_product_ops -->|"queries"| node_database
node_sales_ops -->|"queries"| node_database
node_inventory_ops -->|"queries"| node_database

click node_main "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/main.tsx"
click node_app "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Dashboard.tsx"
click node_sales_ui "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Sales.tsx"
click node_products_ui "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Products.tsx"
click node_customers_ui "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Customer.tsx"
click node_credit_ui "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Credit.tsx"
click node_inventory_ui "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Inventory.tsx"
click node_auth_ui "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/auth/CustomerLogin.tsx"
click node_inventory_state "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/store/inventorySlice.ts"
click node_user_state "https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/store/userSlice.ts"
click node_server "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/app.js"
click node_user_routes "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/user.route.js"
click node_category_routes "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/category.route.js"
click node_product_routes "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/product.route.js"
click node_sales_routes "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/sales.route.js"
click node_inventory_routes "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/invetory.route.js"
click node_user_ops "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/userController.js"
click node_category_ops "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/categoryController.js"
click node_product_ops "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/productController.js"
click node_sales_ops "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/salesController.js"
click node_inventory_ops "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/inventoryController.js"
click node_database "https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/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_main,node_app,node_dashboard,node_sales_ui,node_products_ui,node_customers_ui,node_credit_ui,node_inventory_ui,node_auth_ui,node_inventory_state,node_user_state toneBlue
class node_server,node_user_routes,node_category_routes,node_product_routes,node_sales_routes,node_inventory_routes toneAmber
class node_user_ops,node_category_ops,node_product_ops,node_sales_ops,node_inventory_ops toneMint
class node_database toneRose
class node_staff toneIndigo
```

## Components

### Shop interface

- [Frontend entry](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Route shell](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Sales screen](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Sales.tsx): `frontend/src/pages/Sales.tsx`
- [Products screen](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Products.tsx): `frontend/src/pages/Products.tsx`
- [Customer screens](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Customer.tsx): `frontend/src/pages/Customer.tsx`
- [Credit screen](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Credit.tsx): `frontend/src/pages/Credit.tsx`
- [Inventory screen](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/pages/Inventory.tsx): `frontend/src/pages/Inventory.tsx`
- [Customer auth](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/auth/CustomerLogin.tsx): `frontend/src/auth/CustomerLogin.tsx`
- [Inventory state](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/store/inventorySlice.ts): `frontend/src/store/inventorySlice.ts`
- [User state](https://github.com/kirantm36/sajilo_byapar/blob/main/frontend/src/store/userSlice.ts): `frontend/src/store/userSlice.ts`

### API server

- [Express server](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/app.js): `sqlServer/app.js`
- [User routes](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/user.route.js): `sqlServer/router/user.route.js`
- [Category routes](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/category.route.js): `sqlServer/router/category.route.js`
- [Product routes](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/product.route.js): `sqlServer/router/product.route.js`
- [Sales routes](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/sales.route.js): `sqlServer/router/sales.route.js`
- [Inventory routes](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/router/invetory.route.js): `sqlServer/router/invetory.route.js`

### Shop operations

- [User operations](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/userController.js): `sqlServer/controller/userController.js`
- [Category operations](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/categoryController.js): `sqlServer/controller/categoryController.js`
- [Product operations](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/productController.js): `sqlServer/controller/productController.js`
- [Sales and credit](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/salesController.js): `sqlServer/controller/salesController.js`
- [Inventory operations](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/controller/inventoryController.js): `sqlServer/controller/inventoryController.js`

### Persistence

- [MySQL database](https://github.com/kirantm36/sajilo_byapar/blob/main/sqlServer/db.js): `sqlServer/db.js`

### Other components

- **Shop staff**

## Connections

- Shop staff → Route shell: uses
- Frontend entry → Route shell: renders
- Route shell → Dashboard: routes
- Route shell → Sales screen: routes
- Route shell → Products screen: routes
- Route shell → Customer screens: routes
- Route shell → Credit screen: routes
- Route shell → Inventory screen: routes
- Route shell → Customer auth: routes
- Dashboard → Inventory state: dispatches
- User state → Express server: HTTP requests
- Express server → User routes: mounts
- Express server → Category routes: mounts
- Express server → Product routes: mounts
- Express server → Sales routes: mounts
- Express server → Inventory routes: mounts
- User operations → MySQL database: queries
- Category operations → MySQL database: queries
- Product operations → MySQL database: queries
- Sales and credit → MySQL database: queries
- Inventory operations → MySQL database: queries
