Skip to content

Choose a Database for Your Project

Compare Cloudflare D1, Neon Postgres, and Supabase, and see what you need to connect each one to your project.

Use a database when your app needs to keep records beyond a browser preview. Start with the SQL engine and services your app needs, then configure its database connection. A database entry in Cloud Studio records your provider choice, but it doesn’t create an instance with that provider.

Compare database engines

EngineChoose it when you needClient and schema tools
Cloudflare D1SQLite at the edge for a lightweight app, a content site, or a read-heavy workloadDrizzle ORM
Neon PostgresServerless PostgreSQL with relational schemas, branches for testing changes, or autoscalingDrizzle ORM, Prisma, or @neondatabase/serverless
SupabasePostgreSQL alongside user authentication, file storage buckets, or realtime subscriptions@supabase/supabase-js or Drizzle ORM

Check where your queries will run before you settle on an engine. A Worker reads D1 through a database binding. A Neon client uses a Postgres connection string. If you use Supabase’s app services, their client uses the project URL and API key instead of the Postgres connection string. Those values aren’t interchangeable, even when they all belong to the same project.

Connect the app to its database

Create the database

Create the instance with your database provider and keep its connection details handy. A Studio entry marked unprovisioned isn’t a working connection, even if it shows a provider and starter schema.

Configure the application

Set up the binding or put the connection settings in the project’s environment. For a Postgres client, that can mean setting DATABASE_URL. Check that the app has the client library or ORM configuration appropriate to the provider before trying a query.

Prepare the schema

Describe the data model in Studio chat to have Bhai generate SQL migrations. Check the SQL dialect and the intended database before applying the change. Run a query against that database to check that the schema is ready for the application.

Cloud Studio’s in-browser PGlite preview is a separate database target. A query that works there doesn’t verify that your deployed application can reach its own database or that the deployed schema has the same tables.

Next

Was this page helpful?