Skip to content

C4 Level 3 — Core API Components

The internal architecture of the Core API, following the IDesign 4-layer pattern.

C4 Level 3 — Core API Components

IDesign Layer Details

Clients Layer

The Accounting API no longer handles chat or webhook input directly. Channels (Slack, Teams, Web, Email) connect to the Conversation Agent, which manages multi-turn context, clarification, and language detection. The Conversation Agent calls the Accounting API via POST /solve.

Component Triggers Responsibility
SolveController POST /solve from Conversation Agent Receive a single task (classified, with context), route to TaskManager
SchedulerController Cron (daily/weekly) Trigger MonitorManager for compliance checks
DashboardController Web UI requests Serve audit trail, analytics, config CRUD

Managers Layer

Component Orchestrates Responsibility
TaskManager ClassifyEngine → AgentManager Route user request to correct workflow
AgentManager LLMAccessor + AccountingProvider Run LLM agent loop with function-calling (max 15 turns)
MonitorManager RulesEngine + ComplianceEngine Daily checks: overdue bills, expense violations, month-end
AuditManager DataAccessor Log every action, support undo/reverse

Engines Layer (pure logic, no I/O)

Component Input Output
RulesEngine expense/invoice + company rules PASS / VIOLATION + reason
ClassifyEngine user message task_type (regex fast-path or LLM)
AmountEngine gross/net/vat_rate Calculated amounts, currency conversion
ComplianceEngine ledger data + month/year Checklist status, missing items

Resource Access Layer

Component External System Handles
IAccountingProvider Tripletex / Fiken Provider interface for all accounting operations
TripletexProvider Tripletex API v2 Auth, caching, rate limiting. Implements IAccountingProvider
FikenProvider Fiken API v2 OAuth2, rate limiting. Implements IAccountingProvider
LLMAccessor Gemini / Claude Function-calling interface, retry, fallback
DataAccessor D1 / Supabase Audit trail, company config, rules
NotificationAccessor Slack, Teams, Email Send alerts, chat responses
FileAccessor Local + OCR PDF text extraction, image OCR