Webflow Cloud lets you store and manage structured data using SQLite, a lightweight, serverless database engine. This managed solution gives you familiar SQL syntax, secure access at the edge, and seamless integration with modern frameworks, without the need to manage servers or credentials.
Webflow Cloud handles database provisioning, security, and scaling, so you can focus on building features, not infrastructure.
Create a SQLite database by declaring bindings in your wrangler.json file in the root of your app.
When it is deployed, Webflow Cloud automatically connects your app to a managed SQLite instance.
Add a binding to your wrangler.json file
In your wrangler.json file, add a d1_databases array. Declare a binding for each database you want to use inside the array.
Note: Webflow Cloud will assign a unique ID for each resource on deployment.
Generate TypeScript types for your bindings to enable autocomplete and type safety in your code editor:
This creates/updates a worker-configuration.d.ts file with your binding types. Note: in Next.js youβll also need to update the types for the cloudflare-env.d.ts file to avoid type errors.
Deploy your app to Webflow Cloud. After deployment, you can view and manage your storage resources in the Webflow Cloud dashboard.
Webflow Cloud exposes your SQLite database to your app as an environment variable, known as a binding. This lets you interact with your database directly from your application code.
Always access the environment variable in your appβs runtime environment. This variable exposes methods from the Cloudflare Workers Bindings API, allowing you to run SQL statements directly from your code.
For full details on available methods and advanced usage, see the Cloudflare D1 Bindings API documentation.
In Astro, you can access the binding in your code using the locals object.
Webflow Cloud uses migrations to manage changes to your SQLite database schema over time. Migrations are versioned .sql files that describe how your database structure should evolve as your app changes.
When you declare your SQLite binding in wrangler.json, use the migrations_dir property to specify the directory containing your migration files. Webflow Cloud will automatically apply those migrations to your database when you deploy your app.
Additionally, Webflow Cloud supports popular ORM libraries like Drizzle ORM and Prisma-Edge for type-safe queries and schema management. See more on using an ORM with Webflow Cloud.
You can use Cloudflareβs Wrangler CLI to test migrations locally before deploying to Webflow Cloud. See more on local development with SQLite.
.sql files in the migrations directory you defined in wrangler.json. Each file should contain SQL statements that create or modify tables, indexes, or other schema elements.Example migration file:
001_init.sql, 002_add_email_index.sql).Webflow Cloudβs SQLite databases support edge-compatible ORM libraries, letting you write type-safe queries and manage schema changes with familiar tools. Drizzle ORM and Prisma-Edge are popular choices for seamless integration with Webflow Cloud.
When using an ORM, youβll typically add a dedicated folder (such as /migrations or /drizzle) to your app to store migration files and schema definitions. Be sure to specify this directory in your wrangler.json using the migrations_dir property for your SQLite binding.
You can use Cloudflareβs Wrangler CLI to develop and test your SQLite database locally before deploying to Webflow Cloud.
When you run your app locally, Wrangler creates a SQLite database in your .wrangler directory. This local database lets you test SQL statements and migrations in a safe environment. Use Wrangler CLI commands, either directly in your terminal or as scripts in package.json to run your app and execute SQL statements or files on your local database.
You can use Cloudflareβs Wrangler CLI to:
Run your app locally
This command starts your app locally, simulating the Workers runtime with your declared bindings, and creates a local SQLite database in your .wrangler directory.
Apply migrations to your local database:
Updates your local SQLite schema with any new migration files in the migrations directory defined in your wrangler.json file. Replace <DATABASE_NAME> with the name of your binding.
Execute SQL statements or files on your local database:
Run ad-hoc queries or apply SQL files directly to your local database.
These commands wonβt affect your remote database.
Add these commands as scripts in your package.json for convenience. See the following example for Next.js:
Learn about Webflow Cloud Key Value store
Explore how to store and retrieve unstructured data using Webflow Cloudβs Key Value store.
Review Limits for Webflow Cloud SQLite
Understand the limits for your databases and storage usage.
Set up a SQLite database with Drizzle ORM
Follow the guide to set up a SQLite database with Drizzle ORM.
Learn more about Webflow Cloud Explore the full capabilities of Webflow Cloud and how it can help you build your next app.
D1 is designed for horizontal scale out across multiple, smaller (10 GB) databases, such as per-user, per-tenant or per-entity databases. D1 allows you to build applications with thousands of databases at no extra cost for isolating with multiple databases, as the pricing is based only on query and storage costs.
Each D1 database can store up to 10 GB of data, and you can create up to thousands of separate D1 databases. This allows you to split a single monolithic database into multiple, smaller databases, thereby isolating application data by user, customer, or tenant. SQL queries over a smaller working data set can be more efficient and performant while improving data isolation.