# ramprasathm-2005/autonomous-printer architecture

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

- Interactive diagram: https://gitdiagram.com/ramprasathm-2005/autonomous-printer
- Repository: https://github.com/ramprasathm-2005/autonomous-printer

## Overview

Achuppori is a self-service printing platform: users upload documents, configure and validate print jobs, pay, then release jobs at a station with an OTP. FastAPI is the decision-making backend; a separate Flask print agent coordinates local files and CUPS. The README describes the full payment-to-print workflow, but the supplied excerpts do not show all order, payment, or agent-polling internals, so those links are marked unverified where appropriate.

Main entry points: [`backend/app/main.py`](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/api/routes/agent.py`](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/agent.py) (Agent endpoints), [`backend/app/api/routes/documents.py`](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/documents.py) (Document endpoints), [`backend/app/api/routes/orders.py`](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/orders.py) (Order endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and station"]
  node_flutter["Flutter web client<br/>[payment_bridge.js]"]
  node_station["Kiosk interface<br/>[kiosk.py]"]
end

subgraph group_backend["Backend API"]
  node_api["FastAPI app<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_documents["Document endpoints<br/>[documents.py]"]
  node_orders["Order endpoints<br/>[orders.py]"]
  node_payments["Payment endpoints<br/>[payments.py]"]
  node_agent_api["Agent endpoints<br/>[agent.py]"]
  node_admin["Administration<br/>[admin_service.py]"]
end

subgraph group_domain["Print workflows"]
  node_doc_service["Document processing"]
  node_storage_service["Storage service<br/>[storage_service.py]"]
  node_pricing["Pricing service<br/>[pricing_service.py]"]
  node_order_service["Order and job service<br/>[order_service.py]"]
  node_otp["OTP service<br/>[otp_service.py]"]
  node_refund["Refund service<br/>[refund_service.py]"]
end

subgraph group_data["Persistence"]
  node_database[("Relational database<br/>[database.py]")]
  node_filesystem[("Document filesystem<br/>[storage_service.py]")]
end

subgraph group_agent["Print agent"]
  node_agent_app["Flask agent<br/>[main.py]"]
  node_poller["Job poller<br/>[job_poller.py]"]
  node_print_service["Print service<br/>[print_service.py]"]
  node_cups["CUPS<br/>[cups_service.py]"]
end

node_user(("Print customer"))
node_razorpay["Razorpay"]
node_printer["Physical printer"]

node_user -->|"uses"| node_flutter
node_flutter -.->|"requests"| node_api
node_api -->|"registers routes"| node_auth
node_api -->|"registers routes"| node_documents
node_api -->|"registers routes"| node_orders
node_api -->|"registers routes"| node_payments
node_api -->|"registers routes"| node_agent_api
node_documents -->|"delegates to"| node_doc_service
node_documents -->|"uses"| node_storage_service
node_documents -->|"reads and writes"| node_database
node_storage_service -->|"stores files"| node_filesystem
node_orders -.->|"delegates to"| node_order_service
node_order_service -.->|"calculates price"| node_pricing
node_payments -.->|"verifies payment"| node_razorpay
node_orders -.->|"continues to payment"| node_payments
node_agent_api -->|"verifies release OTP"| node_otp
node_agent_api -->|"dispatches job work"| node_order_service
node_agent_api -->|"reads job records"| node_database
node_user -->|"enters release OTP"| node_station
node_agent_app -->|"starts"| node_poller
node_agent_app -->|"registers kiosk routes"| node_station
node_poller -.->|"polls for jobs"| node_agent_api
node_print_service -->|"submits print job"| node_cups
node_cups -->|"controls printing"| node_printer
node_admin -->|"queries operations data"| node_database
node_orders -.->|"requests refund"| node_refund

click node_flutter "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/frontend/web/payment_bridge.js"
click node_station "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/routes/kiosk.py"
click node_api "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/main.py"
click node_auth "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/auth.py"
click node_documents "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/documents.py"
click node_orders "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/orders.py"
click node_payments "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/payments.py"
click node_agent_api "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/agent.py"
click node_admin "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/admin_service.py"
click node_doc_service "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/document_service.py"
click node_storage_service "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/storage_service.py"
click node_pricing "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/pricing_service.py"
click node_order_service "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/order_service.py"
click node_otp "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/otp_service.py"
click node_refund "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/refund_service.py"
click node_database "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/config/database.py"
click node_filesystem "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/storage_service.py"
click node_agent_app "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/main.py"
click node_poller "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/services/job_poller.py"
click node_print_service "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/services/print_service.py"
click node_cups "https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/services/cups_service.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_flutter,node_station toneBlue
class node_api,node_auth,node_documents,node_orders,node_payments,node_agent_api,node_admin toneAmber
class node_doc_service,node_storage_service,node_pricing,node_order_service,node_otp,node_refund toneMint
class node_database,node_filesystem toneRose
class node_agent_app,node_poller,node_print_service,node_cups,node_user,node_razorpay,node_printer toneIndigo
```

## Components

### Client and station

- [Flutter web client](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/frontend/web/payment_bridge.js): `frontend/web/payment_bridge.js`
- [Kiosk interface](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/routes/kiosk.py): `print-agent/app/routes/kiosk.py`

### Backend API

- [FastAPI app](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Document endpoints](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/documents.py): `backend/app/api/routes/documents.py`
- [Order endpoints](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/orders.py): `backend/app/api/routes/orders.py`
- [Payment endpoints](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/payments.py): `backend/app/api/routes/payments.py`
- [Agent endpoints](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/api/routes/agent.py): `backend/app/api/routes/agent.py`
- [Administration](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/admin_service.py): `backend/app/services/admin_service.py`

### Print workflows

- [Document processing](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/document_service.py): `backend/app/services/document_service.py`
- [Storage service](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/storage_service.py): `backend/app/services/storage_service.py`
- [Pricing service](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/pricing_service.py): `backend/app/services/pricing_service.py`
- [Order and job service](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/order_service.py): `backend/app/services/order_service.py`
- [OTP service](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/otp_service.py): `backend/app/services/otp_service.py`
- [Refund service](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/refund_service.py): `backend/app/services/refund_service.py`

### Persistence

- [Relational database](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/config/database.py): `backend/app/config/database.py`
- [Document filesystem](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/backend/app/services/storage_service.py): `backend/app/services/storage_service.py`

### Print agent

- [Flask agent](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/main.py): `print-agent/app/main.py`
- [Job poller](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/services/job_poller.py): `print-agent/app/services/job_poller.py`
- [Print service](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/services/print_service.py): `print-agent/app/services/print_service.py`
- [CUPS](https://github.com/ramprasathm-2005/autonomous-printer/blob/main/print-agent/app/services/cups_service.py): `print-agent/app/services/cups_service.py`

### Other components

- **Print customer**
- **Razorpay**
- **Physical printer**

## Connections

- Print customer → Flutter web client: uses
- Flutter web client → FastAPI app: requests
- FastAPI app → Authentication: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Document endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Order endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Payment endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Agent endpoints: registers routes (evidence: `backend/app/main.py`)
- Document endpoints → Document processing: delegates to (evidence: `backend/app/api/routes/documents.py`)
- Document endpoints → Storage service: uses (evidence: `backend/app/api/routes/documents.py`)
- Document endpoints → Relational database: reads and writes (evidence: `backend/app/api/routes/documents.py`)
- Storage service → Document filesystem: stores files (evidence: `backend/app/services/storage_service.py`)
- Order endpoints → Order and job service: delegates to
- Order and job service → Pricing service: calculates price
- Payment endpoints → Razorpay: verifies payment
- Order endpoints → Payment endpoints: continues to payment
- Agent endpoints → OTP service: verifies release OTP (evidence: `backend/app/api/routes/agent.py`)
- Agent endpoints → Order and job service: dispatches job work (evidence: `backend/app/api/routes/agent.py`)
- Agent endpoints → Relational database: reads job records (evidence: `backend/app/api/routes/agent.py`)
- Print customer → Kiosk interface: enters release OTP
- Flask agent → Job poller: starts (evidence: `print-agent/app/main.py`)
- Flask agent → Kiosk interface: registers kiosk routes (evidence: `print-agent/app/main.py`)
- Job poller → Agent endpoints: polls for jobs
- Print service → CUPS: submits print job (evidence: `print-agent/app/services/print_service.py`)
- CUPS → Physical printer: controls printing
- Administration → Relational database: queries operations data (evidence: `backend/app/services/admin_service.py`)
- Order endpoints → Refund service: requests refund
