News & Announcements

Netlify Database is now available: from provisioning to integrated Postgres

Netlify Database

Whatever AI platform you’re building new sites and apps with these days, getting a database thrown into the mix is a given. The agent will do the scaffolding and create the schema and code for you, which goes a pretty long way.

When we launched Netlify DB, the beta of Netlify Database, about a year ago (decades in AI-years), we had a more modest goal: we provisioned a database for you to use however you wanted, with or without AI. That was a nice shortcut to provisioning a database, but it quickly got behind today’s standards.

So when it came time to plan beyond the beta, the typical path would have been to tighten the integration with our AI features, apply some tweaks and fixes based on feedback, and remove the beta sticker. But as these agents evolved, simply provisioning a database wasn’t enough to keep them from breaking things.

Instead, we took a different approach.

We learned a lesson which prompted us to more deeply rethink our approach and go beyond a few fixes and tweaks. We realized that for a database solution to be truly integrated, it can’t just be another layer glued on top. It must offer the exact same degree of safe, isolated experimentation that code builders have enjoyed for years.

Today, Netlify becomes the only platform that natively pairs Deploy Previews with completely isolated database branches.

Safe experimentation is key

If your integrated database only has a single environment — “production” — it will break. That’s pretty much a given if you work in a team. But it turns out to be very common even for a solo developer. While building, you or an AI agent will make changes that break the live site. Some other changes you may end up wanting to revert, but rolling back database changes is often a special kind of nightmare.

In some other tools, there’s a built-in concept of a development database vs. a production one. That’s better, but still leaves a lot to be desired:

  • How do you manage iterating on multiple features at the same time? Some you want and some you end up shelving.
  • What happens if there’s a team involved? How do you untangle sticky conflicts?

Development teams have struggled with all of this as well. Many teams still have a few shared environments (often known as “staging” or “QA”) that are in a continually semi-broken state. Every working day, someone pushes their half-baked work to the same place, then semi-randomly adds or modifies data to test it. The pain is real.

Modern databases do offer a solution: branching. But branching has long been a pro-level feature that one has to know exactly how to set up and use. It’s a raw feature, rather than a workflow.

We’re all expected to be 10x builders today (no stress!). In practical terms, that means trying out more things, building and experimenting more, parallelizing more. Tooling to democratize that is essential. To provide you with a real solution, we went back to first principles. We can’t just provision a database for you and set our AI agent loose. Rather, we have to provide a workflow which bakes in pro-level best practices by default, for everyone.

We’re not trying to re-invent industry standards. We’re sticking to Postgres. All the needed tooling already exists out there. Our job has been to bring it all together.

An opinionated workflow

Here’s the workflow, in concrete terms:

  1. Whenever you start an agent run with Netlify’s Agent Runners and select the agent of your choice (Claude Code, Codex, Gemini), the agent will first decide whether a database is needed. If so, it provisions one, similar to what any comparable platform would do.
  2. On Netlify, however, each agent run also automatically gets its own database branch. The new branch is based on the latest production data, but all schema or content changes are contained within this branch.
  3. As the agent runs and generates new code, it also updates the data schema as needed by generating migration files. These include SQL commands to alter the database structure to its desired form.
  4. When the preview is built to showcase the latest changes, these commands are automatically run on that database branch while production remains unmodified. In fact, the agent does not have the credentials to alter production even if it wanted to.
  5. You can now use the preview to test your site, including adding, deleting, or modifying any data. It all happens solely in the dedicated branch so other agent runs made by you or others aren’t impacted.
  6. Only when (and if!) you choose to publish your changes to production does a new production deploy take place. It’s based on the latest code files, which include the migration files. Netlify figures out which migration files need to run and applies them to the database. This updates the structure to the new form your code expects.

A solution for every type of builder

We’ve also designed the workflow to be a great fit for the most tech-savvy teams. Netlify Database is anything but a toy.

If you’re a developer using Git, provisioning a new database is simple. Include the @netlify/database NPM package in your dependencies and deploy to Netlify. Netlify detects this package and creates the database. This package acts as an optimized driver, automatically selecting the best connection method based on the context your code runs in. This package is optional, but highly recommended.

Every pull request or Git branch you make automatically gets its own database branch. If you use migration files, these are automatically applied when you deploy a preview or publish to production. You don’t have to use any special tooling, but we’ve made sure that popular options like Drizzle ORM and its drizzle-kit utility for migrations are a breeze to use.

To learn more about the dev workflow, including local development and a skill file for your favorite AI tool, visit the docs.

How to get started

The easiest way to begin is to start a new project on Netlify. Go to our start page, tell the agent what you want, and it will build the project for you with the database included.

Our AI agent doesn’t like over-engineering, so it will only use a database if actually necessary. For a simple prompt that gets a database running, try: “I want an app to manage my list of mythical creatures.” Give it a try with your own prompt!

To read about other ways to start, learn more.

Clear and simple billing

Netlify Database is available on all Netlify credit-based plans.

We are serious about keeping our meters clear and simple, so we’re using the existing meters and rates you already know:

  • Compute: When the database is active, it consumes compute units. When it’s not in use, it automatically scales to zero and goes to sleep. On a paid plan, you can control how quickly it sleeps, ranging from 5 minutes to never. You can also set the minimum and maximum resources it consumes while running.
  • Bandwidth: When your code makes requests to the database, the response traffic is billed at the same bandwidth rates as traffic from our edge network. This typically happens from serverless functions or during a build.

Your specific plan also determines your quota of databases per account and the number of allowed branches. It also covers the expiry time of automated backups and other configuration options.

If you’re on a Netlify legacy plan you will need to update your plan to use Netlify Database.

Transitioning from a beta database

Despite making little noise during the beta period, our users created over 400,000 databases. During the beta period, any customer who wanted to keep their database beyond seven days had to claim it by transferring the database to their own Neon account.

We’re continuing our partnership with Neon to power our new databases because that relationship was proven at scale. What has changed is that we are now fully managing the experience for you, from the simplest one-off tests to serious production workloads. Providing an opinionated workflow that just works, and grows with you, requires us to operate the database ourselves versus just provisioning it and wishing you well.

Because any databases created during the beta are in your own Neon account, they are not ours to control. It is up to you to decide if you want to switch to a new Netlify database. If and when you do, here is the guide.

Any database created during the beta will work the same. There is no forced migration or deprecation, no added functionality, and no new charges will be billed for those instances. On the other hand, any new database created starting today gets the complete, up-to-date Netlify experience.

In closing: keeping with our tradition

Years ago, Netlify pioneered making pro-level workflows accessible to anyone. Atomic deployments and Deploy Previews made safe and fast experimentation available to every developer.

That same spirit guides us today, in building Netlify Database and all the other platform primitives we’ve been releasing. We believe in taking the best-practice setup that has benefited the few and making it the new default for all builders.


Keep reading

Recent posts

How do the best dev and marketing teams work together?