# zizka-ai-sl/zizkadb architecture

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

- Interactive diagram: https://gitdiagram.com/zizka-ai-sl/zizkadb
- Repository: https://github.com/zizka-ai-sl/zizkadb

## Overview

ZizkaDB is a Postgres-backed operational database and auditability platform for AI agents. An agent records events through an SDK or integration; the API authenticates and persists a causal, checksummed history. Users then inspect sessions, trace causes, replay past state, search memory, and review drift or compliance data in the dashboard or MCP. The map also includes embedding-based retrieval and the optional suggestion-analysis capability. Edges reflect README statements and shown source references; several API subsystems are represented by their exact directories because their implementation was not sampled.

Main entry points: [`core/main.py`](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/main.py) (HTTP API), [`sdk/python/zizkadb/client.py`](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/sdk/python/zizkadb/client.py) (Python SDK), [`core/services/event_write.py`](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/event_write.py) (Event write path), [`core/api/sessions.py`](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/sessions.py) (Sessions and causes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Event Ingestion"]
  node_api["HTTP API<br/>[main.py]"]
  node_auth["Authentication<br/>[deps.py]"]
  node_event_api["Event endpoints<br/>[events.py]"]
  node_billing["Plans and billing"]
end

subgraph group_data["History and Memory"]
  node_event_write["Event write path<br/>[event_write.py]"]
  node_postgres[("Postgres history<br/>[connection.py]")]
  node_audit["Checksums and chain<br/>[audit_chain.py]"]
  node_memory_api["Memory and search<br/>[memory.py]"]
  node_embeddings["Embedding service<br/>[embeddings.py]"]
  node_embed_worker["Embedding index worker<br/>[embed_worker.py]"]
  node_suggestions["Suggestions analysis<br/>[engine.py]"]
  node_sessions["Sessions and causes<br/>[sessions.py]"]
  node_agents_api["Agent analytics<br/>[agents.py]"]
end

subgraph group_experience["User Interfaces"]
  node_dashboard["Web dashboard"]
  node_community["Community portal"]
end

subgraph group_connectors["Client Integrations"]
  node_sdk["Python SDK<br/>[client.py]"]
  node_instrument["SDK instrumentation<br/>[instrumentation.py]"]
  node_ts_sdk["TypeScript SDK<br/>[instrument.ts]"]
  node_frameworks["Framework adapters"]
  node_mcp["MCP server<br/>[server.py]"]
end

node_agent(("AI agent"))

node_agent -->|"emits events"| node_instrument
node_instrument -.->|"records events"| node_sdk
node_agent -->|"logs events"| node_sdk
node_sdk -->|"sends requests"| node_api
node_ts_sdk -.->|"sends requests"| node_api
node_frameworks -.->|"uses SDK"| node_sdk
node_mcp -.->|"accesses database"| node_api
node_api -->|"routes requests"| node_auth
node_auth -->|"authorizes access"| node_event_api
node_event_api -->|"writes events"| node_event_write
node_event_write -->|"stores events"| node_postgres
node_event_write -->|"builds chain"| node_audit
node_api -->|"routes requests"| node_memory_api
node_api -->|"routes requests"| node_sessions
node_sessions -->|"reads history"| node_postgres
node_sessions -.->|"verifies causes"| node_audit
node_embed_worker -->|"reads pending events"| node_postgres
node_embed_worker -->|"generates vectors"| node_embeddings
node_memory_api -.->|"retrieves vectors"| node_embeddings
node_api -->|"routes requests"| node_agents_api
node_agents_api -->|"analyzes evidence"| node_suggestions
node_dashboard -.->|"queries data"| node_api
node_community -.->|"uses services"| node_api
node_api -->|"routes requests"| node_billing

click node_sdk "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/sdk/python/zizkadb/client.py"
click node_instrument "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/sdk/python/zizkadb/instrumentation.py"
click node_ts_sdk "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/sdk/typescript/src/instrument.ts"
click node_frameworks "https://github.com/ZIZKA-AI-SL/ZizkaDB/tree/main/integrations"
click node_mcp "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/mcp/zizkadb_mcp/server.py"
click node_api "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/main.py"
click node_auth "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/deps.py"
click node_event_api "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/events.py"
click node_event_write "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/event_write.py"
click node_postgres "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/db/connection.py"
click node_audit "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/audit_chain.py"
click node_memory_api "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/memory.py"
click node_embeddings "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/embeddings.py"
click node_embed_worker "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/workers/embed_worker.py"
click node_suggestions "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/suggestions/engine.py"
click node_sessions "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/sessions.py"
click node_agents_api "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/agents.py"
click node_dashboard "https://github.com/ZIZKA-AI-SL/ZizkaDB/tree/main/dashboard/app/dashboard"
click node_community "https://github.com/ZIZKA-AI-SL/ZizkaDB/tree/main/dashboard/app/community"
click node_billing "https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/billing_checkout.py"

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_api,node_auth,node_event_api,node_billing toneBlue
class node_event_write,node_postgres,node_audit,node_memory_api,node_embeddings,node_embed_worker,node_suggestions,node_sessions,node_agents_api toneAmber
class node_dashboard,node_community toneMint
class node_sdk,node_instrument,node_ts_sdk,node_frameworks,node_mcp toneRose
class node_agent toneIndigo
```

## Components

### Event Ingestion

- [HTTP API](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/main.py): `core/main.py`
- [Authentication](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/deps.py): `core/api/deps.py`
- [Event endpoints](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/events.py): `core/api/events.py`
- [Plans and billing](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/billing_checkout.py): `core/api/billing_checkout.py`

### History and Memory

- [Event write path](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/event_write.py): `core/services/event_write.py`
- [Postgres history](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/db/connection.py): `core/db/connection.py`
- [Checksums and chain](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/audit_chain.py): `core/services/audit_chain.py`
- [Memory and search](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/memory.py): `core/api/memory.py`
- [Embedding service](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/embeddings.py): `core/services/embeddings.py`
- [Embedding index worker](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/workers/embed_worker.py): `core/workers/embed_worker.py`
- [Suggestions analysis](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/services/suggestions/engine.py): `core/services/suggestions/engine.py`
- [Sessions and causes](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/sessions.py): `core/api/sessions.py`
- [Agent analytics](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/core/api/agents.py): `core/api/agents.py`

### User Interfaces

- [Web dashboard](https://github.com/ZIZKA-AI-SL/ZizkaDB/tree/main/dashboard/app/dashboard): `dashboard/app/dashboard`
- [Community portal](https://github.com/ZIZKA-AI-SL/ZizkaDB/tree/main/dashboard/app/community): `dashboard/app/community`

### Client Integrations

- [Python SDK](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/sdk/python/zizkadb/client.py): `sdk/python/zizkadb/client.py`
- [SDK instrumentation](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/sdk/python/zizkadb/instrumentation.py): `sdk/python/zizkadb/instrumentation.py`
- [TypeScript SDK](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/sdk/typescript/src/instrument.ts): `sdk/typescript/src/instrument.ts`
- [Framework adapters](https://github.com/ZIZKA-AI-SL/ZizkaDB/tree/main/integrations): `integrations`
- [MCP server](https://github.com/ZIZKA-AI-SL/ZizkaDB/blob/main/mcp/zizkadb_mcp/server.py): `mcp/zizkadb_mcp/server.py`

### Other components

- **AI agent**

## Connections

- AI agent → SDK instrumentation: emits events (evidence: `README.md`)
- SDK instrumentation → Python SDK: records events
- AI agent → Python SDK: logs events (evidence: `README.md`)
- Python SDK → HTTP API: sends requests (evidence: `README.md`)
- TypeScript SDK → HTTP API: sends requests
- Framework adapters → Python SDK: uses SDK
- MCP server → HTTP API: accesses database
- HTTP API → Authentication: routes requests (evidence: `core/main.py`)
- Authentication → Event endpoints: authorizes access (evidence: `core/api/deps.py`)
- Event endpoints → Event write path: writes events (evidence: `core/api/events.py`)
- Event write path → Postgres history: stores events (evidence: `core/services/event_write.py`)
- Event write path → Checksums and chain: builds chain (evidence: `core/services/event_write.py`)
- HTTP API → Memory and search: routes requests (evidence: `core/main.py`)
- HTTP API → Sessions and causes: routes requests (evidence: `core/main.py`)
- Sessions and causes → Postgres history: reads history (evidence: `core/api/sessions.py`)
- Sessions and causes → Checksums and chain: verifies causes
- Embedding index worker → Postgres history: reads pending events (evidence: `core/workers/embed_worker.py`)
- Embedding index worker → Embedding service: generates vectors (evidence: `core/workers/embed_worker.py`)
- Memory and search → Embedding service: retrieves vectors
- HTTP API → Agent analytics: routes requests (evidence: `core/main.py`)
- Agent analytics → Suggestions analysis: analyzes evidence (evidence: `core/services/suggestions/engine.py`)
- Web dashboard → HTTP API: queries data
- Community portal → HTTP API: uses services
- HTTP API → Plans and billing: routes requests (evidence: `core/main.py`)
