# loong-c/fdu-database architecture

> Architecture diagram of the GitHub repository loong-c/fdu-database, 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/loong-c/fdu-database
- Repository: https://github.com/loong-c/fdu-database

## Overview

This is a web-based chain-bookstore management system. Staff sign in, manage catalog and customer data, then record sales or purchasing and stock receipts; the backend applies business rules and updates store-level inventory. The frontend also supports dashboards and reports, including CSV export. The graph combines README-documented capabilities with sampled service code; view-to-service wiring and database access details are represented only where the repository structure or documented behavior supports them.

Main entry points: [`backend/config/urls.py`](https://github.com/loong-c/fdu-database/blob/main/backend/config/urls.py) (Django API), [`backend/inventory`](https://github.com/loong-c/fdu-database/tree/main/backend/inventory) (Store inventory), [`backend/catalog`](https://github.com/loong-c/fdu-database/tree/main/backend/catalog) (Catalog management), [`backend/sales`](https://github.com/loong-c/fdu-database/tree/main/backend/sales) (Sales processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Vue application<br/>[main.ts]"]
  node_router["Role-aware routing<br/>[index.ts]"]
  node_views["Management views"]
  node_api["API clients"]
  node_http["HTTP and tokens<br/>[http.ts]"]
end

subgraph group_identity["Identity and API"]
  node_backend["Django API<br/>[urls.py]"]
  node_accounts["Accounts and JWT"]
end

subgraph group_operations["Store operations"]
  node_catalog["Catalog management"]
  node_customers["Customers and members"]
  node_stores["Store management"]
  node_sales["Sales processing"]
  node_procurement["Purchasing and receipt"]
  node_inventory["Store inventory"]
end

subgraph group_insights["Reporting"]
  node_analytics["Analytics API"]
  node_reportviews["Dashboard and reports<br/>[AnalyticsView.vue]"]
  node_charts["Chart components"]
end

node_staff(("Staff user"))
node_database[("MySQL business data")]

node_staff -->|"uses"| node_app
node_app -->|"mounts"| node_router
node_router -->|"selects views"| node_views
node_views -->|"requests data"| node_api
node_api -->|"sends requests"| node_http
node_http -->|"calls API"| node_backend
node_backend -->|"routes auth"| node_accounts
node_backend -->|"routes catalog"| node_catalog
node_backend -->|"routes customers"| node_customers
node_backend -->|"routes stores"| node_stores
node_backend -->|"routes sales"| node_sales
node_backend -->|"routes purchasing"| node_procurement
node_backend -->|"routes inventory"| node_inventory
node_backend -->|"routes reports"| node_analytics
node_sales -->|"adjusts stock"| node_inventory
node_procurement -->|"adds approved stock"| node_inventory
node_catalog -->|"sets initial stock"| node_inventory
node_reportviews -->|"requests reports"| node_api
node_reportviews -->|"renders charts"| node_charts
node_analytics -->|"reads business data"| node_database
node_catalog -->|"stores catalog"| node_database
node_customers -->|"stores customer data"| node_database
node_stores -->|"stores locations"| node_database
node_sales -->|"stores sales"| node_database
node_procurement -->|"stores purchases"| node_database
node_inventory -->|"reads and writes stock"| node_database

click node_app "https://github.com/loong-c/fdu-database/blob/main/frontend/src/main.ts"
click node_router "https://github.com/loong-c/fdu-database/blob/main/frontend/src/router/index.ts"
click node_views "https://github.com/loong-c/fdu-database/tree/main/frontend/src/views"
click node_api "https://github.com/loong-c/fdu-database/tree/main/frontend/src/api"
click node_http "https://github.com/loong-c/fdu-database/blob/main/frontend/src/api/http.ts"
click node_backend "https://github.com/loong-c/fdu-database/blob/main/backend/config/urls.py"
click node_accounts "https://github.com/loong-c/fdu-database/tree/main/backend/accounts"
click node_catalog "https://github.com/loong-c/fdu-database/tree/main/backend/catalog"
click node_customers "https://github.com/loong-c/fdu-database/tree/main/backend/customers"
click node_stores "https://github.com/loong-c/fdu-database/tree/main/backend/stores"
click node_sales "https://github.com/loong-c/fdu-database/tree/main/backend/sales"
click node_procurement "https://github.com/loong-c/fdu-database/tree/main/backend/procurement"
click node_inventory "https://github.com/loong-c/fdu-database/tree/main/backend/inventory"
click node_analytics "https://github.com/loong-c/fdu-database/tree/main/backend/analytics"
click node_reportviews "https://github.com/loong-c/fdu-database/blob/main/frontend/src/views/analytics/AnalyticsView.vue"
click node_charts "https://github.com/loong-c/fdu-database/tree/main/frontend/src/components/charts"

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_router,node_views,node_api,node_http,node_staff toneBlue
class node_backend,node_accounts,node_database toneAmber
class node_catalog,node_customers,node_stores,node_sales,node_procurement,node_inventory toneMint
class node_analytics,node_reportviews,node_charts toneRose
```

## Components

### Web client

- [Vue application](https://github.com/loong-c/fdu-database/blob/main/frontend/src/main.ts): `frontend/src/main.ts`
- [Role-aware routing](https://github.com/loong-c/fdu-database/blob/main/frontend/src/router/index.ts): `frontend/src/router/index.ts`
- [Management views](https://github.com/loong-c/fdu-database/tree/main/frontend/src/views): `frontend/src/views`
- [API clients](https://github.com/loong-c/fdu-database/tree/main/frontend/src/api): `frontend/src/api`
- [HTTP and tokens](https://github.com/loong-c/fdu-database/blob/main/frontend/src/api/http.ts): `frontend/src/api/http.ts`

### Identity and API

- [Django API](https://github.com/loong-c/fdu-database/blob/main/backend/config/urls.py): `backend/config/urls.py`
- [Accounts and JWT](https://github.com/loong-c/fdu-database/tree/main/backend/accounts): `backend/accounts`

### Store operations

- [Catalog management](https://github.com/loong-c/fdu-database/tree/main/backend/catalog): `backend/catalog`
- [Customers and members](https://github.com/loong-c/fdu-database/tree/main/backend/customers): `backend/customers`
- [Store management](https://github.com/loong-c/fdu-database/tree/main/backend/stores): `backend/stores`
- [Sales processing](https://github.com/loong-c/fdu-database/tree/main/backend/sales): `backend/sales`
- [Purchasing and receipt](https://github.com/loong-c/fdu-database/tree/main/backend/procurement): `backend/procurement`
- [Store inventory](https://github.com/loong-c/fdu-database/tree/main/backend/inventory): `backend/inventory`

### Reporting

- [Analytics API](https://github.com/loong-c/fdu-database/tree/main/backend/analytics): `backend/analytics`
- [Dashboard and reports](https://github.com/loong-c/fdu-database/blob/main/frontend/src/views/analytics/AnalyticsView.vue): `frontend/src/views/analytics/AnalyticsView.vue`
- [Chart components](https://github.com/loong-c/fdu-database/tree/main/frontend/src/components/charts): `frontend/src/components/charts`

### Other components

- **Staff user**
- **MySQL business data**

## Connections

- Staff user → Vue application: uses
- Vue application → Role-aware routing: mounts
- Role-aware routing → Management views: selects views
- Management views → API clients: requests data
- API clients → HTTP and tokens: sends requests
- HTTP and tokens → Django API: calls API
- Django API → Accounts and JWT: routes auth
- Django API → Catalog management: routes catalog
- Django API → Customers and members: routes customers
- Django API → Store management: routes stores
- Django API → Sales processing: routes sales
- Django API → Purchasing and receipt: routes purchasing
- Django API → Store inventory: routes inventory
- Django API → Analytics API: routes reports
- Sales processing → Store inventory: adjusts stock
- Purchasing and receipt → Store inventory: adds approved stock
- Catalog management → Store inventory: sets initial stock
- Dashboard and reports → API clients: requests reports
- Dashboard and reports → Chart components: renders charts
- Analytics API → MySQL business data: reads business data
- Catalog management → MySQL business data: stores catalog
- Customers and members → MySQL business data: stores customer data
- Store management → MySQL business data: stores locations
- Sales processing → MySQL business data: stores sales
- Purchasing and receipt → MySQL business data: stores purchases
- Store inventory → MySQL business data: reads and writes stock
