# viniciuscasagrande-creator/keeper architecture

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

- Interactive diagram: https://gitdiagram.com/viniciuscasagrande-creator/keeper
- Repository: https://github.com/viniciuscasagrande-creator/keeper

## Overview

Keeper is a multi-tenant ERP exposed through a React executive interface and a NestJS API. Users navigate the dashboard or finance/accounting views, which use the web API client to reach business endpoints; finance and accounting services perform operational and ledger work. Core services provide identity, tenant/company governance, permissions, audit, and workflow, while the worker relays pending outbox events. The README documents additional business domains and declarative rules whose implementations were not sampled; those are represented without speculative call edges.

Main entry points: [`apps/web/src/App.tsx`](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/App.tsx) (Executive shell), [`apps/api/src/common/prisma/prisma.service.ts`](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/common/prisma/prisma.service.ts) (Prisma database), [`apps/web/src/services/api.ts`](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/services/api.ts) (API client), [`apps/web/src/components/dashboard`](https://github.com/viniciuscasagrande-creator/keeper/tree/test-gh-push/apps/web/src/components/dashboard) (Dashboard widgets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_webapp["Executive shell<br/>[App.tsx]"]
  node_dash["Dashboard widgets"]
  node_quick["Quick entry"]
  node_approvals["Approvals"]
  node_financialview["Finance view"]
  node_accountingview["Accounting view"]
  node_webapi["API client<br/>[api.ts]"]
end

subgraph group_platform["Core platform"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_tenantcompany["Tenant and company admin"]
  node_governance["Permissions and audit"]
  node_workflow["Workflow engine"]
  node_rules["Declarative rules<br/>[rule-evaluator.ts]"]
end

subgraph group_operations["Business operations"]
  node_financeapi["Finance endpoints"]
  node_financesvc["Finance operations"]
  node_accountingapi["Accounting endpoints"]
  node_accountingsvc["Ledger operations"]
  node_otherdomains["Other ERP domains"]
end

subgraph group_events["Event processing"]
  node_database[("Prisma database<br/>[prisma.service.ts]")]
  node_outbox["Outbox relay"]
  node_eventcatalog["Domain event contracts<br/>[domain-event.ts]"]
end

node_user(("ERP user"))

node_user -->|"uses"| node_webapp
node_webapp -->|"renders"| node_dash
node_webapp -->|"opens"| node_quick
node_webapp -->|"opens"| node_approvals
node_webapp -->|"selects"| node_financialview
node_webapp -->|"selects"| node_accountingview
node_dash -->|"requests data"| node_webapi
node_quick -->|"submits entries"| node_webapi
node_financialview -->|"requests finance"| node_webapi
node_webapi -.->|"calls REST"| node_financeapi
node_webapi -.->|"calls REST"| node_accountingapi
node_financeapi -->|"delegates"| node_financesvc
node_accountingapi -->|"delegates"| node_accountingsvc
node_financesvc -.->|"persists data"| node_database
node_accountingsvc -->|"reads and writes"| node_database
node_auth -->|"checks users"| node_database
node_tenantcompany -.->|"manages records"| node_database
node_workflow -.->|"stores workflows"| node_database
node_outbox -->|"polls and updates"| node_database
node_eventcatalog -.->|"defines events"| node_outbox

click node_webapp "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/App.tsx"
click node_dash "https://github.com/viniciuscasagrande-creator/keeper/tree/test-gh-push/apps/web/src/components/dashboard"
click node_quick "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/drawers/QuickEntryDrawer.tsx"
click node_approvals "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/drawers/ApprovalsDrawer.tsx"
click node_financialview "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/modules/FinancialModuleView.tsx"
click node_accountingview "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/modules/AccountingModuleView.tsx"
click node_webapi "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/services/api.ts"
click node_auth "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/core/auth/auth.service.ts"
click node_tenantcompany "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/core/companies/companies.service.ts"
click node_governance "https://github.com/viniciuscasagrande-creator/keeper/tree/test-gh-push/apps/api/src/core/permissions"
click node_workflow "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/core/workflow/workflow.service.ts"
click node_rules "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/packages/rules/src/rule-evaluator.ts"
click node_financeapi "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/financeiro/financeiro.controller.ts"
click node_financesvc "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/financeiro/financeiro.service.ts"
click node_accountingapi "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/contabil/contabil.controller.ts"
click node_accountingsvc "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/contabil/contabil.service.ts"
click node_otherdomains "https://github.com/viniciuscasagrande-creator/keeper/tree/test-gh-push/apps/api/src"
click node_database "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/common/prisma/prisma.service.ts"
click node_outbox "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/worker/src/outbox/outbox-relay.service.ts"
click node_eventcatalog "https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/packages/events/src/domain-event.ts"

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_webapp,node_dash,node_quick,node_approvals,node_financialview,node_accountingview,node_webapi,node_user toneBlue
class node_auth,node_tenantcompany,node_governance,node_workflow,node_rules toneAmber
class node_financeapi,node_financesvc,node_accountingapi,node_accountingsvc,node_otherdomains toneMint
class node_database,node_outbox,node_eventcatalog toneRose
```

## Components

### Web experience

- [Executive shell](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Dashboard widgets](https://github.com/viniciuscasagrande-creator/keeper/tree/test-gh-push/apps/web/src/components/dashboard): `apps/web/src/components/dashboard`
- [Quick entry](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/drawers/QuickEntryDrawer.tsx): `apps/web/src/components/drawers/QuickEntryDrawer.tsx`
- [Approvals](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/drawers/ApprovalsDrawer.tsx): `apps/web/src/components/drawers/ApprovalsDrawer.tsx`
- [Finance view](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/modules/FinancialModuleView.tsx): `apps/web/src/components/modules/FinancialModuleView.tsx`
- [Accounting view](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/components/modules/AccountingModuleView.tsx): `apps/web/src/components/modules/AccountingModuleView.tsx`
- [API client](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/web/src/services/api.ts): `apps/web/src/services/api.ts`

### Core platform

- [Authentication](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/core/auth/auth.service.ts): `apps/api/src/core/auth/auth.service.ts`
- [Tenant and company admin](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/core/companies/companies.service.ts): `apps/api/src/core/companies/companies.service.ts`
- [Permissions and audit](https://github.com/viniciuscasagrande-creator/keeper/tree/test-gh-push/apps/api/src/core/permissions): `apps/api/src/core/permissions`
- [Workflow engine](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/core/workflow/workflow.service.ts): `apps/api/src/core/workflow/workflow.service.ts`
- [Declarative rules](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/packages/rules/src/rule-evaluator.ts): `packages/rules/src/rule-evaluator.ts`

### Business operations

- [Finance endpoints](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/financeiro/financeiro.controller.ts): `apps/api/src/financeiro/financeiro.controller.ts`
- [Finance operations](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/financeiro/financeiro.service.ts): `apps/api/src/financeiro/financeiro.service.ts`
- [Accounting endpoints](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/contabil/contabil.controller.ts): `apps/api/src/contabil/contabil.controller.ts`
- [Ledger operations](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/contabil/contabil.service.ts): `apps/api/src/contabil/contabil.service.ts`
- [Other ERP domains](https://github.com/viniciuscasagrande-creator/keeper/tree/test-gh-push/apps/api/src): `apps/api/src`

### Event processing

- [Prisma database](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/api/src/common/prisma/prisma.service.ts): `apps/api/src/common/prisma/prisma.service.ts`
- [Outbox relay](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/apps/worker/src/outbox/outbox-relay.service.ts): `apps/worker/src/outbox/outbox-relay.service.ts`
- [Domain event contracts](https://github.com/viniciuscasagrande-creator/keeper/blob/test-gh-push/packages/events/src/domain-event.ts): `packages/events/src/domain-event.ts`

### Other components

- **ERP user**

## Connections

- ERP user → Executive shell: uses (evidence: `README.md`)
- Executive shell → Dashboard widgets: renders (evidence: `apps/web/src/App.tsx`)
- Executive shell → Quick entry: opens (evidence: `apps/web/src/App.tsx`)
- Executive shell → Approvals: opens (evidence: `apps/web/src/App.tsx`)
- Executive shell → Finance view: selects (evidence: `apps/web/src/App.tsx`)
- Executive shell → Accounting view: selects (evidence: `apps/web/src/App.tsx`)
- Dashboard widgets → API client: requests data (evidence: `apps/web/src/components/dashboard/RecentMovementsTable.tsx`)
- Quick entry → API client: submits entries (evidence: `apps/web/src/components/drawers/QuickEntryDrawer.tsx`)
- Finance view → API client: requests finance (evidence: `apps/web/src/components/modules/FinancialModuleView.tsx`)
- API client → Finance endpoints: calls REST (evidence: `README.md`)
- API client → Accounting endpoints: calls REST (evidence: `README.md`)
- Finance endpoints → Finance operations: delegates (evidence: `apps/api/src/financeiro/financeiro.controller.ts`)
- Accounting endpoints → Ledger operations: delegates (evidence: `apps/api/src/contabil/contabil.controller.ts`)
- Finance operations → Prisma database: persists data
- Ledger operations → Prisma database: reads and writes (evidence: `apps/api/src/contabil/contabil.service.ts`)
- Authentication → Prisma database: checks users (evidence: `apps/api/src/core/auth/auth.service.ts`)
- Tenant and company admin → Prisma database: manages records
- Workflow engine → Prisma database: stores workflows
- Outbox relay → Prisma database: polls and updates (evidence: `apps/worker/src/outbox/outbox-relay.service.ts`)
- Domain event contracts → Outbox relay: defines events
