// PART 00
How to read this book
This is an architecture and deployment reference for developers. It assumes you can read Rust and are comfortable with a terminal; it does not assume prior knowledge of General Bots.
Read by question, not cover to cover
| Question | Page |
|---|---|
| Where does the code live, and what is a crate here? | Source map |
| Which port does what, and who serves HTML? | Network contract |
| What boots, in which order? | Module and service structure |
| How do I build the server and with which features? | Build system, Building from source |
| How does a chat message become a reply? | Bot pipeline |
| How do I add a keyword, an app, a channel or a model provider? | Part 11 |
What exactly does GET /api/... return? |
Part 12 (generated references) |
Conventions used on every page
Authorities. Each page names the files it was written from — the route file, the keyword crate, the manifest. When two sources disagree, the named authority wins.
Status honesty. Capabilities are stated with their actual wiring:
- registered — the code path exists and is called in production paths.
- library API, no production caller — the code exists; nothing invokes it yet.
- not implemented — the platform does not do this; a table says so instead of prose hedging.
Version facts. The product version comes from Cargo.toml at the repository root (7.1.2). Dependency versions (PostgreSQL, Valkey, Vault, Qdrant, Zitadel) come from botserver/3rdparty.toml.
The platform in one screen
botserver is built in Rust (Axum web server, Diesel ORM, Rhai as the scripting engine under the BASIC dialect) with a modular architecture. The runtime boots from configuration and Vault, mounts route modules, starts Drive monitors that discover bots in object storage, and serves:
Web/browser clients (suite, cloud, login — botui)
│ HTTP + WebSocket
▼
botserver (Axum): REST /api/*, WS /ws, BASIC runtime, pipeline
│
├── PostgreSQL (Diesel, botschema) — structured state
├── Drive (OtterIO, S3-compatible) — bot packages, KB, user files
├── Valkey — cache, suggestions, pub/sub
├── Qdrant (optional) — vector search for KB
└── Vault — credentials, LLM configuration
BotUI is a separate binary that serves the static front ends on ports 3000 (suite), 4000 (cloud) and 5000 (login); botserver itself never serves a complete HTML page.
Extending: the two unified surfaces
Every user-facing feature ends up reachable through one of two mechanisms — this is the design rule the extending chapters return to:
- UI/web —
__ui_plan__plans actions over the app registry; the frontend calls REST endpoints directly. - Chat/WhatsApp — the LLM uses BASIC keywords,
CALL "tool"scripts, and MCP tools; raw REST is deliberately not reachable from chat.
When you add a feature, register it in the API command catalog (so the LLM can call it without a giant system prompt) and, if it is UI-only, make sure ui_automation_instructions() can see it.
Reading the code alongside the book
Useful entry points, in the order a new contributor usually opens them:
| Path | What it is |
|---|---|
botserver/src/main.rs |
Binary entry; declares the module tree |
botserver/src/main_module/init.rs |
Bootstrap sequence |
botserver/src/core/bot/ws/handler.rs |
WebSocket chat handler |
botserver/crates/ |
The 117 feature crates |
botserver/migrations/ |
Diesel migrations (run at boot) |