💾 Database
VexAI supports SQLite (default) and PostgreSQL as database backends, with optional AI embedding storage for semantic search.
SQLite (Default)
The default backend requires zero configuration and is ideal for single-server deployments.
- WAL mode: enables concurrent read access without blocking
- FTS5 full-text search: fast text indexing on messages
- Embedding storage: separate
message_embeddingstable for AI vectors - Database file:
data/vexai.db
SQLite is production-ready for single-server bots. You only need PostgreSQL when handling multiple shards or very high traffic.
PostgreSQL
For production environments with high concurrency and advanced vector search.
- Connection pooling: configurable min/max connections
- tsvector full-text search: native PostgreSQL text indexing
- pgvector: native vector column type with IVFFlat indexing for embeddings
- Easy setup: use
docker-compose.postgres.yml
Configuration (JSON)
{
"database": {
"type": "postgres",
"url": "postgres://vexai:password@localhost:5432/vexai",
"pool": { "min": 2, "max": 10 }
}
}
Environment Variables
DATABASE_TYPE=postgres
DATABASE_URL=postgres://vexai:password@localhost:5432/vexai
Comparison
| Feature | SQLite | PostgreSQL |
|---|---|---|
| Setup | Zero-config | Requires server |
| Full-text search | FTS5 | tsvector |
| Embedding storage | Separate table | pgvector native |
| Indexing | B-tree | B-tree + IVFFlat |
| Concurrency | WAL (single-writer) | Full MVCC |
| Connection pooling | N/A | Built-in |
| Best for | Development, single server | Production, high traffic |
Live Migration
Seamlessly migrate between backends without downtime.
/migrate to-postgres: streams all data from SQLite to PostgreSQL with a live progress bar/migrate status: shows the current backend and row counts per table
Back up your SQLite database before migrating. Copy data/vexai.db to a safe location first.
Database Tables
Sequential migrations (v1–v8) create the following tables:
| Table | Purpose |
|---|---|
logs | Structured bot activity logs |
cron_jobs | Scheduled task definitions |
users | User records |
warnings | User warning history |
reminders | Time-based reminders |
auto_roles | Roles assigned on join |
welcome_config | Welcome message settings |
model_overrides | Per-user LLM model overrides |
conversations / conversation_messages | Persistent conversation history |
semantic_memories | FTS5-powered memory store |
messages / message_revisions | Discord message mirror + audit trail |
message_embeddings | AI embedding vectors |
Embedding Providers
VexAI supports multiple embedding providers for generating semantic vectors.
| Provider | Default Model | Dimensions | Notes |
|---|---|---|---|
builtin | Xenova/all-MiniLM-L6-v2 | 384 | In-process ONNX, offline, zero cost |
openai | text-embedding-3-small | 1536 | Best quality |
openrouter | openai/text-embedding-3-small | 1536 | Many models, one key |
local | nomic-embed-text | 768 | Any OpenAI-compatible endpoint |
Configuration
{
"embeddings": {
"enabled": true,
"provider": "builtin",
"model": "Xenova/all-MiniLM-L6-v2",
"dimensions": 384,
"batchSize": 50
}
}
Semantic Search
AI embedding-powered meaning-based search that finds related messages even without exact keyword matches.
- Converts messages into high-dimensional vectors capturing their meaning
- Finds semantically similar content across the entire message history
- Background worker generates embeddings for all messages automatically
- Supports similarity thresholds and result limits for precise querying
The builtin provider runs entirely offline with no API keys needed. It uses the ONNX runtime to generate embeddings in-process with zero external dependencies.