# boben19/onlypawns architecture

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

- Interactive diagram: https://gitdiagram.com/boben19/onlypawns
- Repository: https://github.com/boben19/onlypawns

## Overview

Only Pawns is a Django pawnshop system with a customer-facing PWA and a staff dashboard sharing one database. Staff register and verify customers, appraise items, issue tickets, and handle renewals, redemptions, and auctions; customers view ticket status and due amounts through the app or API. Services implement transaction rules and related operations, while scheduled jobs handle reminders, expiry, and backups. The README documents additional reporting, remittances, load, chat, and branch features. Some of these implementations were not sampled, so their links are based on README statements rather than inspected code.

Main entry points: [`pawn/views_staff.py`](https://github.com/boben19/onlypawns/blob/main/pawn/views_staff.py) (Staff workflows), [`pawn/urls.py`](https://github.com/boben19/onlypawns/blob/main/pawn/urls.py) (Django routing), [`pawn/services.py`](https://github.com/boben19/onlypawns/blob/main/pawn/services.py) (Pawn services), [`pawn/models.py`](https://github.com/boben19/onlypawns/blob/main/pawn/models.py) (Pawn records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_staff["Staff dashboard"]
  node_customer_app["Customer PWA"]
  node_api["REST API<br/>[api.py]"]
  node_routes["Django routing<br/>[urls.py]"]
end

subgraph group_operations["Pawn operations"]
  node_staff_views["Staff workflows<br/>[views_staff.py]"]
  node_forms["Validation forms<br/>[forms.py]"]
  node_reports["Reports and exports<br/>[services.py]"]
  node_extras["Shop extras<br/>[services.py]"]
end

subgraph group_customer["Customer experience"]
  node_client_views["Customer workflows<br/>[views_client.py]"]
  node_customer_auth["Customer access<br/>[views_client.py]"]
  node_geo["Branch location<br/>[geo.py]"]
end

subgraph group_shared["Shared domain"]
  node_services["Pawn services<br/>[services.py]"]
  node_records[("Pawn records<br/>[models.py]")]
  node_cash_ledger[("Cash ledger<br/>[models.py]")]
end

subgraph group_support["Operations support"]
  node_scheduled["Nightly alerts<br/>[nightly.py]"]
  node_backup["Backup job<br/>[backup.py]"]
end

node_customer(("Customer"))
node_employee(("Shop employee"))
node_database[("Database")]

node_customer -->|"opens app"| node_routes
node_employee -->|"opens dashboard"| node_routes
node_routes -->|"routes requests"| node_client_views
node_routes -->|"routes requests"| node_staff_views
node_routes -->|"routes requests"| node_api
node_staff_views -->|"uses forms"| node_forms
node_staff_views -->|"calls services"| node_services
node_client_views -->|"calls services"| node_services
node_api -->|"calls services"| node_services
node_services -->|"reads and writes"| node_records
node_staff_views -->|"reads and writes"| node_records
node_client_views -->|"reads and writes"| node_records
node_api -->|"reads and writes"| node_records
node_staff_views -.->|"handles cash flows"| node_cash_ledger
node_services -->|"records ledger"| node_cash_ledger
node_client_views -->|"handles sign-in"| node_customer_auth
node_routes -->|"routes location"| node_geo
node_scheduled -->|"runs alerts"| node_services
node_backup -->|"logs backup"| node_records
node_staff_views -->|"requests reports"| node_reports
node_staff_views -.->|"manages shop extras"| node_extras
node_customer_app -.->|"uses chat API"| node_api
node_records -->|"persists records"| node_database

click node_staff "https://github.com/boben19/onlypawns/tree/main/pawn/templates/staff"
click node_customer_app "https://github.com/boben19/onlypawns/tree/main/pawn/templates/app"
click node_api "https://github.com/boben19/onlypawns/blob/main/pawn/api.py"
click node_routes "https://github.com/boben19/onlypawns/blob/main/pawn/urls.py"
click node_staff_views "https://github.com/boben19/onlypawns/blob/main/pawn/views_staff.py"
click node_forms "https://github.com/boben19/onlypawns/blob/main/pawn/forms.py"
click node_client_views "https://github.com/boben19/onlypawns/blob/main/pawn/views_client.py"
click node_services "https://github.com/boben19/onlypawns/blob/main/pawn/services.py"
click node_records "https://github.com/boben19/onlypawns/blob/main/pawn/models.py"
click node_customer_auth "https://github.com/boben19/onlypawns/blob/main/pawn/views_client.py"
click node_geo "https://github.com/boben19/onlypawns/blob/main/pawn/geo.py"
click node_scheduled "https://github.com/boben19/onlypawns/blob/main/pawn/management/commands/nightly.py"
click node_backup "https://github.com/boben19/onlypawns/blob/main/pawn/management/commands/backup.py"
click node_reports "https://github.com/boben19/onlypawns/blob/main/pawn/services.py"
click node_cash_ledger "https://github.com/boben19/onlypawns/blob/main/pawn/models.py"
click node_extras "https://github.com/boben19/onlypawns/blob/main/pawn/services.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_staff,node_customer_app,node_api,node_routes toneBlue
class node_staff_views,node_forms,node_reports,node_extras,node_database toneAmber
class node_client_views,node_customer_auth,node_geo toneMint
class node_services,node_records,node_cash_ledger toneRose
class node_scheduled,node_backup,node_customer,node_employee toneIndigo
```

## Components

### User entry points

- [Staff dashboard](https://github.com/boben19/onlypawns/tree/main/pawn/templates/staff): `pawn/templates/staff`
- [Customer PWA](https://github.com/boben19/onlypawns/tree/main/pawn/templates/app): `pawn/templates/app`
- [REST API](https://github.com/boben19/onlypawns/blob/main/pawn/api.py): `pawn/api.py`
- [Django routing](https://github.com/boben19/onlypawns/blob/main/pawn/urls.py): `pawn/urls.py`

### Pawn operations

- [Staff workflows](https://github.com/boben19/onlypawns/blob/main/pawn/views_staff.py): `pawn/views_staff.py`
- [Validation forms](https://github.com/boben19/onlypawns/blob/main/pawn/forms.py): `pawn/forms.py`
- [Reports and exports](https://github.com/boben19/onlypawns/blob/main/pawn/services.py): `pawn/services.py`
- [Shop extras](https://github.com/boben19/onlypawns/blob/main/pawn/services.py): `pawn/services.py`

### Customer experience

- [Customer workflows](https://github.com/boben19/onlypawns/blob/main/pawn/views_client.py): `pawn/views_client.py`
- [Customer access](https://github.com/boben19/onlypawns/blob/main/pawn/views_client.py): `pawn/views_client.py`
- [Branch location](https://github.com/boben19/onlypawns/blob/main/pawn/geo.py): `pawn/geo.py`

### Shared domain

- [Pawn services](https://github.com/boben19/onlypawns/blob/main/pawn/services.py): `pawn/services.py`
- [Pawn records](https://github.com/boben19/onlypawns/blob/main/pawn/models.py): `pawn/models.py`
- [Cash ledger](https://github.com/boben19/onlypawns/blob/main/pawn/models.py): `pawn/models.py`

### Operations support

- [Nightly alerts](https://github.com/boben19/onlypawns/blob/main/pawn/management/commands/nightly.py): `pawn/management/commands/nightly.py`
- [Backup job](https://github.com/boben19/onlypawns/blob/main/pawn/management/commands/backup.py): `pawn/management/commands/backup.py`

### Other components

- **Customer**
- **Shop employee**
- **Database**

## Connections

- Customer → Django routing: opens app (evidence: `README.md`)
- Shop employee → Django routing: opens dashboard (evidence: `README.md`)
- Django routing → Customer workflows: routes requests (evidence: `pawn/urls.py`)
- Django routing → Staff workflows: routes requests (evidence: `pawn/urls.py`)
- Django routing → REST API: routes requests (evidence: `pawn/urls.py`)
- Staff workflows → Validation forms: uses forms (evidence: `pawn/views_staff.py`)
- Staff workflows → Pawn services: calls services (evidence: `pawn/views_staff.py`)
- Customer workflows → Pawn services: calls services (evidence: `pawn/views_client.py`)
- REST API → Pawn services: calls services (evidence: `pawn/api.py`)
- Pawn services → Pawn records: reads and writes (evidence: `pawn/services.py`)
- Staff workflows → Pawn records: reads and writes (evidence: `pawn/views_staff.py`)
- Customer workflows → Pawn records: reads and writes (evidence: `pawn/views_client.py`)
- REST API → Pawn records: reads and writes (evidence: `pawn/api.py`)
- Staff workflows → Cash ledger: handles cash flows (evidence: `README.md`)
- Pawn services → Cash ledger: records ledger (evidence: `pawn/services.py`)
- Customer workflows → Customer access: handles sign-in (evidence: `pawn/views_client.py`)
- Django routing → Branch location: routes location (evidence: `pawn/urls.py`)
- Nightly alerts → Pawn services: runs alerts (evidence: `pawn/management/commands/nightly.py`)
- Backup job → Pawn records: logs backup (evidence: `pawn/management/commands/backup.py`)
- Staff workflows → Reports and exports: requests reports (evidence: `pawn/views_staff.py`)
- Staff workflows → Shop extras: manages shop extras (evidence: `README.md`)
- Customer PWA → REST API: uses chat API (evidence: `README.md`)
- Pawn records → Database: persists records (evidence: `README.md`)
