Skip to content

Migrate from Cloudflare D1 to Layerbase

Move a D1 database to managed libSQL on Layerbase in one guided pass. Paste your Cloudflare account ID and an API token, pick a database, and we copy the schema and data with every SQLite type intact. Your D1 keeps serving traffic the whole time.

Old database never modified or deleted
Credentials never stored
Free tier, no credit card

Why teams leave Cloudflare D1

Reachable from anywhere, not just Workers

D1 is designed to be read from a Cloudflare Worker. Layerbase libSQL is an HTTPS endpoint with an auth token, so the same database serves a Worker, a Vercel function, a container, a cron job, or your laptop.

We do not use D1 exports, on purpose

A SQL dump renders every number through JavaScript, which quietly rounds any integer past 2^53. We read your rows over the query API with the encoding done inside SQLite, so an int64 id arrives exactly as stored. Cloudflare documents the precision limit; we route around it.

No read or write metering

D1 bills rows read and rows written. A Layerbase libSQL database costs the same whatever your traffic does, on flat plans with a free tier. A busy day stops being a billing question.

A database with a dashboard

Web SQL console, backups, TLS by default, and branching, sitting next to your Postgres, Redis and everything else in one account rather than in another provider tab.

Four steps, one pass

  1. 1

    Create a free account or sign in

    Sign in with Google or GitHub. No credit card is needed to start, and the migration wizard opens with this platform already selected.

  2. 2

    Connect your account

    Paste your Cloudflare account ID (Workers and Pages overview, or the /accounts/<id> segment of your dashboard URL) and an API token with D1 Read on that account (My Profile, then API Tokens). We list your D1 databases so you can pick one, then copy its schema and data into a new managed libSQL database, preserving every SQLite type.

  3. 3

    Pick what to migrate and name it

    Choose what to bring over, give the new Layerbase database a name, and start the migration. Progress streams live in the dashboard.

  4. 4

    We copy it in one pass

    The migration reads from Cloudflare D1 once and never writes to it. Credentials are used for the copy and never stored. When it finishes, you land in your new database with a live TLS connection string.

Common Cloudflare D1 migration questions

What credentials do I need?

Your Cloudflare account ID and an API token with the D1 Read permission, scoped to that account. Create it under My Profile, then API Tokens, as a custom token. A Global API Key will not work: it is not a bearer token. We list the D1 databases on the account so you pick one rather than hunting for an id.

Does the migration change or pause my D1 database?

No. The importer only issues read statements, and reads do not block D1, so your Worker keeps serving traffic while the copy runs. Note this also means the copy is not a single point-in-time snapshot: we compare row counts before and after and tell you if anything was written mid-copy.

Do large integers and blobs survive exactly?

Yes, and that is the reason for the approach. Integers cross the wire as exact decimal text, floats through a full-precision format, and text and blobs as hex, so nothing numeric is ever routed through a JavaScript number. Snowflake ids, nanosecond timestamps and bitfields come across unchanged.

What about generated columns and full-text search?

Generated columns are detected and left for libSQL to recompute, so they stay generated rather than becoming frozen values. Full-text search tables are recreated, but their index content is not copied: rebuild those after the import and the migration report tells you which ones.

Does my application code change?

You swap the D1 binding for a libSQL client. On Drizzle that is a one-line driver change from the D1 driver to the libSQL one. The SQL itself does not change, because libSQL is SQLite.

Ready to leave Cloudflare D1?

Sign in, and the migration wizard opens with Cloudflare D1 already selected. Your source is read once and never modified, so there is nothing to undo if you change your mind.