Start using Netlify Database in just a few steps, no matter how far along you are in your building journey.
Create a project with a database
Section titled “Create a project with a database”If you don’t have a project yet, start one of the following ways and Netlify Database will be set up as part of the project from day one.
Start with Agent Runners
Section titled “Start with Agent Runners”Go to app.netlify.com/start and describe the application you want to build. Include the type of data you want to store and how you want to access it.
For example:
An app for managing my music collection. For each record, I want to store the title, artist name, year and medium (CD or vinyl). I want to be able to filter entries and search by any of these fields.
Agent Runners will scaffold the project, install @netlify/database, write the necessary migrations, and deploy your project to production.
Whenever you want to make any changes, you can describe them in a new agent run:
For each record, I also want to store the recording studio.
The AI agent will change the application code, create new migrations, apply them, and deploy the project to a preview URL for you to review. Once you’re happy with the result, click Publish to production and your production site is updated.
Start locally
Section titled “Start locally”If you’d rather work from your terminal, the Netlify CLI’s netlify create command kicks off the same agent-driven setup, but in your local machine:
netlify create "An app for managing my music collection. For each record, I want to store the title, artist name, year and medium (CD or vinyl). I want to be able to filter entries and search by any of these fields"Alternatively, you can let any AI agent you already use locally (Claude Code, Cursor, Codex, and others) build the project for you.
Netlify ships context files and skills that give those agents the right context for working with the platform — including for setting up Netlify Database — so a prompt like the one above gets turned into a working project with the database wired up correctly.
Add a database to an existing project
Section titled “Add a database to an existing project”If you already have an existing project, you can add a database to it with just a few steps.
With the CLI
Section titled “With the CLI”The netlify database init CLI command offers an interactive setup guide for adding Netlify Database to your project.
netlify database initThe command walks you through an interactive setup that:
- Installs
@netlify/databaseand any other packages you need for your chosen workflow - Lets you pick your preferred query style — Drizzle ORM for a type-safe query builder and schema-first migrations, or direct SQL with the
@netlify/databasepackage - Scaffolds a starter migration so you have a working schema to build on
- Optionally seeds the database with sample data, so you can run a query end-to-end and see real results before writing any code yourself
When the command finishes, you have a project that’s wired up, populated with data, and ready for a first deploy.
From there, netlify dev starts a fully-featured local Postgres database on your machine, so you can iterate without touching the production database. Refer to Local development for more details.
Manually
Section titled “Manually”If you prefer, you can set things up manually:
-
Install the
@netlify/databasepackage:Terminal window npm install @netlify/database -
Optionally, install Drizzle ORM for a type-safe query builder and schema-first migration workflow.
-
Write your first migration under
netlify/database/migrations/. -
Write a function or edge function that interacts with the database.
-
Run
netlify devor your Vite-based framework’s development server (refer to Local development for more information). -
Deploy. Netlify automatically provisions the database and applies your migration as part of the deploy lifecycle.
If you’d rather provision the database first and wire up your code afterward, you can also do that from the Netlify UI: navigate to the Database page in your project and select Create a database manually. Once the database is provisioned, follow the same steps above to install the package and write your first migration.
Did you find this doc useful?
Your feedback helps us improve our docs.