cloudflare-d1

Set up Cloudflare D1 with Workers and Drizzle ORM migrations.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/AdigunQ/ralph-smart --skill cloudflare-d1-adigunq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudflare-d1
Source: https://github.com/AdigunQ/ralph-smart/tree/main/knowledges/bootstrap_skills/cloudflare-d1
Command: npx skills add https://github.com/AdigunQ/ralph-smart --skill cloudflare-d1-adigunq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the process of setting up and managing a serverless SQLite database (Cloudflare D1) integrated with Cloudflare Workers, enabling type-safe database interactions and efficient migrations.

Core Features & Use Cases

  • D1 Database Setup: Guides through creating and configuring D1 databases with Wrangler.
  • Drizzle ORM Integration: Demonstrates schema definition, migration generation, and type-safe querying using Drizzle ORM.
  • Worker Implementation: Provides examples of integrating D1 with Cloudflare Workers using Hono or raw D1 APIs.
  • Use Case: Develop a scalable, real-time application on Cloudflare's edge network, leveraging a managed SQLite database for data persistence with robust type safety and version-controlled schema changes.

Quick Start

Follow the project setup instructions to create a new Cloudflare Worker project and initialize a D1 database.

Frequently Asked Questions about cloudflare-d1

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

FAQPage Schema
How do I set up a Cloudflare D1 database with Workers?

You set up a Cloudflare D1 database by initializing a Workers project and using Wrangler to create the serverless SQLite database instance for edge data persistence.

Can I use Drizzle ORM with Cloudflare D1 for type-safe queries?

Yes, you can integrate Drizzle ORM with Cloudflare D1 to define database schemas, generate migrations, and execute type-safe SQLite queries directly within your Cloudflare Workers environment.

What is the best way to manage D1 database migrations across multiple environments?

The best way to manage D1 migrations is using Drizzle ORM to generate version-controlled schema changes, which you then apply across local development and multi-environment Cloudflare deployments.

How do I test Cloudflare Workers interacting with a D1 database locally?

You test Cloudflare Workers and D1 databases locally by configuring Wrangler for local development, allowing you to validate serverless SQLite schema interactions and query logic before remote deployment.

Does Cloudflare D1 support raw SQL queries or only ORM interactions?

Cloudflare D1 supports both raw SQL queries via the native D1 APIs and type-safe ORM interactions through Drizzle ORM, allowing flexible implementation choices within your Cloudflare Workers code.