bun-drizzle-integration

Integrates Drizzle ORM with Bun's SQLite driver for type-safe schemas, migrations, and CRUD operations.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-drizzle-integration-aicodepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-drizzle-integration
Source: https://github.com/aicodepro/ai-agent-nexi/tree/main/agent/skills/bun-drizzle-integration
Command: npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-drizzle-integration-aicodepro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires drizzle-orm, drizzle-kit, and includes references (resource) components.

What problem does it solve? Setting up a type-safe database layer in Bun projects requires wiring together Drizzle ORM, the bun:sqlite driver, schema definitions, and migration tooling, which is error-prone when done from scratch. ## Core Features & Use Cases - Schema Definition: Define SQLite tables with typed columns including text, integer, real, blob, boolean, timestamp, and JSON modes. - Migrations & Tooling: Generate, apply, and push migrations with drizzle-kit, plus inspect data through Drizzle Studio. - Full CRUD & Relations: Perform inserts, upserts, filtered selects, updates, deletes, relational queries, transactions, and prepared statements. - Use Case: When building a Bun backend API, use this Skill to scaffold the database layer, define user and post tables with relations, and run migrations before writing endpoint logic. ## Quick Start Set up Drizzle ORM with Bun's SQLite driver in my project, including a users table schema, database connection, and initial migration.

Frequently Asked Questions about bun-drizzle-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Drizzle ORM with Bun SQLite?

Install drizzle-orm and drizzle-kit, then create a Database instance from bun:sqlite and pass it to drizzle() from drizzle-orm/bun-sqlite along with your schema. Define tables in a schema file and configure drizzle.config.ts with the sqlite dialect.

How to run migrations with drizzle-kit in Bun?

Run bun drizzle-kit generate to create migration files from your schema, then bun drizzle-kit migrate to apply them. During development you can use bun drizzle-kit push to sync the schema directly without migration files.

Does Drizzle ORM support relations and nested queries in SQLite?

Yes, define relations using the relations() helper with one() and many(), then query them with db.query.tableName.findMany({ with: ... }). Nested relations are supported by chaining with clauses for deeper data loading.

How do I do an upsert in Drizzle ORM with SQLite?

Use .onConflictDoUpdate() with a target column and a set object on your insert statement. For skipping conflicts instead, use .onConflictDoNothing() after the values() call.

Why do I get a 'Cannot find module' error with Drizzle in Bun?

This error occurs when importing the wrong driver path. Use drizzle-orm/bun-sqlite specifically for Bun's native SQLite driver rather than the better-sqlite3 or node-sqlite variants.