Databases
Your bot's Databases tab: one click on Create and your bot gets its own database, visible only to it. On the next start, it receives its credentials as environment variables: nothing to copy.
| Database | For | Variables |
|---|---|---|
| PostgreSQL | Levels, economy, per-server settings (Prisma, Sequelize, Drizzle…) | DATABASE_URL, PGHOST, PGUSER… |
| MySQL (MariaDB) | Bots or tutorials already written for MySQL | MYSQL_URL, MYSQL_HOST… |
| Redis | Cache, cooldowns, counters | REDIS_URL, REDIS_PREFIX… |
js
const { Pool } = require('pg');
const db = new Pool({ connectionString: process.env.DATABASE_URL });DATABASE_URLpoints to PostgreSQL if the bot has one, otherwise to MySQL. A variable with the same name in the Variables tab still takes precedence.- Redis: every key must start with
REDIS_PREFIX(with ioredis: thekeyPrefixoption), otherwise Redis answersNOPERM. - Quota depends on the plan (shown in the tab). Above it, the database becomes read-only: the bot can read and delete, but not add. Writing comes back on its own under 90% of the quota.
- Databases are only reachable from your bot. To get your data: the Export (.sql) button.
⚠️
Deleting the bot or the database erases its data for good: export first.