# dictera/kairos architecture

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

- Interactive diagram: https://gitdiagram.com/dictera/kairos
- Repository: https://github.com/dictera/kairos

## Overview

Kairos is a locally run case-management application for lawyers handling insurance disputes. Lawyers sign in, manage clients and case files, track STK and court stages, hearings and deadlines, then attach documents and financial records or review reports. The README documents these product capabilities; sampled code confirms the upload path, SQLite persistence, and parts of the API and document pipeline. Several feature routers and screens were not sampled, so their internal call relationships are not inferred.

Main entry points: [`app/api/upload/route.ts`](https://github.com/dictera/kairos/blob/main/app/api/upload/route.ts) (Document upload API), [`lib/db.ts`](https://github.com/dictera/kairos/blob/main/lib/db.ts) (SQLite database), [`app/(auth)/login/page.tsx`](https://github.com/dictera/kairos/blob/main/app/(auth)/login/page.tsx) (Sign in), [`components/belge/belge-list.tsx`](https://github.com/dictera/kairos/blob/main/components/belge/belge-list.tsx) (Document management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Lawyer workspace"]
  node_login["Sign in<br/>[page.tsx]"]
  node_dashboard["Dashboard<br/>[dashboard-page.tsx]"]
end

subgraph group_casework["Case management"]
  node_client["Client records<br/>[muvekkil-list.tsx]"]
  node_case["Case files<br/>[dosya-form.tsx]"]
  node_proceedings["Proceedings<br/>[surec-stepper.tsx]"]
  node_deadlines["Deadline tracking"]
  node_calendar["Hearings calendar<br/>[calendar-view.tsx]"]
end

subgraph group_documents["Documents and templates"]
  node_documents_ui["Document management<br/>[belge-list.tsx]"]
  node_upload["Document upload API<br/>[route.ts]"]
  node_file_store[("Document files")]
  node_templates["Template management"]
  node_docx["DOCX generation<br/>[docx-pipeline.ts]"]
  node_python["Python sidecar<br/>[main.py]"]
end

subgraph group_insights["Finance and reporting"]
  node_finance["Finance tracking<br/>[finans-page.tsx]"]
  node_reports["Reports<br/>[raporlar.ts]"]
  node_telegram["Telegram alerts<br/>[notify.ts]"]
end

subgraph group_platform["Application services"]
  node_auth["Session authentication<br/>[session.ts]"]
  node_trpc["tRPC endpoint<br/>[route.ts]"]
  node_routers["Feature API routers"]
  node_database[("SQLite database<br/>[db.ts]")]
  node_schema["Domain schema<br/>[schema.ts]"]
end

node_lawyer(("Lawyer"))

node_lawyer -->|"signs in"| node_login
node_login -->|"authenticates"| node_auth
node_lawyer -->|"uses"| node_dashboard
node_lawyer -->|"manages"| node_client
node_lawyer -->|"manages"| node_case
node_lawyer -->|"tracks stages"| node_proceedings
node_lawyer -->|"tracks deadlines"| node_deadlines
node_lawyer -->|"reviews hearings"| node_calendar
node_lawyer -->|"manages documents"| node_documents_ui
node_documents_ui -.->|"uploads files"| node_upload
node_upload -->|"writes files"| node_file_store
node_upload -->|"records metadata"| node_database
node_lawyer -->|"manages templates"| node_templates
node_templates -.->|"requests generation"| node_docx
node_docx -->|"runs commands"| node_python
node_lawyer -->|"records finances"| node_finance
node_lawyer -->|"reviews reports"| node_reports
node_lawyer -->|"opts into alerts"| node_telegram
node_trpc -->|"dispatches"| node_routers
node_routers -.->|"queries data"| node_database
node_database -->|"uses schema"| node_schema

click node_login "https://github.com/dictera/kairos/blob/main/app/(auth)/login/page.tsx"
click node_dashboard "https://github.com/dictera/kairos/blob/main/components/dashboard/dashboard-page.tsx"
click node_client "https://github.com/dictera/kairos/blob/main/components/muvekkil/muvekkil-list.tsx"
click node_case "https://github.com/dictera/kairos/blob/main/components/dosya/dosya-form.tsx"
click node_proceedings "https://github.com/dictera/kairos/blob/main/components/dosya/surec-stepper.tsx"
click node_deadlines "https://github.com/dictera/kairos/blob/main/lib/deadline-service.ts"
click node_calendar "https://github.com/dictera/kairos/blob/main/components/calendar/calendar-view.tsx"
click node_documents_ui "https://github.com/dictera/kairos/blob/main/components/belge/belge-list.tsx"
click node_upload "https://github.com/dictera/kairos/blob/main/app/api/upload/route.ts"
click node_file_store "https://github.com/dictera/kairos/blob/main/lib/belgeler-storage.ts"
click node_templates "https://github.com/dictera/kairos/blob/main/components/ayarlar/sablon-yonetimi-section.tsx"
click node_docx "https://github.com/dictera/kairos/blob/main/lib/services/docx-pipeline.ts"
click node_python "https://github.com/dictera/kairos/blob/main/scripts/docx-pipeline/main.py"
click node_finance "https://github.com/dictera/kairos/blob/main/components/finans/finans-page.tsx"
click node_reports "https://github.com/dictera/kairos/blob/main/lib/trpc/routers/raporlar.ts"
click node_telegram "https://github.com/dictera/kairos/blob/main/lib/telegram/notify.ts"
click node_auth "https://github.com/dictera/kairos/blob/main/lib/session.ts"
click node_trpc "https://github.com/dictera/kairos/blob/main/app/api/trpc/%5Btrpc%5D/route.ts"
click node_routers "https://github.com/dictera/kairos/tree/main/lib/trpc/routers"
click node_database "https://github.com/dictera/kairos/blob/main/lib/db.ts"
click node_schema "https://github.com/dictera/kairos/blob/main/lib/schema.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_login,node_dashboard toneBlue
class node_client,node_case,node_proceedings,node_deadlines,node_calendar toneAmber
class node_documents_ui,node_upload,node_file_store,node_templates,node_docx,node_python toneMint
class node_finance,node_reports,node_telegram toneRose
class node_auth,node_trpc,node_routers,node_database,node_schema,node_lawyer toneIndigo
```

## Components

### Lawyer workspace

- [Sign in](https://github.com/dictera/kairos/blob/main/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [Dashboard](https://github.com/dictera/kairos/blob/main/components/dashboard/dashboard-page.tsx): `components/dashboard/dashboard-page.tsx`

### Case management

- [Client records](https://github.com/dictera/kairos/blob/main/components/muvekkil/muvekkil-list.tsx): `components/muvekkil/muvekkil-list.tsx`
- [Case files](https://github.com/dictera/kairos/blob/main/components/dosya/dosya-form.tsx): `components/dosya/dosya-form.tsx`
- [Proceedings](https://github.com/dictera/kairos/blob/main/components/dosya/surec-stepper.tsx): `components/dosya/surec-stepper.tsx`
- [Deadline tracking](https://github.com/dictera/kairos/blob/main/lib/deadline-service.ts): `lib/deadline-service.ts`
- [Hearings calendar](https://github.com/dictera/kairos/blob/main/components/calendar/calendar-view.tsx): `components/calendar/calendar-view.tsx`

### Documents and templates

- [Document management](https://github.com/dictera/kairos/blob/main/components/belge/belge-list.tsx): `components/belge/belge-list.tsx`
- [Document upload API](https://github.com/dictera/kairos/blob/main/app/api/upload/route.ts): `app/api/upload/route.ts`
- [Document files](https://github.com/dictera/kairos/blob/main/lib/belgeler-storage.ts): `lib/belgeler-storage.ts`
- [Template management](https://github.com/dictera/kairos/blob/main/components/ayarlar/sablon-yonetimi-section.tsx): `components/ayarlar/sablon-yonetimi-section.tsx`
- [DOCX generation](https://github.com/dictera/kairos/blob/main/lib/services/docx-pipeline.ts): `lib/services/docx-pipeline.ts`
- [Python sidecar](https://github.com/dictera/kairos/blob/main/scripts/docx-pipeline/main.py): `scripts/docx-pipeline/main.py`

### Finance and reporting

- [Finance tracking](https://github.com/dictera/kairos/blob/main/components/finans/finans-page.tsx): `components/finans/finans-page.tsx`
- [Reports](https://github.com/dictera/kairos/blob/main/lib/trpc/routers/raporlar.ts): `lib/trpc/routers/raporlar.ts`
- [Telegram alerts](https://github.com/dictera/kairos/blob/main/lib/telegram/notify.ts): `lib/telegram/notify.ts`

### Application services

- [Session authentication](https://github.com/dictera/kairos/blob/main/lib/session.ts): `lib/session.ts`
- [tRPC endpoint](https://github.com/dictera/kairos/blob/main/app/api/trpc/%5Btrpc%5D/route.ts): `app/api/trpc/[trpc]/route.ts`
- [Feature API routers](https://github.com/dictera/kairos/tree/main/lib/trpc/routers): `lib/trpc/routers`
- [SQLite database](https://github.com/dictera/kairos/blob/main/lib/db.ts): `lib/db.ts`
- [Domain schema](https://github.com/dictera/kairos/blob/main/lib/schema.ts): `lib/schema.ts`

### Other components

- **Lawyer**

## Connections

- Lawyer → Sign in: signs in (evidence: `README.md`)
- Sign in → Session authentication: authenticates
- Lawyer → Dashboard: uses (evidence: `README.md`)
- Lawyer → Client records: manages (evidence: `README.md`)
- Lawyer → Case files: manages (evidence: `README.md`)
- Lawyer → Proceedings: tracks stages (evidence: `README.md`)
- Lawyer → Deadline tracking: tracks deadlines (evidence: `README.md`)
- Lawyer → Hearings calendar: reviews hearings (evidence: `README.md`)
- Lawyer → Document management: manages documents (evidence: `README.md`)
- Document management → Document upload API: uploads files
- Document upload API → Document files: writes files (evidence: `app/api/upload/route.ts`)
- Document upload API → SQLite database: records metadata (evidence: `app/api/upload/route.ts`)
- Lawyer → Template management: manages templates (evidence: `README.md`)
- Template management → DOCX generation: requests generation
- DOCX generation → Python sidecar: runs commands (evidence: `lib/services/docx-pipeline.ts`)
- Lawyer → Finance tracking: records finances (evidence: `README.md`)
- Lawyer → Reports: reviews reports (evidence: `README.md`)
- Lawyer → Telegram alerts: opts into alerts (evidence: `README.md`)
- tRPC endpoint → Feature API routers: dispatches (evidence: `app/api/trpc/[trpc]/route.ts`)
- Feature API routers → SQLite database: queries data
- SQLite database → Domain schema: uses schema (evidence: `lib/db.ts`)
