The realtime backend for agent-native apps

Build agent-native apps on one realtime backend for Postgres, auth, permissions, state, storage, workflows, and AI.

SubstrateDB dashboard showing project analytics

Substrate is one realtime backend for your database, auth, permissions, storage, workflows, and AI.

Database

Every branch within a project is a fully provisioned Postgres database, isolated and ready to use.

export default defineSchema({  tasks: table({    title: string(),    completed: boolean().default(false),  }),})

Authentication

Add secure sign ups, logins, sessions, and access controls without building identity infrastructure.

State Stores

Store durable JSON key/value state with strongly consistent reads and writes.

Object Stores

Store and serve files, media, and application assets through S3-compatible object storage.

Realtime

Build multiplayer and collaborative experiences with live maps, streams, and presence.

Workflows

Run typed durable compute with retries, scheduling, and state that survives failures and restarts.

Analytics

Understand and shape product behavior with flags, cohorts, dashboards, and Web Vitals.

And more...

AI Gateway

Unified model routing, metering, and billing.

Usage & Billing

Meter usage, billing, and entitlements in real time.

Machines

Isolated compute, ready when your workloads need it.

MCPs

Give agents secure access to your tools and data.

Observability

Inspect logs, traces, and runtime health in one place.

RLS is dead. Database-only rules get complex fast. Substrate controls access across every feature and client.

import { definePermissions } from "@substratedb/permissions";

export default definePermissions((p) => {
  const owns = p.fn("owns", (ownerId) =>
    p.user.signedIn().and(ownerId.eq(p.user.id)),
  );

  const isProjectMember = p.fn("isProjectMember", (projectId) =>
    p.user.signedIn().and(
      p.db.query.projectMembers
        .where((member) =>
          member.project.eq(projectId).and(member.userId.eq(p.user.id)),
        )
        .exists(),
    ),
  );

  return p.define(
    p.table("tasks").allow({
      create: ({ value }) => owns(value.ownerId),
      read: ({ row }) => owns(row.ownerId),
      update: ({ row, value }) => owns(row.ownerId).and(owns(value.ownerId)),
      delete: ({ row }) => owns(row.ownerId),
    }),
    p.objectStore("taskAttachments").path("task").allow({
      read: ({ params }) => isProjectMember(params.projectId),
      upload: ({ params }) => isProjectMember(params.projectId),
      delete: ({ params }) => isProjectMember(params.projectId),
    }),
  );
});

Strata is the unified querying layer for your app. One typed API spans every feature.

const { data } = substrate  .read({ from: Tasks() })  .where(Tasks().completed().eq(false))  .orderBy(Tasks().createdAt().desc())  .limit(10)  .use()

Simple for humans, easy for agents.

A small API surface is easy to learn, while reusable operations let humans and agents share the same logic everywhere.

//  Realtime task tracking// ---------------------------// Updates instantly. Works offline."use client"import { useSubstrate } from "@substratedb/react"import { Tasks } from "@substratedb/generated/schema"import { TaskList } from "@/components/task-list"export default function TasksPage({ projectId }: { projectId: string }) {  const substrate = useSubstrate()  // 1. Read  live, offline, and permission-aware  const { data: tasks = [] } = substrate    .read({ from: Tasks() })    .where(Tasks().project().eq(projectId))    .use()  // 2. Write  optimistic and automatically synced  const addTask = (title: string) =>    substrate      .write({ from: Tasks() })      .create({ project: projectId, title, ownerId: substrate.auth.user!.id })      .run()  // 3. Render  ordinary React  return <TaskList tasks={tasks} onAdd={addTask} />}

The Strata developer experience

Never leave your IDE.

Define your schema, permissions, and workflows alongside your app.

Substrate projects keep schema, permissions, workflows, events, and other backend definitions in TypeScript files inside the project.

End-to-end type safety.

Generated handles type every read, write, and result.

Strata infers tasks as a readonly array of Tasks, and infers a task title as a string or undefined.

Git for databases.

Work in isolated Postgres branches. Review every change before you push.

A database branch records an added tasks table and task ownership before deleting the table. The deletion is then reverted, returning the branch to its first commit.

Plus a realtime database for the frontend.

Optimistic updates

Changes appear instantly. Substrate reconciles with the server and rolls back automatically if a write is rejected.

Realtime by default

Reads stay current across every client. No polling, refresh buttons, or subscription plumbing.

Works offline

Keep reading and writing without a connection. Everything syncs automatically when you’re back.

A task list demonstrates immediate optimistic updates, synchronized realtime clients, and offline behavior.

Never pauses. Designed to scale.

Whether you’re building a side project or your next big thing, start with Substrate for free. Your projects never pause, commercial use is always allowed, and you can collaborate with your team before scaling to millions of users.

All plans include

Free

Everything you need to start building.

$0/ month
  • $5 in usage credits each billing cycle
  • Usage limits so no surprise bills
  • 2 projects maximum
  • 2 branches maximum per project
  • 14 days dormant branch lifetime
  • 1 GB max database size$0.30 per GB / month
  • 5 GB max Object Store size$0.05 per GB / month
  • 64 MB max State Store size$0.50 per GB / month
  • 1 hour database history retention
  • 1 MCP server maximum
Request early access

Pro

More capacity for growing products.

$16/ month

Everything in Free, plus…

  • $15 in usage credits each billing cycle
  • 5 projects maximum
  • 5 branches maximum per project
  • 30 days dormant branch lifetime
  • 15 GB max database size$0.30 per GB / month
  • 100 GB max Object Store size$0.05 per GB / month
  • 2 GB max State Store size$0.50 per GB / month
  • 7 days database history retention
  • 3 MCP servers maximum
  • Encrypted database columns
Request early access

Max

Five times Pro capacity for demanding products.

$80/ month

Everything in Pro, plus…

  • $80 in usage credits each billing cycle
  • 25 projects maximum
  • 25 branches maximum per project
  • 90 days dormant branch lifetime
  • 75 GB max database size$0.30 per GB / month
  • 500 GB max Object Store size$0.05 per GB / month
  • 10 GB max State Store size$0.50 per GB / month
  • 30 days database history retention
  • 10 MCP servers maximum
  • AI Gateway model policies
Request early access

Enterprise

Custom rates and limits for your organization.

Custom pricing
  • Custom included usage credits
  • Custom limits across every billable feature
  • Custom immutable usage rate card
  • Programmatic observability APIs
  • Manual credits and optional auto recharge
  • Contact-only onboarding
Contact sales