Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cargo Feature Map

This document provides a comprehensive reference for all Cargo.toml feature flags in General Bots, their dependencies, and how to use them for optimized builds.

Overview

General Bots uses Rust’s feature flag system to enable modular compilation. This allows you to:

  • Reduce binary size by excluding unused features
  • Minimize dependencies for faster compilation
  • Customize deployments for specific use cases
  • Control resource usage in constrained environments

Feature Categories

┌─────────────────────────────────────────────────────────────┐
│                    BUNDLE FEATURES                          │
│  ┌─────────────┐ ┌─────────────┐ ┌───────────┐ ┌─────────┐ │
│  │communications│ │productivity │ │ documents │ │  full   │ │
│  └──────┬──────┘ └──────┬──────┘ └─────┬─────┘ └────┬────┘ │
└─────────┼───────────────┼──────────────┼────────────┼──────┘
          │               │              │            │
          ▼               ▼              ▼            ▼
┌─────────────────────────────────────────────────────────────┐
│                    APPLICATION FEATURES                      │
│  chat, mail, meet, calendar, tasks, drive, docs, paper...   │
└─────────────────────────────────────────────────────────────┘
          │
          ▼
┌─────────────────────────────────────────────────────────────┐
│                    CORE TECHNOLOGIES                         │
│     cache, automation, llm, vectordb, monitoring...         │
└─────────────────────────────────────────────────────────────┘

Default Features

The default feature set provides a minimal but functional installation:

default = ["chat", "drive", "tasks", "automation", "cache", "directory"]
FeaturePurpose
chatAI chat interface
driveFile storage and management
tasksTask scheduling and management
automationBASIC script engine (Rhai)
cacheRedis session caching
directoryUser directory services

Communication Features

Features for messaging, email, and real-time communication.

FeatureDependenciesDescription
chat-Core chat functionality
people-Contact management
maillettre, mailparse, imap, native-tlsFull email client (IMAP/SMTP)
meetlivekitVideo conferencing
social-Social network integrations
whatsapp-WhatsApp Business API
telegram-Telegram Bot API
instagram-Instagram messaging
msteams-Microsoft Teams integration

Bundle: communications

Enables all communication features:

communications = ["chat", "people", "mail", "meet", "social", 
                  "whatsapp", "telegram", "instagram", "msteams", "cache"]

Productivity Features

Features for task management, scheduling, and project planning.

FeatureDependenciesDescription
calendar-Event scheduling
taskscron, automationTask management with scheduling
projectquick-xmlProject (MS Project style)
goals-Goal tracking and OKRs
workspace-Workspace management
tickets-Support ticket system
billing-Invoicing and payments

Bundle: productivity

productivity = ["calendar", "tasks", "project", "goals", "workspaces", "cache"]

Document Features

Features for document processing and file management.

FeatureDependenciesDescription
driveaws-config, aws-sdk-s3, aws-smithy-async, pdf-extractCloud storage (S3-compatible)
docsdocx-rs, ooxmlsdkWord document processing
paperdocs, pdf-extractAI-assisted writing
sheetcalamine, spreadsheet-odsSpreadsheet processing
slidesooxmlsdkPresentation processing

Bundle: documents

documents = ["paper", "docs", "sheet", "slides", "drive"]

Media Features

Features for video, audio, and visual content.

FeatureDependenciesDescription
video-Video processing
player-Media playback
canvas-Visual editor/whiteboard

Bundle: media

media = ["video", "player", "canvas"]

Learning & Research Features

Features for AI-powered research and learning.

FeatureDependenciesDescription
learn-Learning management
researchllm, vectordbAI research assistant
sources-Knowledge source management

Bundle: learning

learning = ["learn", "research", "sources"]

Analytics Features

Features for monitoring and business intelligence.

FeatureDependenciesDescription
analytics-Usage analytics
dashboards-Custom BI dashboards
monitoringsysinfoSystem monitoring

Bundle: analytics_suite

analytics_suite = ["analytics", "dashboards", "monitoring"]

Development Features

Features for bot development and automation.

FeatureDependenciesDescription
designer-Visual bot builder
editor-Code editor
automationrhai, cronBASIC script engine

Bundle: development

development = ["designer", "editor", "automation"]

Admin Features

Features for system administration.

FeatureDependenciesDescription
attendant-Human handoff queue
security-Security settings
settings-Configuration UI

Bundle: admin

admin = ["attendant", "security", "settings"]

Core Technologies

Low-level features that other features depend on.

FeatureDependenciesDescription
llm-LLM integration framework
vectordbqdrant-clientVector database for RAG
nvidia-NVIDIA GPU acceleration
cacheredisSession caching
compliancecsvCompliance/audit tools
timeseries-Time-series database
weba-Web accessibility features
directory-User directory services
progress-barsindicatifCLI progress indicators
grpctonicgRPC server
jemalloctikv-jemallocator, tikv-jemalloc-ctlMemory allocator
consolecrossterm, ratatui, monitoringTerminal UI mode

Build Profiles

Minimal Build

Smallest possible binary with core functionality:

cargo build --release --no-default-features --features "chat,cache"

Size: ~15MB
Use case: Embedded devices, edge computing

Lightweight Build

Core office features without heavy dependencies:

cargo build --release --no-default-features \
  --features "chat,drive,tasks,cache,directory"

Size: ~25MB
Use case: Small deployments, resource-constrained servers

Standard Build (Default)

Balanced feature set for most deployments:

cargo build --release

Size: ~40MB
Use case: General purpose, development

Full Build

All features enabled:

cargo build --release --all-features

Size: ~80MB+
Use case: Enterprise deployments, feature testing

Dependency Matrix

Feature          | External Crates                      | Size Impact
-----------------+--------------------------------------+-------------
mail             | lettre, mailparse, imap, native-tls  | ~2MB
meet             | livekit                              | ~5MB
vectordb         | qdrant-client                        | ~3MB
drive            | aws-sdk-s3, aws-config               | ~4MB
docs             | docx-rs, ooxmlsdk                    | ~2MB
sheet            | calamine, spreadsheet-ods            | ~1MB
automation       | rhai, cron                           | ~2MB
cache            | redis                                | ~1MB
console          | crossterm, ratatui                   | ~1MB
monitoring       | sysinfo                              | ~500KB

Runtime Configuration

Features can be further controlled at runtime via the .product file:

# .product file
name=My Custom Bot
apps=chat,drive,tasks
theme=dark

The effective app list is the intersection of:

  1. Features compiled in Cargo.toml
  2. Apps enabled in .product file

This means you can compile with many features but only expose a subset to users.

API Endpoint

The /api/product endpoint returns the current feature matrix:

{
  "name": "General Bots",
  "apps": ["chat", "drive", "tasks"],
  "compiled_features": ["chat", "drive", "tasks", "automation", "cache", "directory"],
  "theme": "sentient"
}

Checking Compiled Features

In Rust code, use conditional compilation:

#![allow(unused)]
fn main() {
#[cfg(feature = "mail")]
fn handle_email() {
    // Only compiled when mail feature is enabled
}
}

At runtime, check the COMPILED_FEATURES constant:

#![allow(unused)]
fn main() {
use crate::core::features::COMPILED_FEATURES;

if COMPILED_FEATURES.contains(&"mail") {
    // Feature is available
}
}

Best Practices

  1. Start minimal: Begin with the default features and add as needed
  2. Use bundles: Prefer bundle features over individual ones for consistency
  3. Test builds: Verify functionality after changing features
  4. Document requirements: List required features in deployment docs
  5. Monitor size: Track binary size as features are added

See Also