# delok-dev/delok architecture

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

- Interactive diagram: https://gitdiagram.com/delok-dev/delok
- Repository: https://github.com/delok-dev/delok

## Overview

Delok is a hosted application-log platform: users organize work into organizations and projects, create ingestion keys, send logs, then search and monitor project logs. The map covers the documented collection and search capabilities, the workspace-management UI, backend ingestion and querying, and realtime updates. Several frontend-to-API links and unsampled backend internals are not visible in the excerpts, so those relationships are marked unverified or omitted.

Main entry points: [`backend/src/modules/ingestion/ingestion.service.ts`](https://github.com/delok-dev/delok/blob/main/backend/src/modules/ingestion/ingestion.service.ts) (Ingestion service), [`frontend/src/domains/log-explorer/hooks/useLogExplorer.ts`](https://github.com/delok-dev/delok/blob/main/frontend/src/domains/log-explorer/hooks/useLogExplorer.ts) (Log explorer), [`backend/src/app.ts`](https://github.com/delok-dev/delok/blob/main/backend/src/app.ts) (HTTP application), [`frontend/src/views/orgs/OrganizationsPage.tsx`](https://github.com/delok-dev/delok/blob/main/frontend/src/views/orgs/OrganizationsPage.tsx) (Organization workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace management"]
  node_org_ui["Organization workspace"]
  node_org_api["Organization API"]
  node_project_ui["Project workspace<br/>[ProjectsPage.tsx]"]
  node_project_api["Project API"]
  node_key_ui["API key settings<br/>[ApiKeyList.tsx]"]
end

subgraph group_logs["Log collection and exploration"]
  node_log_ui["Log explorer<br/>[useLogExplorer.ts]"]
  node_log_view["Log presentation<br/>[LogEventRow.tsx]"]
  node_ingest_api["Ingestion endpoint"]
  node_ingest_service["Ingestion service"]
end

subgraph group_backend["Backend services"]
  node_key_api["API key management"]
  node_key_service["Key service<br/>[api-key.service.ts]"]
  node_log_api["Log query API"]
  node_log_service["Log query service"]
  node_ingest_repo["Ingestion persistence"]
  node_database[("Application database<br/>[prisma.ts]")]
  node_app["HTTP application<br/>[app.ts]"]
end

subgraph group_platform["Identity and realtime"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_realtime["Realtime service"]
  node_websocket["WebSocket transport<br/>[websocket.ts]"]
  node_frontend_socket["Realtime client<br/>[websocket.ts]"]
  node_delok["Delok telemetry client<br/>[delok.ts]"]
end

node_user(("User"))
node_sdk["Delok SDK"]

node_user -->|"manages"| node_org_ui
node_org_ui -.->|"requests data"| node_org_api
node_user -->|"organizes projects"| node_project_ui
node_project_ui -.->|"requests data"| node_project_api
node_user -.->|"manages keys"| node_key_ui
node_key_ui -.->|"requests keys"| node_key_api
node_key_api -->|"calls"| node_key_service
node_user -->|"explores logs"| node_log_ui
node_log_ui -.->|"renders logs"| node_log_view
node_log_ui -.->|"queries logs"| node_log_api
node_log_api -->|"calls"| node_log_service
node_sdk -->|"submits logs"| node_app
node_app -->|"routes requests"| node_ingest_api
node_ingest_api -->|"calls"| node_ingest_service
node_ingest_service -->|"reads and writes"| node_ingest_repo
node_ingest_repo -->|"persists events"| node_database
node_app -->|"registers auth"| node_auth
node_ingest_service -->|"emits updates"| node_realtime
node_realtime -->|"uses transport"| node_websocket
node_frontend_socket -.->|"connects"| node_websocket
node_ingest_service -->|"logs failures"| node_delok

click node_org_ui "https://github.com/delok-dev/delok/blob/main/frontend/src/views/orgs/OrganizationsPage.tsx"
click node_org_api "https://github.com/delok-dev/delok/blob/main/backend/src/modules/organization/organization.controller.ts"
click node_project_ui "https://github.com/delok-dev/delok/blob/main/frontend/src/views/orgs/organization/projects/ProjectsPage.tsx"
click node_project_api "https://github.com/delok-dev/delok/blob/main/backend/src/modules/project/project.controller.ts"
click node_key_ui "https://github.com/delok-dev/delok/blob/main/frontend/src/domains/api-key/components/ApiKeyList.tsx"
click node_key_api "https://github.com/delok-dev/delok/blob/main/backend/src/modules/api-key/api-key.controller.ts"
click node_key_service "https://github.com/delok-dev/delok/blob/main/backend/src/modules/api-key/api-key.service.ts"
click node_log_ui "https://github.com/delok-dev/delok/blob/main/frontend/src/domains/log-explorer/hooks/useLogExplorer.ts"
click node_log_view "https://github.com/delok-dev/delok/blob/main/frontend/src/domains/log/components/LogEventRow.tsx"
click node_log_api "https://github.com/delok-dev/delok/blob/main/backend/src/modules/log-event/log-event.controller.ts"
click node_log_service "https://github.com/delok-dev/delok/blob/main/backend/src/modules/log-event/log-event.service.ts"
click node_ingest_api "https://github.com/delok-dev/delok/blob/main/backend/src/modules/ingestion/ingestion.controller.ts"
click node_ingest_service "https://github.com/delok-dev/delok/blob/main/backend/src/modules/ingestion/ingestion.service.ts"
click node_ingest_repo "https://github.com/delok-dev/delok/blob/main/backend/src/modules/ingestion/ingestion.repository.ts"
click node_database "https://github.com/delok-dev/delok/blob/main/backend/src/lib/prisma.ts"
click node_app "https://github.com/delok-dev/delok/blob/main/backend/src/app.ts"
click node_auth "https://github.com/delok-dev/delok/blob/main/backend/src/lib/auth.ts"
click node_realtime "https://github.com/delok-dev/delok/blob/main/backend/src/infrastructure/realtime/realtime.service.ts"
click node_websocket "https://github.com/delok-dev/delok/blob/main/backend/src/infrastructure/realtime/websocket.ts"
click node_frontend_socket "https://github.com/delok-dev/delok/blob/main/frontend/src/lib/websocket/websocket.ts"
click node_delok "https://github.com/delok-dev/delok/blob/main/backend/src/lib/delok.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_org_ui,node_org_api,node_project_ui,node_project_api,node_key_ui,node_user toneBlue
class node_log_ui,node_log_view,node_ingest_api,node_ingest_service toneAmber
class node_key_api,node_key_service,node_log_api,node_log_service,node_ingest_repo,node_database,node_app toneMint
class node_auth,node_realtime,node_websocket,node_frontend_socket,node_delok toneRose
class node_sdk toneIndigo
```

## Components

### Workspace management

- [Organization workspace](https://github.com/delok-dev/delok/blob/main/frontend/src/views/orgs/OrganizationsPage.tsx): `frontend/src/views/orgs/OrganizationsPage.tsx`
- [Organization API](https://github.com/delok-dev/delok/blob/main/backend/src/modules/organization/organization.controller.ts): `backend/src/modules/organization/organization.controller.ts`
- [Project workspace](https://github.com/delok-dev/delok/blob/main/frontend/src/views/orgs/organization/projects/ProjectsPage.tsx): `frontend/src/views/orgs/organization/projects/ProjectsPage.tsx`
- [Project API](https://github.com/delok-dev/delok/blob/main/backend/src/modules/project/project.controller.ts): `backend/src/modules/project/project.controller.ts`
- [API key settings](https://github.com/delok-dev/delok/blob/main/frontend/src/domains/api-key/components/ApiKeyList.tsx): `frontend/src/domains/api-key/components/ApiKeyList.tsx`

### Log collection and exploration

- [Log explorer](https://github.com/delok-dev/delok/blob/main/frontend/src/domains/log-explorer/hooks/useLogExplorer.ts): `frontend/src/domains/log-explorer/hooks/useLogExplorer.ts`
- [Log presentation](https://github.com/delok-dev/delok/blob/main/frontend/src/domains/log/components/LogEventRow.tsx): `frontend/src/domains/log/components/LogEventRow.tsx`
- [Ingestion endpoint](https://github.com/delok-dev/delok/blob/main/backend/src/modules/ingestion/ingestion.controller.ts): `backend/src/modules/ingestion/ingestion.controller.ts`
- [Ingestion service](https://github.com/delok-dev/delok/blob/main/backend/src/modules/ingestion/ingestion.service.ts): `backend/src/modules/ingestion/ingestion.service.ts`

### Backend services

- [API key management](https://github.com/delok-dev/delok/blob/main/backend/src/modules/api-key/api-key.controller.ts): `backend/src/modules/api-key/api-key.controller.ts`
- [Key service](https://github.com/delok-dev/delok/blob/main/backend/src/modules/api-key/api-key.service.ts): `backend/src/modules/api-key/api-key.service.ts`
- [Log query API](https://github.com/delok-dev/delok/blob/main/backend/src/modules/log-event/log-event.controller.ts): `backend/src/modules/log-event/log-event.controller.ts`
- [Log query service](https://github.com/delok-dev/delok/blob/main/backend/src/modules/log-event/log-event.service.ts): `backend/src/modules/log-event/log-event.service.ts`
- [Ingestion persistence](https://github.com/delok-dev/delok/blob/main/backend/src/modules/ingestion/ingestion.repository.ts): `backend/src/modules/ingestion/ingestion.repository.ts`
- [Application database](https://github.com/delok-dev/delok/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`
- [HTTP application](https://github.com/delok-dev/delok/blob/main/backend/src/app.ts): `backend/src/app.ts`

### Identity and realtime

- [Authentication](https://github.com/delok-dev/delok/blob/main/backend/src/lib/auth.ts): `backend/src/lib/auth.ts`
- [Realtime service](https://github.com/delok-dev/delok/blob/main/backend/src/infrastructure/realtime/realtime.service.ts): `backend/src/infrastructure/realtime/realtime.service.ts`
- [WebSocket transport](https://github.com/delok-dev/delok/blob/main/backend/src/infrastructure/realtime/websocket.ts): `backend/src/infrastructure/realtime/websocket.ts`
- [Realtime client](https://github.com/delok-dev/delok/blob/main/frontend/src/lib/websocket/websocket.ts): `frontend/src/lib/websocket/websocket.ts`
- [Delok telemetry client](https://github.com/delok-dev/delok/blob/main/backend/src/lib/delok.ts): `backend/src/lib/delok.ts`

### Other components

- **User**
- **Delok SDK**

## Connections

- User → Organization workspace: manages
- Organization workspace → Organization API: requests data
- User → Project workspace: organizes projects
- Project workspace → Project API: requests data
- User → API key settings: manages keys
- API key settings → API key management: requests keys
- API key management → Key service: calls (evidence: `backend/src/modules/api-key/api-key.controller.ts`)
- User → Log explorer: explores logs
- Log explorer → Log presentation: renders logs
- Log explorer → Log query API: queries logs
- Log query API → Log query service: calls (evidence: `backend/src/modules/log-event/log-event.controller.ts`)
- Delok SDK → HTTP application: submits logs (evidence: `backend/src/app.ts`)
- HTTP application → Ingestion endpoint: routes requests (evidence: `backend/src/app.ts`)
- Ingestion endpoint → Ingestion service: calls (evidence: `backend/src/modules/ingestion/ingestion.controller.ts`)
- Ingestion service → Ingestion persistence: reads and writes (evidence: `backend/src/modules/ingestion/ingestion.service.ts`)
- Ingestion persistence → Application database: persists events (evidence: `backend/src/modules/ingestion/ingestion.repository.ts`)
- HTTP application → Authentication: registers auth (evidence: `backend/src/app.ts`)
- Ingestion service → Realtime service: emits updates (evidence: `backend/src/modules/ingestion/ingestion.service.ts`)
- Realtime service → WebSocket transport: uses transport (evidence: `backend/src/infrastructure/realtime/realtime.service.ts`)
- Realtime client → WebSocket transport: connects
- Ingestion service → Delok telemetry client: logs failures (evidence: `backend/src/modules/ingestion/ingestion.service.ts`)
