Skip to content

Architecture

Part of Dev. The product is one Rust workspace: a botserver binary plus feature libraries. The crate directories live under botserver/crates/ (117 of them in this tree); the schema has its own crate at the repository root.

Layers

Layer Where What it owns
Entry point botserver/src/main.rs Declares the feature-gated modules and re-exports main_module.
Server wiring botserver/src/main_module/ Server setup, routes/, drive_monitors/, git_bot_monitor/, embedded_cache/, wizard_provision/ and local_recovery/.
API sources botserver/src/core/bot/ api_catalog/ and endpoint_inventory*.rs, the intentional route catalog merged by the reference generator.
BASIC botserver/src/basic/keywords/ and botserver/crates/botbasic_*/src/keywords/ Keyword registrations and the code-facing keyword reference.
App catalog botserver/src/apps/registry/ AppDefinition entries, categories, ownership and requirement checks.
Feature crates botserver/crates/*/ Independently compiled capabilities, wired in through Cargo features.
Database botschema/src/ and botserver/migrations/ Diesel declarations and the SQL migrations that create them.

Crate map

A curated set; the full module list is in Module Structure.

Crate Responsibility (from its manifest or crate documentation)
botbasic_types Shared types and runtime trait for BASIC keyword crates.
botbasic_compiler Syntax transforms, goto logic, save conversion and tool parsing.
botbasic_core Arrays, math, validation, date/time, strings and control flow.
botbasic_data Database operations, tables, memory, knowledge base, CRM and products.
botbasic_comms Messaging, email, SMS, social, chat, webhooks and calendar.
botbasic_ai LLM, AI tools, MCP, sandbox, orchestration and web scraping.
botbasic_system Bot management, file operations, scheduling, security and app server.
botagent Always-On Agent Mode: per-user Incus VMs, snapshots, CLI bridges and sandbox execution (crates/botagent/src/lib.rs).
botsecurity-auth Authentication, authorization and session management.
botllm LLM provider implementations and core types.
botqdrant Qdrant vector database client.
botmarketplace Public skills catalog and publish/install into bot Drive buckets.

One schema, one home

table! and joinable! declarations belong in botschema/src/**. Feature crates do not redeclare a table; they re-export from the schema crate, for example pub use botschema::support_tickets; in botserver/crates/bottickets/src/lib.rs. A schema change goes through a migration, then botschema, then the re-export. The generated database reference is the table index; the architecture overview and building from source cover the runtime shape and toolchain.

One app catalog

all_apps() in src/apps/registry/mod.rs merges entries.rs and entries_extra.rs. Each entry is an AppDefinition with an id, title, category, URL, owner, status and launch visibility. The suite reads the catalog through GET /api/apps/catalog; the generated app registry is the published table.