Building Bots
🗄️ Vault
Every bot gets its own isolated Vault — a SQLite database that lives on the Engine. Define the schema in your dashboard; the Engine creates or migrates it on every deploy.
🏗️Defining Your Schema
Add tables and columns in the Vault tab. This is what a table looks like:
🗄️
scoresVault table · 3 columns
user_idPKusernamepoints📐Under the hood — your schema as SQL
TypeScript
// Your Vault schema becomes real SQLite tables:
db.run(`
CREATE TABLE IF NOT EXISTS scores (
user_id TEXT PRIMARY KEY, -- type: TEXT, primaryKey
username TEXT DEFAULT '', -- type: TEXT, default ""
points INTEGER DEFAULT 0 -- type: INTEGER, default 0
)
`);
// The Engine applies CREATE TABLE IF NOT EXISTS on every deploy — safe and additive.📊Column Types
| Type | Stores | Good for |
|---|---|---|
📝 TEXT | String text | User IDs, names, messages, ISO timestamps |
🔢 INTEGER | Whole numbers | Counters, scores, Discord snowflakes |
💫 REAL | Floating-point numbers | Averages, percentages |
✅ BOOLEAN | True/false (stored as 0/1) | Flags, active/inactive states |
📦 BLOB | Raw binary data | Rarely needed — prefer TEXT |
🧩Vault Pieces
Access your Vault from any flow using base.db.* pieces — part of the Base Set.
📖 Read from Vault
📖Vault
Read from Vault
base.db.readtablerequired
scores
filterColumn
user_id
filterValue
{{input.user.id}}
asrequired
result
found
empty
Results land in {{result}} — use {{result.0.points}}.
✏️ Write to Vault
✏️Vault
Write to Vault
base.db.writetablerequired
scores
upsert
true
Turn on upsert to update existing rows by primary key.
🗑️ Delete from Vault
🗑️Vault
Delete from Vault
base.db.deletetablerequired
scores
filterColumn
user_id
filterValue
{{input.user.id}}
Always set a filter — without one, the entire table is wiped.
📐Naming Rules
Table and column names must be lowercase snake_case — letters, digits, underscores only. Must start with a letter.
✅ Valid
scores
user_data
message_log
ban_records
❌ Invalid
UserScores (uppercase)
1scores (starts digit)
my-table (hyphen)
🚀Schema on Deploy
New table→ Created automatically
New column on existing table→ Added (with default if specified)
Removed table or column→ Left intact — data is never dropped automatically
⚠️Data is never dropped automatically
Removing a table or column from your schema leaves the data in SQLite. To remove data, use Delete from Vault explicitly.