Introducing Managed Databases for Mastra Projects

Provision a database for your Mastra project in seconds.

Joel SmithJoel Smith·

Jun 16, 2026

·

4 min read

Mastra platform users can now provision their own database without leaving the dashboard. Open a project, go to the Project Settings tab, scroll down to Databases, click Add database, pick a provider, and you have a real database in a few seconds.

Turso, LibSQL, and Postgres (backed by Neon) are supported out of the box, with MongoDB coming soon.

Get to production quicker

While DBs have certainly gotten easier to deploy and connect with applications in the past decade, when you’re getting a project live, there always comes a moment where you have to sort through how exactly to get the right one setup. What’s the connection string? Do we have staging setup yet? What card did we use with that provider?

Over the last couple months, we’ve seen a number of our users, especially those just getting started in their agent-building journey, look for an easy, off-the-shelf solution when it comes to backing their Mastra agent, whether they're using LibSQL, Postgres, or any number of supported datastores.

So now, you can get that easy-to-use database right in the Mastra platform with one-click deployments and easy integrated billing.

Managed databases are just Mastra storage Once a database is attached, using it is ordinary Mastra code. The connection panel hands you the exact snippet for your provider.

For Turso or LibSQL:

TypeScriptsrc/mastra/storage.ts
import { LibSQLStore } from '@mastra/libsql'
 
export const storage = new LibSQLStore({
  url: process.env.TURSO_DATABASE_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN!,
})

For Postgres (backed by Neon):

TypeScriptsrc/mastra/storage.ts
import { PostgresStore } from '@mastra/pg'
 
export const storage = new PostgresStore({
  connectionString: process.env.DATABASE_URL!,
})

Then hand the store to your Mastra instance and your agent has durable memory and storage:

TypeScriptsrc/mastra/index.ts
import { Mastra } from '@mastra/core'
import { storage } from './storage'
 
export const mastra = new Mastra({
  // ...
  storage,
})

Choosing a provider

Right now we support multiple flavors of DB provider:

Turso and LibSQL are SQLite at the edge. This is a strong default for agent memory and per-tenant isolation, provisioned in dozens of regions worldwide.

Postgres, backed by Neon: serverless Postgres for structured, relational workloads, available across AWS and Azure regions.

MongoDB is coming soon — the document store, for data that's naturally shaped like documents rather than rows.

You pick the region at attach time, and we will default to a sensible one if you don't.

Pricing

Managed databases are billed on usage, metered per provider, with a free tier to get started — and it all runs through your existing Mastra account.

  • Turso / LibSQL — includes a free tier of 1M rows written and 1GB of storage per month, then $2.50 per million rows read and $1 per GB-month of storage.
  • Postgres (Neon) — includes a free tier of 5 compute-hours and 1GB storage per month, then $0.50 per compute-unit-hour and $1 per GB-month of storage.

Usage is metered continuously and rolled up daily. You can see exactly what each database is consuming on its card in the Database tab — reads, writes, and storage over the current billing period — so there are no surprises at the end of the month. For the full breakdown, see the pricing page.

Get started

If you already have a Mastra project on the platform, open it, go to the Project Setting tab, scroll down to the Databases section and click Add database. You'll have a connected database before you've finished reading this sentence.

If you're starting fresh:

npm create mastra@latest

Then deploy your project, attach a database, and let the env vars wire themselves in.

For the full walkthrough, see the managed databases docs. We'd love to hear what you build, and which provider you reach for first.

Share:
Joel Smith
Joel SmithHead of Platform

Joel Smith is the Head of Platform at Mastra, leading product and engineering efforts around the entire Mastra platform. A high school English teacher turned software engineer turned product/engineering manager, he previously led product and engineering teams in early stage startups focused on blockchain data, incident management and developer tools infrastructure.

All articles by Joel Smith