# dmikushin/printing_kiosk architecture

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

- Interactive diagram: https://gitdiagram.com/dmikushin/printing_kiosk
- Repository: https://github.com/dmikushin/printing_kiosk

## Overview

Simple Printing Kiosk is a Flask web app for submitting print jobs and, in the sampled routes, controlling a separate scanning service. The main workflow accepts an upload, optionally selects PDF pages, records the job, and hands the file to a configured print command that uses CUPS. A separate scan workflow submits scan settings, polls for completion, saves the result, and offers downloads. The README documents printing and CUPS; scanner behavior is evident in the sampled views. Other route details are omitted where the excerpt is incomplete.

Main entry points: [`simple_print_server/views.py`](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/views.py) (Flask routes), [`scripts/lp-brother-dcp1510`](https://github.com/dmikushin/printing_kiosk/blob/master/scripts/lp-brother-dcp1510) (Print command), [`simple_print_server/database.py`](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/database.py) (Database session), [`simple_print_server/templates/index.html`](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/templates/index.html) (Print page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_views["Flask routes<br/>[views.py]"]
  node_index["Print page<br/>[index.html]"]
  node_scanner["Scanner page<br/>[scanner.html]"]
end

subgraph group_print["Print workflow"]
  node_config["App configuration<br/>[config.py]"]
  node_ranges["Page-range parser<br/>[page_range.py]"]
  node_pdf_tools["PDF utilities<br/>[views.py]"]
  node_print_command["Print command"]
  node_cups["CUPS queue"]
end

subgraph group_scan["Scan workflow"]
  node_scan_api["Scanner API"]
  node_scan_files[("Saved scans")]
end

subgraph group_state["Persistence"]
  node_models["Print records<br/>[models.py]"]
  node_database["Database session<br/>[database.py]"]
  node_sqlite[("SQLite database<br/>[sqlite.db]")]
end

node_browser(("Kiosk user"))

node_browser -->|"submits requests"| node_views
node_views -->|"renders"| node_index
node_views -->|"renders"| node_scanner
node_views -->|"parses ranges"| node_ranges
node_views -->|"counts and extracts"| node_pdf_tools
node_views -->|"reads settings"| node_config
node_views -->|"launches command"| node_print_command
node_print_command -->|"queues job"| node_cups
node_views -->|"creates record"| node_models
node_views -->|"adds and commits"| node_database
node_database -->|"reads and writes"| node_sqlite
node_views -->|"starts, polls, fetches"| node_scan_api
node_scan_api -->|"returns scan data"| node_views
node_views -->|"saves and serves"| node_scan_files

click node_views "https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/views.py"
click node_index "https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/templates/index.html"
click node_scanner "https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/templates/scanner.html"
click node_config "https://github.com/dmikushin/printing_kiosk/blob/master/config.py"
click node_ranges "https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/page_range.py"
click node_pdf_tools "https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/views.py"
click node_print_command "https://github.com/dmikushin/printing_kiosk/blob/master/scripts/lp-brother-dcp1510"
click node_scan_files "https://github.com/dmikushin/printing_kiosk/tree/master/data"
click node_models "https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/models.py"
click node_database "https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/database.py"
click node_sqlite "https://github.com/dmikushin/printing_kiosk/blob/master/data/sqlite.db"

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_views,node_index,node_scanner,node_browser toneBlue
class node_config,node_ranges,node_pdf_tools,node_print_command,node_cups toneAmber
class node_scan_api,node_scan_files toneMint
class node_models,node_database,node_sqlite toneRose
```

## Components

### Web interface

- [Flask routes](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/views.py): `simple_print_server/views.py`
- [Print page](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/templates/index.html): `simple_print_server/templates/index.html`
- [Scanner page](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/templates/scanner.html): `simple_print_server/templates/scanner.html`

### Print workflow

- [App configuration](https://github.com/dmikushin/printing_kiosk/blob/master/config.py): `config.py`
- [Page-range parser](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/page_range.py): `simple_print_server/page_range.py`
- [PDF utilities](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/views.py): `simple_print_server/views.py`
- [Print command](https://github.com/dmikushin/printing_kiosk/blob/master/scripts/lp-brother-dcp1510): `scripts/lp-brother-dcp1510`
- **CUPS queue**

### Scan workflow

- **Scanner API**
- [Saved scans](https://github.com/dmikushin/printing_kiosk/tree/master/data): `data`

### Persistence

- [Print records](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/models.py): `simple_print_server/models.py`
- [Database session](https://github.com/dmikushin/printing_kiosk/blob/master/simple_print_server/database.py): `simple_print_server/database.py`
- [SQLite database](https://github.com/dmikushin/printing_kiosk/blob/master/data/sqlite.db): `data/sqlite.db`

### Other components

- **Kiosk user**

## Connections

- Kiosk user → Flask routes: submits requests
- Flask routes → Print page: renders
- Flask routes → Scanner page: renders
- Flask routes → Page-range parser: parses ranges
- Flask routes → PDF utilities: counts and extracts
- Flask routes → App configuration: reads settings
- Flask routes → Print command: launches command
- Print command → CUPS queue: queues job
- Flask routes → Print records: creates record
- Flask routes → Database session: adds and commits
- Database session → SQLite database: reads and writes
- Flask routes → Scanner API: starts, polls, fetches
- Scanner API → Flask routes: returns scan data
- Flask routes → Saved scans: saves and serves
