# celeriflow-hub/celeriflow-ibema architecture

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

- Interactive diagram: https://gitdiagram.com/celeriflow-hub/celeriflow-ibema
- Repository: https://github.com/celeriflow-hub/celeriflow-ibema

## Overview

Celeriflow is a Next.js municipal administration platform: the tree exposes domains including procurement, finance, construction, health, education, and public services, while the README provides no product-level workflow description. The graph highlights documented report, tenant, audit, file-storage, and construction-document relationships; domain nodes preserve major areas visible in the tree without asserting unsampled call paths. The central user-to-result flow and several domain internals could not be verified from the available excerpts.

Main entry points: [`src/app/api/construcao-civil/anexos/route.ts`](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/construcao-civil/anexos/route.ts) (Construction attachments API), [`src/app/api/financeiro/relatorios/print/route.ts`](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/financeiro/relatorios/print/route.ts) (Financial print API), [`src/app/api/saude/relatorios/route.ts`](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/saude/relatorios/route.ts) (Health reports API), [`src/lib/platform/tenant-context.ts`](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/tenant-context.ts) (Tenant context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Municipal modules"]
  node_procurement["Procurement"]
  node_education["Education"]
  node_health["Health"]
  node_cemeteries["Cemetery services"]
  node_platform_ui["Application interface"]
  node_health_api["Health reports API<br/>[route.ts]"]
  node_transparency["Transparency services"]
  node_administration["Administration"]
end

subgraph group_platform["Platform services"]
  node_tenant["Tenant context<br/>[tenant-context.ts]"]
  node_database_client["Database client<br/>[prisma.ts]"]
  node_blob["Blob storage service<br/>[blob.ts]"]
  node_audit_evidence["Audit evidence<br/>[audit-evidence.ts]"]
  node_audit_query_service["Audit query service"]
  node_audit_query["Audit query builder<br/>[audit-query.ts]"]
  node_reports["Report engine<br/>[report-engine.ts]"]
  node_audit_query_reader["Audit event reader"]
end

subgraph group_finance["Finance and reports"]
  node_finance_api["Financial print API<br/>[route.ts]"]
  node_finance_core["Financial operations<br/>[index.ts]"]
  node_classification["Bank classification"]
  node_planning["Financial planning<br/>[planejamento.ts]"]
  node_legal_reports["Legal reports"]
  node_report_print["Report printing<br/>[report-print.ts]"]
end

subgraph group_construction["Construction services"]
  node_construction_review["Construction review UI"]
  node_review_actions["Construction review actions<br/>[review-actions.ts]"]
  node_construction_api["Construction attachments API<br/>[route.ts]"]
  node_construction_storage["Construction document storage"]
  node_construction_documents["Construction document service"]
  node_construction_lifecycle["Construction lifecycle"]
  node_construction_policy["Construction policy"]
  node_construction_access["Construction access"]
  node_construction_stamp["Project stamp"]
  node_construction_docs_service["Construction documents service"]
end

node_user(("Municipal user"))

node_user -.->|"uses"| node_platform_ui
node_health_api -->|"authorizes"| node_tenant
node_health_api -->|"uses"| node_reports
node_health_api -->|"uses"| node_audit_evidence
node_tenant -->|"uses"| node_database_client
node_audit_query_service -->|"uses"| node_audit_query
node_finance_api -->|"uses"| node_tenant
node_finance_api -->|"uses"| node_report_print
node_finance_api -->|"uses"| node_legal_reports
node_finance_api -->|"uses"| node_planning
node_classification -->|"posts transfers"| node_finance_core
node_classification -->|"posts accounting"| node_finance_core
node_construction_review -->|"submits review"| node_review_actions
node_construction_api -->|"uploads file"| node_blob
node_construction_api -->|"stores metadata"| node_database_client
node_construction_storage -->|"stores documents"| node_blob
node_construction_api -->|"downloads documents"| node_construction_documents
node_construction_api -->|"checks publication"| node_construction_stamp
node_construction_api -->|"checks access"| node_construction_access
node_construction_api -->|"checks policy"| node_construction_policy

click node_procurement "https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/compras"
click node_education "https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/educacao"
click node_health "https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/saude"
click node_cemeteries "https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/cemiterios"
click node_platform_ui "https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain"
click node_health_api "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/saude/relatorios/route.ts"
click node_tenant "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/tenant-context.ts"
click node_database_client "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/prisma.ts"
click node_blob "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/blob.ts"
click node_audit_evidence "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-evidence.ts"
click node_audit_query_service "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-query-service.ts"
click node_audit_query "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-query.ts"
click node_reports "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/reports/report-engine.ts"
click node_finance_api "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/financeiro/relatorios/print/route.ts"
click node_finance_core "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/index.ts"
click node_classification "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/classification-engine.ts"
click node_planning "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/planejamento.ts"
click node_legal_reports "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/relatorios-legais.ts"
click node_report_print "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/report-print.ts"
click node_construction_review "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/app-domain/obras/construcao-civil/%5Bid%5D/ConstructionReviewClient.tsx"
click node_review_actions "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/app-domain/obras/construcao-civil/review-actions.ts"
click node_construction_api "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/construcao-civil/anexos/route.ts"
click node_construction_storage "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-document-storage.ts"
click node_construction_documents "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-documents-service.ts"
click node_construction_lifecycle "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-lifecycle.ts"
click node_construction_policy "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-policy.ts"
click node_construction_access "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-access.ts"
click node_construction_stamp "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-project-stamp.ts"
click node_construction_docs_service "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-documents-service.ts"
click node_audit_query_reader "https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-query-service.ts"
click node_transparency "https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/api/transparencia"
click node_administration "https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/administracao"

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_procurement,node_education,node_health,node_cemeteries,node_platform_ui,node_health_api,node_transparency,node_administration,node_user toneBlue
class node_tenant,node_database_client,node_blob,node_audit_evidence,node_audit_query_service,node_audit_query,node_reports,node_audit_query_reader toneAmber
class node_finance_api,node_finance_core,node_classification,node_planning,node_legal_reports,node_report_print toneMint
class node_construction_review,node_review_actions,node_construction_api,node_construction_storage,node_construction_documents,node_construction_lifecycle,node_construction_policy,node_construction_access,node_construction_stamp,node_construction_docs_service toneRose
```

## Components

### Municipal modules

- [Procurement](https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/compras): `src/app/app-domain/compras`
- [Education](https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/educacao): `src/app/app-domain/educacao`
- [Health](https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/saude): `src/app/app-domain/saude`
- [Cemetery services](https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/cemiterios): `src/app/app-domain/cemiterios`
- [Application interface](https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain): `src/app/app-domain`
- [Health reports API](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/saude/relatorios/route.ts): `src/app/api/saude/relatorios/route.ts`
- [Transparency services](https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/api/transparencia): `src/app/api/transparencia`
- [Administration](https://github.com/celeriflow-hub/celeriflow-ibema/tree/main/src/app/app-domain/administracao): `src/app/app-domain/administracao`

### Platform services

- [Tenant context](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/tenant-context.ts): `src/lib/platform/tenant-context.ts`
- [Database client](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Blob storage service](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/blob.ts): `src/lib/platform/blob.ts`
- [Audit evidence](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-evidence.ts): `src/lib/platform/audit-evidence.ts`
- [Audit query service](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-query-service.ts): `src/lib/platform/audit-query-service.ts`
- [Audit query builder](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-query.ts): `src/lib/platform/audit-query.ts`
- [Report engine](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/reports/report-engine.ts): `src/lib/reports/report-engine.ts`
- [Audit event reader](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/platform/audit-query-service.ts): `src/lib/platform/audit-query-service.ts`

### Finance and reports

- [Financial print API](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/financeiro/relatorios/print/route.ts): `src/app/api/financeiro/relatorios/print/route.ts`
- [Financial operations](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/index.ts): `src/lib/financeiro/index.ts`
- [Bank classification](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/classification-engine.ts): `src/lib/financeiro/classification-engine.ts`
- [Financial planning](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/planejamento.ts): `src/lib/financeiro/planejamento.ts`
- [Legal reports](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/relatorios-legais.ts): `src/lib/financeiro/relatorios-legais.ts`
- [Report printing](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/financeiro/report-print.ts): `src/lib/financeiro/report-print.ts`

### Construction services

- [Construction review UI](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/app-domain/obras/construcao-civil/%5Bid%5D/ConstructionReviewClient.tsx): `src/app/app-domain/obras/construcao-civil/[id]/ConstructionReviewClient.tsx`
- [Construction review actions](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/app-domain/obras/construcao-civil/review-actions.ts): `src/app/app-domain/obras/construcao-civil/review-actions.ts`
- [Construction attachments API](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/app/api/construcao-civil/anexos/route.ts): `src/app/api/construcao-civil/anexos/route.ts`
- [Construction document storage](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-document-storage.ts): `src/lib/obras/construction-document-storage.ts`
- [Construction document service](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-documents-service.ts): `src/lib/obras/construction-documents-service.ts`
- [Construction lifecycle](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-lifecycle.ts): `src/lib/obras/construction-lifecycle.ts`
- [Construction policy](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-policy.ts): `src/lib/obras/construction-policy.ts`
- [Construction access](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-access.ts): `src/lib/obras/construction-access.ts`
- [Project stamp](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-project-stamp.ts): `src/lib/obras/construction-project-stamp.ts`
- [Construction documents service](https://github.com/celeriflow-hub/celeriflow-ibema/blob/main/src/lib/obras/construction-documents-service.ts): `src/lib/obras/construction-documents-service.ts`

### Other components

- **Municipal user**

## Connections

- Municipal user → Application interface: uses
- Health reports API → Tenant context: authorizes (evidence: `src/app/api/saude/relatorios/route.ts`)
- Health reports API → Report engine: uses (evidence: `src/app/api/saude/relatorios/route.ts`)
- Health reports API → Audit evidence: uses
- Tenant context → Database client: uses (evidence: `src/lib/platform/tenant-context.ts`)
- Audit query service → Audit query builder: uses (evidence: `src/lib/platform/audit-query-service.ts`)
- Financial print API → Tenant context: uses (evidence: `src/app/api/financeiro/relatorios/print/route.ts`)
- Financial print API → Report printing: uses (evidence: `src/app/api/financeiro/relatorios/print/route.ts`)
- Financial print API → Legal reports: uses (evidence: `src/app/api/financeiro/relatorios/print/route.ts`)
- Financial print API → Financial planning: uses (evidence: `src/app/api/financeiro/relatorios/print/route.ts`)
- Bank classification → Financial operations: posts transfers (evidence: `src/lib/financeiro/classification-engine.ts`)
- Bank classification → Financial operations: posts accounting (evidence: `src/lib/financeiro/classification-engine.ts`)
- Construction review UI → Construction review actions: submits review (evidence: `src/app/app-domain/obras/construcao-civil/[id]/ConstructionReviewClient.tsx`)
- Construction attachments API → Blob storage service: uploads file (evidence: `src/app/api/construcao-civil/anexos/route.ts`)
- Construction attachments API → Database client: stores metadata (evidence: `src/app/api/construcao-civil/anexos/route.ts`)
- Construction document storage → Blob storage service: stores documents (evidence: `src/lib/obras/construction-document-storage.ts`)
- Construction attachments API → Construction document service: downloads documents
- Construction attachments API → Project stamp: checks publication
- Construction attachments API → Construction access: checks access
- Construction attachments API → Construction policy: checks policy
