djs-core ships a native Drizzle layer — no plugin required. Configure db: in djs.config.ts, define your schema in db/schema.ts, and query via interaction.client.db.

Official database plugins (@djs-core/plugin-drizzle, @djs-core/plugin-sql, @djs-core/plugin-prisma-sqlite) are deprecated. See the migration guide.

Quick start

  1. Configure db in djs.config.ts

    import { defineConfig } from "@djs-core/runtime";
    export default defineConfig({
    token: process.env.TOKEN!,
    servers: ["YOUR_GUILD_ID"],
    db: {
    dialect: "sqlite",
    },
    });
  2. Scaffold db/

    Terminal window
    djs-core db init

    Creates db/schema.ts and db/migrations/.

  3. Define schema and migrate

    Edit db/schema.ts, then:

    Terminal window
    djs-core db generate
    djs-core db migrate
  4. Query in a command

    import { Command } from "@djs-core/runtime";
    import { eq, schema } from "@djs-core/db";
    export default new Command()
    .setDescription("List todos")
    .run(async (interaction) => {
    const items = await interaction.client.db
    .select()
    .from(schema.todos)
    .where(eq(schema.todos.id, 1));
    await interaction.reply(JSON.stringify(items));
    });

Configuration

Option Type Description
dialect "sqlite" | "postgresql" | "mysql" | "turso" Database driver
url string Connection URL (optional — defaults per dialect)
autoMigrate boolean Apply migrations on bot startup (default: false)

SQLite uses file:./db.sqlite by default. PostgreSQL reads DATABASE_URL. Turso reads TURSO_DATABASE_URL and TURSO_AUTH_TOKEN.

Keep autoMigrate disabled in production and run djs-core db migrate in your deploy pipeline. Multiple bot instances with autoMigrate: true can race on the same database.

CLI

Command Description
djs-core db init Scaffold db/schema.ts and migrations folder
djs-core db generate Generate SQL migration from schema
djs-core db migrate Apply pending migrations
djs-core db push Push schema directly (dev)
djs-core db studio Open Drizzle Studio
djs-core db pull Pull schema from database

Drizzle Kit config is synced from djs.config.ts — you do not need a separate drizzle.config.ts.

Typing

When db: is configured, djs-core generates .djscore/db.d.ts and adds TypeScript paths so interaction.client.db is fully typed against your schema.

Bundle

If db: is not set, database code is tree-shaken from the production bundle.