# shigosag/business-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/shigosag/business-management-system
- Repository: https://github.com/shigosag/business-management-system

## Overview

This is a browser-based business management system: users view dashboard metrics and charts or manage customer records through a React UI backed by an Express REST API and Prisma/PostgreSQL. The customer workflow runs from the Customers page through the API client, route validation and controller, customer service, and database. Analytics and authentication are separate backend capabilities. Edges reflect shown calls, imports listed in the source index, or README statements; unsampled implementation details are not inferred.

Main entry points: [`backend/src/app.ts`](https://github.com/shigosag/business-management-system/blob/main/backend/src/app.ts) (Express API app), [`frontend/src/pages/Customers.tsx`](https://github.com/shigosag/business-management-system/blob/main/frontend/src/pages/Customers.tsx) (Customer management), [`backend/src/routes/auth.routes.ts`](https://github.com/shigosag/business-management-system/blob/main/backend/src/routes/auth.routes.ts) (Auth routes), [`backend/src/config/db.ts`](https://github.com/shigosag/business-management-system/blob/main/backend/src/config/db.ts) (Prisma database client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["App navigation<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_customers["Customer management<br/>[Customers.tsx]"]
  node_charts["Dashboard charts<br/>[ChartCard.tsx]"]
  node_customer_modal["Customer modal<br/>[Modal.tsx]"]
  node_toast["Toast notifications<br/>[Toast.tsx]"]
  node_client["HTTP client<br/>[Client.ts]"]
end

subgraph group_api["API and security"]
  node_express["Express API app<br/>[app.ts]"]
  node_customer_routes["Customer routes<br/>[customer.routes.ts]"]
  node_auth_routes["Auth routes<br/>[auth.routes.ts]"]
  node_analytics_routes["Analytics routes"]
  node_validation["Request validation<br/>[validate.ts]"]
  node_auth_middleware["JWT authentication<br/>[auth.ts]"]
end

subgraph group_domain["Business capabilities"]
  node_customer_controller["Customer controller"]
  node_customer_service["Customer service"]
  node_analytics_controller["Analytics controller"]
  node_auth_controller["Auth controller<br/>[auth.controller.ts]"]
end

subgraph group_persistence["Data and operations"]
  node_prisma["Prisma database client<br/>[db.ts]"]
  node_schema["Database schema<br/>[schema.prisma]"]
  node_logger["Application logger<br/>[logger.ts]"]
end

node_user(("Business user"))
node_postgres[("PostgreSQL")]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_customers
node_dashboard -->|"requests metrics"| node_client
node_dashboard -->|"renders"| node_charts
node_customers -->|"requests CRUD"| node_client
node_customers -->|"renders"| node_customer_modal
node_customers -->|"shows feedback"| node_toast
node_client -.->|"calls REST API"| node_express
node_express -->|"mounts"| node_customer_routes
node_express -->|"mounts"| node_auth_routes
node_express -->|"mounts"| node_analytics_routes
node_customer_routes -->|"dispatches"| node_customer_controller
node_customer_routes -->|"validates writes"| node_validation
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"validates credentials"| node_validation
node_auth_routes -->|"protects profile"| node_auth_middleware
node_analytics_routes -->|"dispatches"| node_analytics_controller
node_customer_controller -->|"delegates"| node_customer_service
node_customer_service -->|"queries data"| node_prisma
node_auth_controller -->|"reads and writes users"| node_prisma
node_analytics_controller -->|"queries metrics"| node_prisma
node_prisma -->|"persists data"| node_postgres
node_schema -.->|"defines structure"| node_postgres
node_express -->|"logs requests"| node_logger
node_analytics_controller -->|"logs analytics"| node_logger

click node_app "https://github.com/shigosag/business-management-system/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/shigosag/business-management-system/blob/main/frontend/src/pages/Dashboard.tsx"
click node_customers "https://github.com/shigosag/business-management-system/blob/main/frontend/src/pages/Customers.tsx"
click node_charts "https://github.com/shigosag/business-management-system/blob/main/frontend/src/components/ChartCard.tsx"
click node_customer_modal "https://github.com/shigosag/business-management-system/blob/main/frontend/src/components/Modal.tsx"
click node_toast "https://github.com/shigosag/business-management-system/blob/main/frontend/src/components/Toast.tsx"
click node_client "https://github.com/shigosag/business-management-system/blob/main/frontend/src/api/Client.ts"
click node_express "https://github.com/shigosag/business-management-system/blob/main/backend/src/app.ts"
click node_customer_routes "https://github.com/shigosag/business-management-system/blob/main/backend/src/routes/customer.routes.ts"
click node_auth_routes "https://github.com/shigosag/business-management-system/blob/main/backend/src/routes/auth.routes.ts"
click node_analytics_routes "https://github.com/shigosag/business-management-system/blob/main/backend/src/routes/analytics.routes.ts"
click node_validation "https://github.com/shigosag/business-management-system/blob/main/backend/src/middleware/validate.ts"
click node_auth_middleware "https://github.com/shigosag/business-management-system/blob/main/backend/src/middleware/auth.ts"
click node_customer_controller "https://github.com/shigosag/business-management-system/blob/main/backend/src/controllers/customer.controller.ts"
click node_customer_service "https://github.com/shigosag/business-management-system/blob/main/backend/src/services/customer.service.ts"
click node_analytics_controller "https://github.com/shigosag/business-management-system/blob/main/backend/src/controllers/analytics.controller.ts"
click node_auth_controller "https://github.com/shigosag/business-management-system/blob/main/backend/src/controllers/auth.controller.ts"
click node_prisma "https://github.com/shigosag/business-management-system/blob/main/backend/src/config/db.ts"
click node_schema "https://github.com/shigosag/business-management-system/blob/main/backend/prisma/schema.prisma"
click node_logger "https://github.com/shigosag/business-management-system/blob/main/backend/src/utils/logger.ts"

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,node_dashboard,node_customers,node_charts,node_customer_modal,node_toast,node_client,node_user toneBlue
class node_express,node_customer_routes,node_auth_routes,node_analytics_routes,node_validation,node_auth_middleware,node_postgres toneAmber
class node_customer_controller,node_customer_service,node_analytics_controller,node_auth_controller toneMint
class node_prisma,node_schema,node_logger toneRose
```

## Components

### Web application

- [App navigation](https://github.com/shigosag/business-management-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard](https://github.com/shigosag/business-management-system/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Customer management](https://github.com/shigosag/business-management-system/blob/main/frontend/src/pages/Customers.tsx): `frontend/src/pages/Customers.tsx`
- [Dashboard charts](https://github.com/shigosag/business-management-system/blob/main/frontend/src/components/ChartCard.tsx): `frontend/src/components/ChartCard.tsx`
- [Customer modal](https://github.com/shigosag/business-management-system/blob/main/frontend/src/components/Modal.tsx): `frontend/src/components/Modal.tsx`
- [Toast notifications](https://github.com/shigosag/business-management-system/blob/main/frontend/src/components/Toast.tsx): `frontend/src/components/Toast.tsx`
- [HTTP client](https://github.com/shigosag/business-management-system/blob/main/frontend/src/api/Client.ts): `frontend/src/api/Client.ts`

### API and security

- [Express API app](https://github.com/shigosag/business-management-system/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Customer routes](https://github.com/shigosag/business-management-system/blob/main/backend/src/routes/customer.routes.ts): `backend/src/routes/customer.routes.ts`
- [Auth routes](https://github.com/shigosag/business-management-system/blob/main/backend/src/routes/auth.routes.ts): `backend/src/routes/auth.routes.ts`
- [Analytics routes](https://github.com/shigosag/business-management-system/blob/main/backend/src/routes/analytics.routes.ts): `backend/src/routes/analytics.routes.ts`
- [Request validation](https://github.com/shigosag/business-management-system/blob/main/backend/src/middleware/validate.ts): `backend/src/middleware/validate.ts`
- [JWT authentication](https://github.com/shigosag/business-management-system/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`

### Business capabilities

- [Customer controller](https://github.com/shigosag/business-management-system/blob/main/backend/src/controllers/customer.controller.ts): `backend/src/controllers/customer.controller.ts`
- [Customer service](https://github.com/shigosag/business-management-system/blob/main/backend/src/services/customer.service.ts): `backend/src/services/customer.service.ts`
- [Analytics controller](https://github.com/shigosag/business-management-system/blob/main/backend/src/controllers/analytics.controller.ts): `backend/src/controllers/analytics.controller.ts`
- [Auth controller](https://github.com/shigosag/business-management-system/blob/main/backend/src/controllers/auth.controller.ts): `backend/src/controllers/auth.controller.ts`

### Data and operations

- [Prisma database client](https://github.com/shigosag/business-management-system/blob/main/backend/src/config/db.ts): `backend/src/config/db.ts`
- [Database schema](https://github.com/shigosag/business-management-system/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`
- [Application logger](https://github.com/shigosag/business-management-system/blob/main/backend/src/utils/logger.ts): `backend/src/utils/logger.ts`

### Other components

- **Business user**
- **PostgreSQL**

## Connections

- Business user → App navigation: uses (evidence: `README.md`)
- App navigation → Dashboard: renders (evidence: `frontend/src/App.tsx`)
- App navigation → Customer management: renders (evidence: `frontend/src/App.tsx`)
- Dashboard → HTTP client: requests metrics (evidence: `frontend/src/pages/Dashboard.tsx`)
- Dashboard → Dashboard charts: renders (evidence: `frontend/src/pages/Dashboard.tsx`)
- Customer management → HTTP client: requests CRUD (evidence: `frontend/src/pages/Customers.tsx`)
- Customer management → Customer modal: renders (evidence: `frontend/src/pages/Customers.tsx`)
- Customer management → Toast notifications: shows feedback (evidence: `frontend/src/pages/Customers.tsx`)
- HTTP client → Express API app: calls REST API (evidence: `README.md`)
- Express API app → Customer routes: mounts (evidence: `backend/src/app.ts`)
- Express API app → Auth routes: mounts (evidence: `backend/src/app.ts`)
- Express API app → Analytics routes: mounts (evidence: `backend/src/app.ts`)
- Customer routes → Customer controller: dispatches (evidence: `backend/src/routes/customer.routes.ts`)
- Customer routes → Request validation: validates writes (evidence: `backend/src/routes/customer.routes.ts`)
- Auth routes → Auth controller: dispatches (evidence: `backend/src/routes/auth.routes.ts`)
- Auth routes → Request validation: validates credentials (evidence: `backend/src/routes/auth.routes.ts`)
- Auth routes → JWT authentication: protects profile (evidence: `backend/src/routes/auth.routes.ts`)
- Analytics routes → Analytics controller: dispatches (evidence: `backend/src/routes/analytics.routes.ts`)
- Customer controller → Customer service: delegates (evidence: `backend/src/controllers/customer.controller.ts`)
- Customer service → Prisma database client: queries data (evidence: `backend/src/services/customer.service.ts`)
- Auth controller → Prisma database client: reads and writes users (evidence: `backend/src/controllers/auth.controller.ts`)
- Analytics controller → Prisma database client: queries metrics (evidence: `backend/src/controllers/analytics.controller.ts`)
- Prisma database client → PostgreSQL: persists data (evidence: `README.md`)
- Database schema → PostgreSQL: defines structure
- Express API app → Application logger: logs requests (evidence: `backend/src/app.ts`)
- Analytics controller → Application logger: logs analytics (evidence: `backend/src/controllers/analytics.controller.ts`)
