secondsky avatar

Bun Drizzle Integration

This drops Drizzle ORM into Bun projects with SQLite, giving you type-safe queries without writing raw SQL. The setup is minimal: add the packages, define your schema in TypeScript, run migrations with drizzle-kit. What's nice is the relational query API that lets you pull nested data without manual joins, and the prepare() method for reusing statements in tight loops. It includes practical examples of upserts, transactions, and the json column mode for SQLite. If you're already on Bun and want an ORM that feels like TypeScript instead of fighting it, this covers the integration patterns and CRUD operations you'll actually use.

skills.sh installs
353
GitHub stars
248
last updated
Aug 21, 2026

Install

$ npx -y skills add secondsky/claude-skills --skill bun-drizzle-integration --agent claude-code

Installs into .claude/skills of the current project.

Files

Bun Drizzle Integration

Drizzle ORM provides type-safe database access with Bun's SQLite driver.

Quick Start

bun add drizzle-orm
bun add -D drizzle-kit

Schema Definition

// src/db/schema.ts
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";

export const users = sqliteTable("users", {
  id: integer("id").primaryKey({ autoIncrement: true }),
  name: text("name").notNull(),
  email: text("email").notNull().unique(),
  createdAt: integer("created_at", { mode: "timestamp" })
    .notNull()
    .default(sql`(unixepoch())`),
});

export const posts = sqliteTable("posts", {
  id: integer("id").primaryKey({ autoIncrement: true }),
  title: text("title").notNull(),
  content: text("content"),
  authorId: integer("author_id")
    .notNull()
    .references(() => users.id),
});

Database Setup

// src/db/index.ts
import { drizzle } from "drizzle-orm/bun-sqlite";
import { Database } from "bun:sqlite";
import * as schema from "./schema";

const sqlite = new Database("app.db");
export const db = drizzle(sqlite, { schema });

Configuration

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Categories
Backend & APIs, Databases
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1jezweb avataremail-gatewayjezweb/claude-skillsMulti-provider email sending for Cloudflare Workers and Node.js applications. Build transactional email systems with Resend (React Email support), SendGrid (ent342skills.sh installs
2bobmatnyc avatargraphqlbobmatnyc/claude-mpm-skillsGraphQL query language and runtime for APIs enabling clients to request exactly the data they need with strongly-typed schemas and single endpoint architecture.340skills.sh installs
3secondsky avatarbun-http-serversecondsky/claude-skillsUse when building HTTP servers with Bun.serve, handling requests/responses, implementing routing, creating REST APIs, or configuring fetch handlers.336skills.sh installs
4jezweb avatarazure-authjezweb/claude-skillsMicrosoft Entra ID (Azure AD) authentication for React SPAs with MSAL.js and Cloudflare Workers JWT validation using jose library. Full-stack pattern with Autho327skills.sh installs
5patricio0312rev avatarqueue-job-processorpatricio0312rev/skillsImplements background job processing with BullMQ/Redis including job queues, workers, scheduling, retries, and monitoring. Use when users request "background jo295skills.sh installs
6patricio0312rev avatarapi-security-hardenerpatricio0312rev/skillsHardens API security with rate limiting, input validation, authentication, and protection against common attacks. Use when users request "API security", "secure284skills.sh installs