# syedraihanm/tracksale architecture

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

- Interactive diagram: https://gitdiagram.com/syedraihanm/tracksale
- Repository: https://github.com/syedraihanm/tracksale

## Overview

This is a local-first mobile repair shop management system for staff handling intake through repair, billing, and delivery. Staff work through a FastAPI application with a browser interface; ticket workflows connect to payment, receipt, status, and inventory services, while search and import support separate operational tasks. The product also covers cash reconciliation, reporting, customer history, security, audit, and backups. The graph uses README descriptions and SOURCE INDEX references for relationships; unsampled implementations and runtime wiring are not inferred beyond those references.

Main entry points: [`app/routers/tickets.py`](https://github.com/syedraihanm/tracksale/blob/main/app/routers/tickets.py) (Ticket workflows), [`app/db.py`](https://github.com/syedraihanm/tracksale/blob/main/app/db.py) (SQLite database), [`app/models/ticket.py`](https://github.com/syedraihanm/tracksale/blob/main/app/models/ticket.py) (Ticket records), [`app/static/app.js`](https://github.com/syedraihanm/tracksale/blob/main/app/static/app.js) (Shop interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Repair workflow"]
  node_tickets["Ticket workflows<br/>[tickets.py]"]
  node_queue["Repair queue<br/>[queue.py]"]
  node_status["Status lifecycle<br/>[status.py]"]
  node_ticket_service["Ticket services<br/>[tickets.py]"]
  node_payments["Payment services<br/>[payments.py]"]
  node_receipts["Receipt services<br/>[receipts.py]"]
  node_items["Ticket line items<br/>[items.py]"]
end

subgraph group_operations["Shop operations"]
  node_inventory_router["Inventory management<br/>[inventory.py]"]
  node_inventory_service["Inventory services<br/>[inventory.py]"]
  node_search_router["Global search<br/>[search.py]"]
  node_search_service["Ticket search<br/>[search.py]"]
  node_import_router["Data import<br/>[importer.py]"]
  node_import_service["Import processing<br/>[importer.py]"]
  node_cash["Cash reconciliation<br/>[cash_close.py]"]
  node_reports["Business reports<br/>[reports.py]"]
end

subgraph group_platform["Application platform"]
  node_browser["Shop interface<br/>[app.js]"]
  node_auth["Login and PIN<br/>[auth.py]"]
  node_security["Session and secrets<br/>[security.py]"]
  node_audit["Audit records<br/>[audit.py]"]
  node_backup["Database backups<br/>[backup.py]"]
  node_formatting["Money and dates<br/>[formatting.py]"]
end

subgraph group_records["Domain records"]
  node_database[("SQLite database<br/>[db.py]")]
  node_ticket_model["Ticket records<br/>[ticket.py]"]
  node_payment_model["Payment records<br/>[payment.py]"]
  node_item_model["Line item records<br/>[ticket_item.py]"]
  node_enums["Domain states<br/>[enums.py]"]
end

node_staff(("Shop staff"))

node_staff -->|"uses"| node_browser
node_browser -.->|"submits intake"| node_tickets
node_tickets -->|"delegates"| node_ticket_service
node_tickets -->|"changes status"| node_status
node_tickets -->|"records payments"| node_payments
node_tickets -->|"requests receipts"| node_receipts
node_tickets -->|"uses inventory"| node_inventory_service
node_queue -->|"records advances"| node_payments
node_queue -->|"previews receipts"| node_receipts
node_search_router -->|"searches tickets"| node_search_service
node_import_router -->|"processes imports"| node_import_service
node_inventory_router -.->|"manages stock"| node_inventory_service
node_items -->|"adjusts stock"| node_inventory_service
node_tickets -->|"reads and writes"| node_ticket_model
node_ticket_model -->|"relates payments"| node_payment_model
node_ticket_model -->|"relates items"| node_item_model
node_ticket_model -->|"maps records"| node_database
node_payment_model -->|"maps records"| node_database
node_item_model -->|"maps records"| node_database
node_status -.->|"uses states"| node_enums
node_cash -.->|"reconciles cash"| node_database
node_reports -->|"reads metrics"| node_database
node_auth -->|"verifies credentials"| node_security
node_security -.->|"uses settings"| node_database
node_tickets -.->|"audits changes"| node_audit
node_backup -.->|"backs up data"| node_database
node_browser -.->|"renders amounts"| node_formatting

click node_browser "https://github.com/syedraihanm/tracksale/blob/main/app/static/app.js"
click node_tickets "https://github.com/syedraihanm/tracksale/blob/main/app/routers/tickets.py"
click node_queue "https://github.com/syedraihanm/tracksale/blob/main/app/routers/queue.py"
click node_status "https://github.com/syedraihanm/tracksale/blob/main/app/services/status.py"
click node_ticket_service "https://github.com/syedraihanm/tracksale/blob/main/app/services/tickets.py"
click node_payments "https://github.com/syedraihanm/tracksale/blob/main/app/services/payments.py"
click node_receipts "https://github.com/syedraihanm/tracksale/blob/main/app/services/receipts.py"
click node_inventory_router "https://github.com/syedraihanm/tracksale/blob/main/app/routers/inventory.py"
click node_inventory_service "https://github.com/syedraihanm/tracksale/blob/main/app/services/inventory.py"
click node_items "https://github.com/syedraihanm/tracksale/blob/main/app/services/items.py"
click node_search_router "https://github.com/syedraihanm/tracksale/blob/main/app/routers/search.py"
click node_search_service "https://github.com/syedraihanm/tracksale/blob/main/app/services/search.py"
click node_import_router "https://github.com/syedraihanm/tracksale/blob/main/app/routers/importer.py"
click node_import_service "https://github.com/syedraihanm/tracksale/blob/main/app/services/importer.py"
click node_cash "https://github.com/syedraihanm/tracksale/blob/main/app/services/cash_close.py"
click node_reports "https://github.com/syedraihanm/tracksale/blob/main/app/services/reports.py"
click node_auth "https://github.com/syedraihanm/tracksale/blob/main/app/routers/auth.py"
click node_security "https://github.com/syedraihanm/tracksale/blob/main/app/security.py"
click node_audit "https://github.com/syedraihanm/tracksale/blob/main/app/services/audit.py"
click node_backup "https://github.com/syedraihanm/tracksale/blob/main/app/services/backup.py"
click node_database "https://github.com/syedraihanm/tracksale/blob/main/app/db.py"
click node_ticket_model "https://github.com/syedraihanm/tracksale/blob/main/app/models/ticket.py"
click node_payment_model "https://github.com/syedraihanm/tracksale/blob/main/app/models/payment.py"
click node_item_model "https://github.com/syedraihanm/tracksale/blob/main/app/models/ticket_item.py"
click node_enums "https://github.com/syedraihanm/tracksale/blob/main/app/models/enums.py"
click node_formatting "https://github.com/syedraihanm/tracksale/blob/main/app/formatting.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_tickets,node_queue,node_status,node_ticket_service,node_payments,node_receipts,node_items toneBlue
class node_inventory_router,node_inventory_service,node_search_router,node_search_service,node_import_router,node_import_service,node_cash,node_reports toneAmber
class node_browser,node_auth,node_security,node_audit,node_backup,node_formatting toneMint
class node_database,node_ticket_model,node_payment_model,node_item_model,node_enums toneRose
class node_staff toneIndigo
```

## Components

### Repair workflow

- [Ticket workflows](https://github.com/syedraihanm/tracksale/blob/main/app/routers/tickets.py): `app/routers/tickets.py`
- [Repair queue](https://github.com/syedraihanm/tracksale/blob/main/app/routers/queue.py): `app/routers/queue.py`
- [Status lifecycle](https://github.com/syedraihanm/tracksale/blob/main/app/services/status.py): `app/services/status.py`
- [Ticket services](https://github.com/syedraihanm/tracksale/blob/main/app/services/tickets.py): `app/services/tickets.py`
- [Payment services](https://github.com/syedraihanm/tracksale/blob/main/app/services/payments.py): `app/services/payments.py`
- [Receipt services](https://github.com/syedraihanm/tracksale/blob/main/app/services/receipts.py): `app/services/receipts.py`
- [Ticket line items](https://github.com/syedraihanm/tracksale/blob/main/app/services/items.py): `app/services/items.py`

### Shop operations

- [Inventory management](https://github.com/syedraihanm/tracksale/blob/main/app/routers/inventory.py): `app/routers/inventory.py`
- [Inventory services](https://github.com/syedraihanm/tracksale/blob/main/app/services/inventory.py): `app/services/inventory.py`
- [Global search](https://github.com/syedraihanm/tracksale/blob/main/app/routers/search.py): `app/routers/search.py`
- [Ticket search](https://github.com/syedraihanm/tracksale/blob/main/app/services/search.py): `app/services/search.py`
- [Data import](https://github.com/syedraihanm/tracksale/blob/main/app/routers/importer.py): `app/routers/importer.py`
- [Import processing](https://github.com/syedraihanm/tracksale/blob/main/app/services/importer.py): `app/services/importer.py`
- [Cash reconciliation](https://github.com/syedraihanm/tracksale/blob/main/app/services/cash_close.py): `app/services/cash_close.py`
- [Business reports](https://github.com/syedraihanm/tracksale/blob/main/app/services/reports.py): `app/services/reports.py`

### Application platform

- [Shop interface](https://github.com/syedraihanm/tracksale/blob/main/app/static/app.js): `app/static/app.js`
- [Login and PIN](https://github.com/syedraihanm/tracksale/blob/main/app/routers/auth.py): `app/routers/auth.py`
- [Session and secrets](https://github.com/syedraihanm/tracksale/blob/main/app/security.py): `app/security.py`
- [Audit records](https://github.com/syedraihanm/tracksale/blob/main/app/services/audit.py): `app/services/audit.py`
- [Database backups](https://github.com/syedraihanm/tracksale/blob/main/app/services/backup.py): `app/services/backup.py`
- [Money and dates](https://github.com/syedraihanm/tracksale/blob/main/app/formatting.py): `app/formatting.py`

### Domain records

- [SQLite database](https://github.com/syedraihanm/tracksale/blob/main/app/db.py): `app/db.py`
- [Ticket records](https://github.com/syedraihanm/tracksale/blob/main/app/models/ticket.py): `app/models/ticket.py`
- [Payment records](https://github.com/syedraihanm/tracksale/blob/main/app/models/payment.py): `app/models/payment.py`
- [Line item records](https://github.com/syedraihanm/tracksale/blob/main/app/models/ticket_item.py): `app/models/ticket_item.py`
- [Domain states](https://github.com/syedraihanm/tracksale/blob/main/app/models/enums.py): `app/models/enums.py`

### Other components

- **Shop staff**

## Connections

- Shop staff → Shop interface: uses
- Shop interface → Ticket workflows: submits intake
- Ticket workflows → Ticket services: delegates (evidence: `app/routers/tickets.py`)
- Ticket workflows → Status lifecycle: changes status (evidence: `app/routers/tickets.py`)
- Ticket workflows → Payment services: records payments (evidence: `app/routers/tickets.py`)
- Ticket workflows → Receipt services: requests receipts (evidence: `app/routers/tickets.py`)
- Ticket workflows → Inventory services: uses inventory (evidence: `app/routers/tickets.py`)
- Repair queue → Payment services: records advances (evidence: `app/routers/queue.py`)
- Repair queue → Receipt services: previews receipts (evidence: `app/routers/queue.py`)
- Global search → Ticket search: searches tickets (evidence: `app/routers/search.py`)
- Data import → Import processing: processes imports (evidence: `app/routers/importer.py`)
- Inventory management → Inventory services: manages stock
- Ticket line items → Inventory services: adjusts stock (evidence: `app/services/inventory.py`)
- Ticket workflows → Ticket records: reads and writes (evidence: `app/routers/tickets.py`)
- Ticket records → Payment records: relates payments (evidence: `app/models/ticket.py`)
- Ticket records → Line item records: relates items (evidence: `app/models/ticket.py`)
- Ticket records → SQLite database: maps records (evidence: `app/models/ticket.py`)
- Payment records → SQLite database: maps records (evidence: `app/models/payment.py`)
- Line item records → SQLite database: maps records (evidence: `app/models/ticket_item.py`)
- Status lifecycle → Domain states: uses states
- Cash reconciliation → SQLite database: reconciles cash
- Business reports → SQLite database: reads metrics (evidence: `app/services/reports.py`)
- Login and PIN → Session and secrets: verifies credentials (evidence: `app/routers/auth.py`)
- Session and secrets → SQLite database: uses settings
- Ticket workflows → Audit records: audits changes
- Database backups → SQLite database: backs up data
- Shop interface → Money and dates: renders amounts
