# aperisic85/reportflow architecture

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

- Interactive diagram: https://gitdiagram.com/aperisic85/reportflow
- Repository: https://github.com/aperisic85/reportflow

## Overview

ReportFlow supports four departments in preparing monthly plans and reports, submitting department documents, and assembling director-level revisions for Word/PDF export. The browser UI uses a shared API client to reach the Rust service; the README documents PostgreSQL persistence and the separate Python renderer. The graph preserves the documented workflow and sampled UI features, including activity history, discussion, and carry-forward planning. Backend internals are only partially excerpted, so their finer-grained relationships are not inferred.

Main entry points: [`frontend/src/api.ts`](https://github.com/aperisic85/reportflow/blob/master/frontend/src/api.ts) (API client), [`backend/src/main.rs`](https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs) (Rust API), [`frontend/src/main.tsx`](https://github.com/aperisic85/reportflow/blob/master/frontend/src/main.tsx) (Application shell), [`frontend/src/Dashboard.tsx`](https://github.com/aperisic85/reportflow/blob/master/frontend/src/Dashboard.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Browser application"]
  node_app["Application shell<br/>[main.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_monthly["Monthly entry<br/>[MonthlyEntry.tsx]"]
  node_carry["Carry planner<br/>[CarryPlanner.tsx]"]
  node_activity_editor["Activity editor"]
  node_history["History search<br/>[HistorySearch.tsx]"]
  node_conversation["Activity discussion"]
  node_inbox["Discussion inbox<br/>[Inbox.tsx]"]
  node_report_preview["Report previews<br/>[ReportPreview.tsx]"]
end

subgraph group_workflow["Report workflow"]
  node_rust_api["Rust API<br/>[main.rs]"]
  node_activity_registry["Activity registry<br/>[main.rs]"]
  node_monthly_records["Monthly records<br/>[main.rs]"]
  node_department_reports["Department submissions<br/>[main.rs]"]
  node_sector_revisions["Sector revisions<br/>[main.rs]"]
end

subgraph group_storage["Persistent data"]
  node_postgres[("PostgreSQL")]
end

subgraph group_documents["Document generation"]
  node_renderer["DOCX/PDF renderer<br/>[app.py]"]
  node_template["Official Word template<br/>[plovput-clean.docx]"]
end

node_staff(("Department staff"))
node_director(("Sector director"))

node_staff -->|"uses"| node_app
node_director -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_monthly
node_app -->|"renders"| node_carry
node_dashboard -->|"queries"| node_api_client
node_monthly -->|"submits via"| node_api_client
node_carry -->|"requests via"| node_api_client
node_activity_editor -->|"updates via"| node_api_client
node_history -->|"searches via"| node_api_client
node_conversation -->|"collaborates via"| node_api_client
node_inbox -->|"loads via"| node_api_client
node_app -->|"requests via"| node_api_client
node_api_client -->|"calls"| node_rust_api
node_rust_api -->|"reads and writes"| node_postgres
node_rust_api -->|"requests exports"| node_renderer
node_renderer -->|"renders from"| node_template
node_rust_api -->|"manages"| node_activity_registry
node_rust_api -->|"stores"| node_monthly_records
node_rust_api -->|"handles"| node_department_reports
node_rust_api -->|"creates and locks"| node_sector_revisions

click node_app "https://github.com/aperisic85/reportflow/blob/master/frontend/src/main.tsx"
click node_api_client "https://github.com/aperisic85/reportflow/blob/master/frontend/src/api.ts"
click node_dashboard "https://github.com/aperisic85/reportflow/blob/master/frontend/src/Dashboard.tsx"
click node_monthly "https://github.com/aperisic85/reportflow/blob/master/frontend/src/MonthlyEntry.tsx"
click node_carry "https://github.com/aperisic85/reportflow/blob/master/frontend/src/CarryPlanner.tsx"
click node_activity_editor "https://github.com/aperisic85/reportflow/blob/master/frontend/src/ActivityDetailsEditor.tsx"
click node_history "https://github.com/aperisic85/reportflow/blob/master/frontend/src/HistorySearch.tsx"
click node_conversation "https://github.com/aperisic85/reportflow/blob/master/frontend/src/ActivityConversation.tsx"
click node_inbox "https://github.com/aperisic85/reportflow/blob/master/frontend/src/Inbox.tsx"
click node_report_preview "https://github.com/aperisic85/reportflow/blob/master/frontend/src/ReportPreview.tsx"
click node_rust_api "https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs"
click node_activity_registry "https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs"
click node_monthly_records "https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs"
click node_department_reports "https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs"
click node_sector_revisions "https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs"
click node_renderer "https://github.com/aperisic85/reportflow/blob/master/document-service/app.py"
click node_template "https://github.com/aperisic85/reportflow/blob/master/document-service/templates/plovput-clean.docx"

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_app,node_api_client,node_dashboard,node_monthly,node_carry,node_activity_editor,node_history,node_conversation,node_inbox,node_report_preview toneBlue
class node_rust_api,node_activity_registry,node_monthly_records,node_department_reports,node_sector_revisions toneAmber
class node_postgres toneMint
class node_renderer,node_template toneRose
class node_staff,node_director toneIndigo
```

## Components

### Browser application

- [Application shell](https://github.com/aperisic85/reportflow/blob/master/frontend/src/main.tsx): `frontend/src/main.tsx`
- [API client](https://github.com/aperisic85/reportflow/blob/master/frontend/src/api.ts): `frontend/src/api.ts`
- [Dashboard](https://github.com/aperisic85/reportflow/blob/master/frontend/src/Dashboard.tsx): `frontend/src/Dashboard.tsx`
- [Monthly entry](https://github.com/aperisic85/reportflow/blob/master/frontend/src/MonthlyEntry.tsx): `frontend/src/MonthlyEntry.tsx`
- [Carry planner](https://github.com/aperisic85/reportflow/blob/master/frontend/src/CarryPlanner.tsx): `frontend/src/CarryPlanner.tsx`
- [Activity editor](https://github.com/aperisic85/reportflow/blob/master/frontend/src/ActivityDetailsEditor.tsx): `frontend/src/ActivityDetailsEditor.tsx`
- [History search](https://github.com/aperisic85/reportflow/blob/master/frontend/src/HistorySearch.tsx): `frontend/src/HistorySearch.tsx`
- [Activity discussion](https://github.com/aperisic85/reportflow/blob/master/frontend/src/ActivityConversation.tsx): `frontend/src/ActivityConversation.tsx`
- [Discussion inbox](https://github.com/aperisic85/reportflow/blob/master/frontend/src/Inbox.tsx): `frontend/src/Inbox.tsx`
- [Report previews](https://github.com/aperisic85/reportflow/blob/master/frontend/src/ReportPreview.tsx): `frontend/src/ReportPreview.tsx`

### Report workflow

- [Rust API](https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs): `backend/src/main.rs`
- [Activity registry](https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs): `backend/src/main.rs`
- [Monthly records](https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs): `backend/src/main.rs`
- [Department submissions](https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs): `backend/src/main.rs`
- [Sector revisions](https://github.com/aperisic85/reportflow/blob/master/backend/src/main.rs): `backend/src/main.rs`

### Persistent data

- **PostgreSQL**

### Document generation

- [DOCX/PDF renderer](https://github.com/aperisic85/reportflow/blob/master/document-service/app.py): `document-service/app.py`
- [Official Word template](https://github.com/aperisic85/reportflow/blob/master/document-service/templates/plovput-clean.docx): `document-service/templates/plovput-clean.docx`

### Other components

- **Department staff**
- **Sector director**

## Connections

- Department staff → Application shell: uses (evidence: `README.md`)
- Sector director → Application shell: uses (evidence: `README.md`)
- Application shell → Dashboard: renders (evidence: `frontend/src/main.tsx`)
- Application shell → Monthly entry: renders (evidence: `frontend/src/main.tsx`)
- Application shell → Carry planner: renders (evidence: `frontend/src/main.tsx`)
- Dashboard → API client: queries (evidence: `frontend/src/Dashboard.tsx`)
- Monthly entry → API client: submits via (evidence: `frontend/src/api.ts`)
- Carry planner → API client: requests via (evidence: `frontend/src/CarryPlanner.tsx`)
- Activity editor → API client: updates via (evidence: `frontend/src/ActivityDetailsEditor.tsx`)
- History search → API client: searches via (evidence: `frontend/src/HistorySearch.tsx`)
- Activity discussion → API client: collaborates via (evidence: `frontend/src/ActivityConversation.tsx`)
- Discussion inbox → API client: loads via (evidence: `frontend/src/Inbox.tsx`)
- Application shell → API client: requests via (evidence: `frontend/src/api.ts`)
- API client → Rust API: calls (evidence: `README.md`)
- Rust API → PostgreSQL: reads and writes (evidence: `README.md`)
- Rust API → DOCX/PDF renderer: requests exports (evidence: `README.md`)
- DOCX/PDF renderer → Official Word template: renders from (evidence: `README.md`)
- Rust API → Activity registry: manages (evidence: `backend/src/main.rs`)
- Rust API → Monthly records: stores (evidence: `backend/src/main.rs`)
- Rust API → Department submissions: handles (evidence: `README.md`)
- Rust API → Sector revisions: creates and locks (evidence: `README.md`)
