How daytonhaney/cleaners-app works
What this project is (type + purpose)
Cleaners App is a single-node, console-based Python application (not a web app) for a cleaning business to:
• register customers,
• process cleaning transactions (packages, square footage, discounts),
• store/retrieve data from a local SQLite database,
• produce daily summaries and exports (likely PDF),
• run with a Rich TUI/CLI experience.
It’s packaged to run locally or inside a container (Dockerfile / podman usage). The architecture is therefore best represented as a modular monolith: one process, multiple internal modules, one embedded database file.
How the file tree maps to architectural components
From the tree:
Entrypoints / runtime
• main.py (top-level) and cleaners/main.py: likely the main entrypoint(s).
• cleaners/cli.py, cleaners/rich_ui.py: user interaction layer.
• cleaners/clean.py: business operations around “cleaning packages” / pricing / labor.
• cleaners/validation.py: input/data validation boundary.
• cleaners/db_stats.py: reporting/summary computations (daily stats).
• cleaners/pdf_export.py: export boundary (PDF output).
• cleaners/fake_data.py: seed/demo data generation.
• examples/demo.py: usage example / demo run.
• test_system.py: end-to-end/system tests.
Data access / persistence
• db/db_functions.py: SQLite CRUD/data access layer.
• db/__init__.py: package.
• README says SQLite file business_data.db with auto creation/backup.
• backup.sh and install.sh: operational scripts (backup/install).
• Dockerfile: container packaging and runtime environment.
• cleaners-app.1: man page (distribution/documentation artifact).
Configuration / packaging
• pyproject.toml, requirements.txt: Python packaging and dependencies.
Takeaway for diagramming: the clean separation is UI (Rich/CLI) → Domain services (pricing/transactions/summary) → Persistence (SQLite via db_functions) plus export/reporting/ops side components.
What to extract from README (architecture hints)
The README explicitly tells you the “system context” and primary flows:
• Interactive console interface (so your “client” is a terminal user).
• Core domain: customer registration + transaction processing.
• Pricing rules: three packages, labor calculation per square foot, senior discount.
• SQLite DB with automatic creation and backup.
• Rich text UI.
System Context (Level 0 / C4 Context)
Show:
• Actor: “Office Staff / Operator (Terminal User)”
• System: “Cleaners App (Python console application)”
• External dependencies:
• “SQLite database file (business_data.db)”
• “Filesystem (backups, PDF exports)”
Optionally:
• “Container runtime (Podman/Docker)” as an environment boundary.
Container / Process View (Level 1)
Even though it’s one process, treat these as “logical containers”:
• “Console UI (Rich)” (cleaners/rich_ui.py + cli.py)
• “Application/Domain layer” (clean.py, validation.py, db_stats.py)
• “Persistence layer” (db/db_functions.py)
• “Export/Reporting” (pdf_export.py, fig.py)
• “SQLite DB file”
Component View (Level 2)
Break the domain into components aligned to modules/files:
• Transaction processing / package pricing (clean.py)
• Validation (validation.py)
• Summaries/Stats (db_stats.py)
• PDF Export (pdf_export.py)
• Data access gateway (db_functions.py)
• UI orchestrator (cli.py + rich_ui.py)
• App entry/orchestration (cleaners/main.py or top-level main.py)
This level is where you “separate into as many components as possible”.
Backup flow
• Terminal User / Ops → backup.sh → Filesystem (copy business_data.db to backup location)
or
• App → “Backup routine” (if implemented in Python) → Filesystem
Architectural patterns/design principles visibly present
• Layered architecture: UI → Domain → Persistence.
• Repository/DAO style DB gateway: db/db_functions.py as the boundary to SQLite.
• Rule-based pricing engine (simple): package selection + labor + senior discount.
• Single-process monolith with module boundaries (important to show that it is *not* networked).
• “Python 3.11”
• “Rich (TUI)”
• “SQLite (business_data.db)”
• “Container: Podman/Docker (optional runtime)”