Free course

Cloudflare D1 Course

Build a relational Worker application with D1, SQLite, prepared statements, migrations, local and remote databases, transactions, backups, and production operations.

5 modules · 15 lessons · No signup

Prerequisites: Cloudflare Workers, SQL and SQLite

~~~

Your progress

of lessons completed.

Course completed.

What you'll learn

Build, migrate, query, test, deploy, back up, and recover a small D1-backed application without mixing local and production data.

Course contents

  1. D1 foundations

    Understand managed SQLite, databases, bindings, local state, and where D1 fits.

    1. ✓ Understand where D1 fits
    2. ✓ Create and bind local and remote databases
    3. ✓ Check your understanding: d1 foundations
  2. Schema and migrations

    Create a schema, version changes, apply migrations deliberately, and preserve compatibility.

    1. ✓ Design a relational schema
    2. ✓ Version the schema with migrations
    3. ✓ Check your understanding: schema and migrations
  3. Queries and transactions

    Use prepared statements, binding, batches, transactions, indexes, and query plans.

    1. ✓ Prepare and bind every request value
    2. ✓ Group related writes and inspect plans
    3. ✓ Check your understanding: queries and transactions
  4. Application patterns

    Build CRUD, pagination, validation, authorization, idempotency, and optional ORM integration.

    1. ✓ Build validated and authorized CRUD
    2. ✓ Paginate and use an ORM deliberately
    3. ✓ Check your understanding: application patterns
  5. Test, back up, and operate D1

    Test real bindings, inspect production, use time travel, observe failures, and recover.

    1. ✓ Test the real schema and failure paths
    2. ✓ Back up, observe, and recover
    3. ✓ Check your understanding: test, back up, and operate d1