# raytolfas/glaudb architecture

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

- Interactive diagram: https://gitdiagram.com/raytolfas/glaudb
- Repository: https://github.com/raytolfas/glaudb

## Overview

GlauDB is an embedded document database shipped as a server with HTTP/REST, binary TCP, and an embedded admin dashboard. Users submit queries through the CLI, TCP clients, or the dashboard/API; server entry points authenticate and dispatch operations to the database, which applies schemas and query/aggregation/search logic over transactional storage. The README also documents live updates, S3 uploads, tokens, webhooks, and server logs. Edges reflect excerpts and README statements; unsampled implementation links are omitted or marked unverified.

Main entry points: [`src/core/db.rs`](https://github.com/raytolfas/glaudb/blob/main/src/core/db.rs) (Transactional database), [`glaudb-admin/src/App.tsx`](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/App.tsx) (Admin workspace), [`src/http.rs`](https://github.com/raytolfas/glaudb/blob/main/src/http.rs) (HTTP API), [`glaudb-admin/src/api.ts`](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/api.ts) (Admin API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_main["CLI dispatcher<br/>[main.rs]"]
  node_serve["Server startup<br/>[serve.rs]"]
  node_http["HTTP API<br/>[http.rs]"]
  node_tcp["Binary TCP<br/>[tcp.rs]"]
  node_events["Live updates<br/>[http.rs]"]
  node_logs["Server logs<br/>[http.rs]"]
  node_config["Server configuration<br/>[config.rs]"]
end

subgraph group_data["Database engine"]
  node_database[("Transactional database<br/>[db.rs]")]
  node_schema["Collection schemas<br/>[schema.rs]"]
  node_query["Query and sorting<br/>[query.rs]"]
  node_aggregation["Aggregation<br/>[aggregation.rs]"]
  node_search["Full-text search<br/>[fts.rs]"]
  node_tokens["API tokens<br/>[tokens.rs]"]
  node_webhooks["Webhook records<br/>[hooks.rs]"]
  node_s3["S3 uploads<br/>[s3.rs]"]
end

subgraph group_admin["Admin dashboard"]
  node_adminapp["Admin workspace<br/>[App.tsx]"]
  node_adminapi["Admin API client<br/>[api.ts]"]
  node_dashboard["Metrics dashboard<br/>[Dashboard.tsx]"]
  node_collections["Collection manager<br/>[Collections.tsx]"]
  node_tokenui["Token manager<br/>[Tokens.tsx]"]
  node_webhookui["Webhook manager<br/>[Webhooks.tsx]"]
  node_logui["Log viewer<br/>[Logs.tsx]"]
  node_settings["Settings panel<br/>[Settings.tsx]"]
end

subgraph group_client["Client access"]
  node_querycli["Query CLI<br/>[query_cmd.rs]"]
  node_tcpclient(("TCP client"))
end

node_user(("Database user"))
node_webclient(("Browser user"))
node_s3service(("S3-compatible service"))

node_user -->|"runs command"| node_main
node_main -->|"starts server"| node_serve
node_main -->|"runs query"| node_querycli
node_serve -->|"starts HTTP"| node_http
node_serve -->|"starts TCP"| node_tcp
node_serve -->|"loads settings"| node_config
node_querycli -->|"sends framed query"| node_tcp
node_tcpclient -->|"sends commands"| node_tcp
node_http -->|"dispatches operations"| node_database
node_tcp -->|"dispatches commands"| node_database
node_database -->|"validates documents"| node_schema
node_database -->|"evaluates queries"| node_query
node_database -->|"runs pipelines"| node_aggregation
node_database -->|"indexes search"| node_search
node_database -->|"stores tokens"| node_tokens
node_database -->|"stores webhooks"| node_webhooks
node_database -.->|"uploads files"| node_s3
node_s3 -->|"uploads objects"| node_s3service
node_http -->|"publishes changes"| node_events
node_http -->|"records operations"| node_logs
node_webclient -->|"uses dashboard"| node_adminapp
node_adminapp -->|"renders"| node_dashboard
node_adminapp -->|"renders"| node_collections
node_adminapp -->|"renders"| node_tokenui
node_adminapp -->|"renders"| node_webhookui
node_adminapp -->|"renders"| node_logui
node_adminapp -->|"renders"| node_settings
node_collections -->|"calls"| node_adminapi
node_tokenui -->|"calls"| node_adminapi
node_webhookui -->|"calls"| node_adminapi
node_logui -->|"calls"| node_adminapi
node_settings -->|"calls"| node_adminapi
node_adminapi -->|"calls REST API"| node_http
node_adminapp -->|"logs in"| node_http

click node_main "https://github.com/raytolfas/glaudb/blob/main/src/main.rs"
click node_serve "https://github.com/raytolfas/glaudb/blob/main/src/serve.rs"
click node_http "https://github.com/raytolfas/glaudb/blob/main/src/http.rs"
click node_tcp "https://github.com/raytolfas/glaudb/blob/main/src/tcp.rs"
click node_events "https://github.com/raytolfas/glaudb/blob/main/src/http.rs"
click node_logs "https://github.com/raytolfas/glaudb/blob/main/src/http.rs"
click node_database "https://github.com/raytolfas/glaudb/blob/main/src/core/db.rs"
click node_schema "https://github.com/raytolfas/glaudb/blob/main/src/core/schema.rs"
click node_query "https://github.com/raytolfas/glaudb/blob/main/src/core/query.rs"
click node_aggregation "https://github.com/raytolfas/glaudb/blob/main/src/core/aggregation.rs"
click node_search "https://github.com/raytolfas/glaudb/blob/main/src/core/fts.rs"
click node_tokens "https://github.com/raytolfas/glaudb/blob/main/src/core/tokens.rs"
click node_webhooks "https://github.com/raytolfas/glaudb/blob/main/src/core/hooks.rs"
click node_s3 "https://github.com/raytolfas/glaudb/blob/main/src/core/s3.rs"
click node_config "https://github.com/raytolfas/glaudb/blob/main/src/core/config.rs"
click node_adminapp "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/App.tsx"
click node_adminapi "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/api.ts"
click node_dashboard "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Dashboard.tsx"
click node_collections "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Collections.tsx"
click node_tokenui "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Tokens.tsx"
click node_webhookui "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Webhooks.tsx"
click node_logui "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Logs.tsx"
click node_settings "https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Settings.tsx"
click node_querycli "https://github.com/raytolfas/glaudb/blob/main/src/query_cmd.rs"

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_main,node_serve,node_http,node_tcp,node_events,node_logs,node_config,node_webclient toneBlue
class node_database,node_schema,node_query,node_aggregation,node_search,node_tokens,node_webhooks,node_s3,node_user toneAmber
class node_adminapp,node_adminapi,node_dashboard,node_collections,node_tokenui,node_webhookui,node_logui,node_settings toneMint
class node_querycli,node_tcpclient toneRose
class node_s3service toneIndigo
```

## Components

### Server runtime

- [CLI dispatcher](https://github.com/raytolfas/glaudb/blob/main/src/main.rs): `src/main.rs`
- [Server startup](https://github.com/raytolfas/glaudb/blob/main/src/serve.rs): `src/serve.rs`
- [HTTP API](https://github.com/raytolfas/glaudb/blob/main/src/http.rs): `src/http.rs`
- [Binary TCP](https://github.com/raytolfas/glaudb/blob/main/src/tcp.rs): `src/tcp.rs`
- [Live updates](https://github.com/raytolfas/glaudb/blob/main/src/http.rs): `src/http.rs`
- [Server logs](https://github.com/raytolfas/glaudb/blob/main/src/http.rs): `src/http.rs`
- [Server configuration](https://github.com/raytolfas/glaudb/blob/main/src/core/config.rs): `src/core/config.rs`

### Database engine

- [Transactional database](https://github.com/raytolfas/glaudb/blob/main/src/core/db.rs): `src/core/db.rs`
- [Collection schemas](https://github.com/raytolfas/glaudb/blob/main/src/core/schema.rs): `src/core/schema.rs`
- [Query and sorting](https://github.com/raytolfas/glaudb/blob/main/src/core/query.rs): `src/core/query.rs`
- [Aggregation](https://github.com/raytolfas/glaudb/blob/main/src/core/aggregation.rs): `src/core/aggregation.rs`
- [Full-text search](https://github.com/raytolfas/glaudb/blob/main/src/core/fts.rs): `src/core/fts.rs`
- [API tokens](https://github.com/raytolfas/glaudb/blob/main/src/core/tokens.rs): `src/core/tokens.rs`
- [Webhook records](https://github.com/raytolfas/glaudb/blob/main/src/core/hooks.rs): `src/core/hooks.rs`
- [S3 uploads](https://github.com/raytolfas/glaudb/blob/main/src/core/s3.rs): `src/core/s3.rs`

### Admin dashboard

- [Admin workspace](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/App.tsx): `glaudb-admin/src/App.tsx`
- [Admin API client](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/api.ts): `glaudb-admin/src/api.ts`
- [Metrics dashboard](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Dashboard.tsx): `glaudb-admin/src/components/Dashboard.tsx`
- [Collection manager](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Collections.tsx): `glaudb-admin/src/components/Collections.tsx`
- [Token manager](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Tokens.tsx): `glaudb-admin/src/components/Tokens.tsx`
- [Webhook manager](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Webhooks.tsx): `glaudb-admin/src/components/Webhooks.tsx`
- [Log viewer](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Logs.tsx): `glaudb-admin/src/components/Logs.tsx`
- [Settings panel](https://github.com/raytolfas/glaudb/blob/main/glaudb-admin/src/components/Settings.tsx): `glaudb-admin/src/components/Settings.tsx`

### Client access

- [Query CLI](https://github.com/raytolfas/glaudb/blob/main/src/query_cmd.rs): `src/query_cmd.rs`
- **TCP client**

### Other components

- **Database user**
- **Browser user**
- **S3-compatible service**

## Connections

- Database user → CLI dispatcher: runs command (evidence: `src/main.rs`)
- CLI dispatcher → Server startup: starts server (evidence: `src/main.rs`)
- CLI dispatcher → Query CLI: runs query (evidence: `src/main.rs`)
- Server startup → HTTP API: starts HTTP (evidence: `src/serve.rs`)
- Server startup → Binary TCP: starts TCP (evidence: `src/serve.rs`)
- Server startup → Server configuration: loads settings (evidence: `src/serve.rs`)
- Query CLI → Binary TCP: sends framed query (evidence: `src/query_cmd.rs`)
- TCP client → Binary TCP: sends commands (evidence: `README.md`)
- HTTP API → Transactional database: dispatches operations (evidence: `src/http.rs`)
- Binary TCP → Transactional database: dispatches commands (evidence: `src/tcp.rs`)
- Transactional database → Collection schemas: validates documents (evidence: `src/core/db.rs`)
- Transactional database → Query and sorting: evaluates queries (evidence: `src/core/db.rs`)
- Transactional database → Aggregation: runs pipelines (evidence: `src/core/db.rs`)
- Transactional database → Full-text search: indexes search (evidence: `src/core/db.rs`)
- Transactional database → API tokens: stores tokens (evidence: `src/core/db.rs`)
- Transactional database → Webhook records: stores webhooks (evidence: `src/core/db.rs`)
- Transactional database → S3 uploads: uploads files (evidence: `src/core/db.rs`)
- S3 uploads → S3-compatible service: uploads objects (evidence: `src/core/s3.rs`)
- HTTP API → Live updates: publishes changes (evidence: `src/http.rs`)
- HTTP API → Server logs: records operations (evidence: `src/http.rs`)
- Browser user → Admin workspace: uses dashboard (evidence: `README.md`)
- Admin workspace → Metrics dashboard: renders (evidence: `glaudb-admin/src/App.tsx`)
- Admin workspace → Collection manager: renders (evidence: `glaudb-admin/src/App.tsx`)
- Admin workspace → Token manager: renders (evidence: `glaudb-admin/src/App.tsx`)
- Admin workspace → Webhook manager: renders (evidence: `glaudb-admin/src/App.tsx`)
- Admin workspace → Log viewer: renders (evidence: `glaudb-admin/src/App.tsx`)
- Admin workspace → Settings panel: renders (evidence: `glaudb-admin/src/App.tsx`)
- Collection manager → Admin API client: calls (evidence: `glaudb-admin/src/components/Collections.tsx`)
- Token manager → Admin API client: calls (evidence: `glaudb-admin/src/components/Tokens.tsx`)
- Webhook manager → Admin API client: calls (evidence: `glaudb-admin/src/components/Webhooks.tsx`)
- Log viewer → Admin API client: calls (evidence: `glaudb-admin/src/components/Logs.tsx`)
- Settings panel → Admin API client: calls (evidence: `glaudb-admin/src/components/Settings.tsx`)
- Admin API client → HTTP API: calls REST API (evidence: `README.md`)
- Admin workspace → HTTP API: logs in (evidence: `glaudb-admin/src/App.tsx`)
