# xandrine-commits/ledgerly architecture

> Architecture diagram of the GitHub repository xandrine-commits/ledgerly, 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/xandrine-commits/ledgerly
- Repository: https://github.com/xandrine-commits/ledgerly

## Overview

Ledgerly is a small-business management web app: users log in, then manage customers, products, and orders and view dashboard and sales information. The vanilla-JavaScript frontend calls a FastAPI backend, which validates requests and applies role checks. Although the README describes SQL/SQLite, the sampled backend stores records in process-local Python lists, so data is not shown as persistent. The graph preserves documented product areas; unsampled page wiring and detailed dashboard behavior are not inferred.

Main entry points: [`main.py`](https://github.com/xandrine-commits/ledgerly/blob/main/main.py) (FastAPI endpoints), [`Frontend/app.js`](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/app.js) (Management client), [`Frontend/login.html`](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/login.html) (Login page), [`Frontend/login.js`](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/login.js) (Login client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_login_ui["Login page<br/>[login.html]"]
  node_login_client["Login client<br/>[login.js]"]
  node_app_client["Management client<br/>[app.js]"]
  node_dashboard["Dashboard<br/>[index.html]"]
  node_customer_views["Customer views<br/>[customers.html]"]
  node_product_views["Product views<br/>[products.html]"]
  node_order_views["Order views<br/>[orders.html]"]
  node_sales_view["Sales overview<br/>[sales.html]"]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Login and registration<br/>[main.py]"]
  node_passwords["Password hashing<br/>[auth.py]"]
  node_token_service["JWT tokens<br/>[jwt.py]"]
  node_access_control["Token and role checks<br/>[main.py]"]
end

subgraph group_business["Business operations"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_customer_ops["Customer CRUD<br/>[main.py]"]
  node_product_ops["Product CRUD<br/>[main.py]"]
  node_order_ops["Order CRUD<br/>[main.py]"]
  node_validation["Request validation<br/>[main.py]"]
end

subgraph group_persistence["Application state"]
  node_records[("In-memory records<br/>[main.py]")]
end

node_user(("Business user"))

node_user -->|"opens"| node_login_ui
node_login_ui -->|"submits credentials"| node_login_client
node_login_client -->|"posts login"| node_auth_routes
node_auth_routes -->|"verifies password"| node_passwords
node_auth_routes -->|"creates token"| node_token_service
node_user -->|"uses management"| node_app_client
node_app_client -->|"sends HTTP requests"| node_api
node_api -->|"validates requests"| node_validation
node_api -->|"checks access"| node_access_control
node_access_control -->|"decodes tokens"| node_token_service
node_api -->|"handles auth routes"| node_auth_routes
node_api -->|"routes customer CRUD"| node_customer_ops
node_api -->|"routes product CRUD"| node_product_ops
node_api -->|"routes order CRUD"| node_order_ops
node_customer_ops -->|"reads and writes"| node_records
node_product_ops -->|"reads and writes"| node_records
node_order_ops -->|"reads and writes"| node_records
node_app_client -->|"requests customer data"| node_customer_ops
node_app_client -->|"requests product data"| node_product_ops
node_app_client -->|"submits order data"| node_order_ops

click node_login_ui "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/login.html"
click node_login_client "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/login.js"
click node_app_client "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/app.js"
click node_dashboard "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/index.html"
click node_customer_views "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/customers.html"
click node_product_views "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/products.html"
click node_order_views "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/orders.html"
click node_sales_view "https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/sales.html"
click node_api "https://github.com/xandrine-commits/ledgerly/blob/main/main.py"
click node_customer_ops "https://github.com/xandrine-commits/ledgerly/blob/main/main.py"
click node_product_ops "https://github.com/xandrine-commits/ledgerly/blob/main/main.py"
click node_order_ops "https://github.com/xandrine-commits/ledgerly/blob/main/main.py"
click node_validation "https://github.com/xandrine-commits/ledgerly/blob/main/main.py"
click node_records "https://github.com/xandrine-commits/ledgerly/blob/main/main.py"
click node_auth_routes "https://github.com/xandrine-commits/ledgerly/blob/main/main.py"
click node_passwords "https://github.com/xandrine-commits/ledgerly/blob/main/auth/auth.py"
click node_token_service "https://github.com/xandrine-commits/ledgerly/blob/main/auth/jwt.py"
click node_access_control "https://github.com/xandrine-commits/ledgerly/blob/main/main.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_login_ui,node_login_client,node_app_client,node_dashboard,node_customer_views,node_product_views,node_order_views,node_sales_view,node_user toneBlue
class node_auth_routes,node_passwords,node_token_service,node_access_control toneAmber
class node_api,node_customer_ops,node_product_ops,node_order_ops,node_validation toneMint
class node_records toneRose
```

## Components

### Web interface

- [Login page](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/login.html): `Frontend/login.html`
- [Login client](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/login.js): `Frontend/login.js`
- [Management client](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/app.js): `Frontend/app.js`
- [Dashboard](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/index.html): `Frontend/index.html`
- [Customer views](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/customers.html): `Frontend/customers.html`
- [Product views](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/products.html): `Frontend/products.html`
- [Order views](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/orders.html): `Frontend/orders.html`
- [Sales overview](https://github.com/xandrine-commits/ledgerly/blob/main/Frontend/sales.html): `Frontend/sales.html`

### Identity and access

- [Login and registration](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`
- [Password hashing](https://github.com/xandrine-commits/ledgerly/blob/main/auth/auth.py): `auth/auth.py`
- [JWT tokens](https://github.com/xandrine-commits/ledgerly/blob/main/auth/jwt.py): `auth/jwt.py`
- [Token and role checks](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`

### Business operations

- [FastAPI endpoints](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`
- [Customer CRUD](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`
- [Product CRUD](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`
- [Order CRUD](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`
- [Request validation](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`

### Application state

- [In-memory records](https://github.com/xandrine-commits/ledgerly/blob/main/main.py): `main.py`

### Other components

- **Business user**

## Connections

- Business user → Login page: opens (evidence: `README.md`)
- Login page → Login client: submits credentials (evidence: `Frontend/login.js`)
- Login client → Login and registration: posts login (evidence: `Frontend/login.js`)
- Login and registration → Password hashing: verifies password (evidence: `main.py`)
- Login and registration → JWT tokens: creates token (evidence: `main.py`)
- Business user → Management client: uses management (evidence: `README.md`)
- Management client → FastAPI endpoints: sends HTTP requests (evidence: `README.md`)
- FastAPI endpoints → Request validation: validates requests (evidence: `README.md`)
- FastAPI endpoints → Token and role checks: checks access (evidence: `main.py`)
- Token and role checks → JWT tokens: decodes tokens (evidence: `main.py`)
- FastAPI endpoints → Login and registration: handles auth routes (evidence: `main.py`)
- FastAPI endpoints → Customer CRUD: routes customer CRUD (evidence: `README.md`)
- FastAPI endpoints → Product CRUD: routes product CRUD (evidence: `README.md`)
- FastAPI endpoints → Order CRUD: routes order CRUD (evidence: `README.md`)
- Customer CRUD → In-memory records: reads and writes (evidence: `main.py`)
- Product CRUD → In-memory records: reads and writes (evidence: `main.py`)
- Order CRUD → In-memory records: reads and writes (evidence: `main.py`)
- Management client → Customer CRUD: requests customer data (evidence: `Frontend/app.js`)
- Management client → Product CRUD: requests product data (evidence: `Frontend/app.js`)
- Management client → Order CRUD: submits order data (evidence: `Frontend/app.js`)
