Serverpod banner

Serverpod

Pub version Discord

Serverpod is the ultimate app-stack for agentic coding. It is a complete, open-source solution for your app, backend, website, and database, all using Flutter and Dart. You write your server in the same language as your app. Serverpod generates the type-safe client, the database schema, and the migrations. One command runs your whole stack locally with hot reload, and one more publishes it to the cloud.

Get started · Documentation · Serverpod Cloud · Discord

Why Serverpod

  • Full-stack type safety: Define a model once and use it in your endpoints, your database queries, and your Flutter app. Calling the server is a regular Dart method call, checked by the compiler.
  • Hot reload for your entire stack: One command, serverpod start, runs the server, the database, and your Flutter app, and watches all of it. Change an endpoint or a model, and Serverpod regenerates the code and reloads both server and app.
  • No setup for the database: New projects run on an embedded Postgres that Serverpod downloads and manages for you. You don't need Docker to get started.
  • Tests against a real server: The built-in test framework boots your Serverpod and a real, isolated database inside dart test. You call your endpoints directly, with no HTTP mocking.
  • Zero-configuration deployments: Publish your backend, database, and Flutter web app to Serverpod Cloud with a single command. No pipelines, no Terraform, no DevOps. Plans start at $5 per month.
  • Open source, no lock-in: Serverpod runs anywhere you can run Dart. Serverpod Cloud is a convenience, not a requirement.

More than a thousand new projects are created with Serverpod every month, and it's used in production by startups, app agencies, banks, and medical companies.

Build with an AI agent

Serverpod is designed for building apps with an AI coding agent. When you create a project, pick your agent and Serverpod sets it up for you. Claude Code, Cursor, VS Code, Codex, Antigravity, and OpenCode are supported out of the box.

  • Agent skills turn your agent into a Serverpod expert: When you create a project, Serverpod adds skills that cover endpoints, models, the database, migrations, authentication, testing, deployment, and more. They're written for the Serverpod version you create the project with, not the older APIs your agent may have learned.
  • The MCP server connects your agent to your running app: Through serverpod mcp-server, your agent can read server and Flutter app logs, hot reload the server and the app, and create and apply database migrations. It makes a change, sees it running, and reads the logs when something breaks, without you copying output back and forth.
  • Several agents can work at once: With serverpod runner, each agent runs its own server and database in its own Git worktree, so agents don't get in each other's way. Run serverpod start in any worktree to see what its agent sees.

Getting started

You need Flutter 3.44.4 or later.

Install the Serverpod CLI:

dart install serverpod_cli

Create a project with a server, a client, and a Flutter app. The command asks which editor or agent you use:

serverpod quickstart my_project

Move into the project folder:

cd my_project

Start the full stack with hot reload:

serverpod start

The serverpod start command starts the database, runs your server, and opens your Flutter app.

Follow the quickstart guide for a full walkthrough.

Note

Upgrading an existing project? Start with the upgrade guides.

Build with Dart everywhere

Define a model

Describe your data once, in YAML. Serverpod generates a Dart class from it for both your server and your app. The table key maps it to a database table.

# my_project_server/lib/src/notes/note.spy.yaml
class: Note
table: note
fields:
  text: String

Then press M in the serverpod start terminal to create the table.

Write an endpoint

An endpoint's methods are what your app calls. The Note class and its type-safe db API are generated from the model above.

// my_project_server/lib/src/notes/notes_endpoint.dart
class NotesEndpoint extends Endpoint {
  Future<Note> add(Session session, Note note) =>
      Note.db.insertRow(session, note);

  Future<List<Note>> list(Session session) =>
      Note.db.find(session, orderBy: (t) => t.id);
}

Call the endpoint from your Flutter app

Serverpod generates a client that turns each endpoint method into a regular Dart call. There's no REST layer to write or keep in sync.

final notes = await client.notes.list();

Test the endpoint against a real database

The generated test tools run your endpoints against a real server and database. Each test's changes are rolled back when it finishes.

withServerpod('Given Notes endpoint', (sessionBuilder, endpoints) {
  test('when adding a note then it is listed', () async {
    await endpoints.notes.add(sessionBuilder, Note(text: 'Hello'));
    final notes = await endpoints.notes.list(sessionBuilder);
    expect(notes.single.text, 'Hello');
  });
});

Run your tests with dart test from the my_project_server folder.

Publish your app

serverpod cloud launch

This signs you in, creates your project on Serverpod Cloud, and publishes it. After that, serverpod cloud deploy publishes new versions. See Deploy to Serverpod Cloud.

Note

Your first project includes a one-month free trial, with no credit card required.

Prefer to host it yourself? Serverpod runs anywhere Dart runs, and the docs cover other deployment options.

Everything else that's included

  • ORM and migrations for Postgres, with relations, transactions, pgvector, and PostGIS
  • Authentication with email, Google, Apple, Facebook, GitHub, Microsoft, Firebase, and custom providers
  • Streaming methods for real-time communication using native Dart streams
  • Future calls that replace cron jobs and survive server restarts
  • File uploads to Serverpod Cloud, S3, Google Cloud Storage, Cloudflare R2, or your database
  • Caching locally or across a cluster with Redis
  • Logging and Serverpod Insights, a companion app for monitoring your server in real time
  • A web server for web pages, webhooks, and REST APIs, built on Relic
  • Health checks for your database and external services
  • A client-side SQLite database with the same ORM, watched queries that keep widgets up to date, and experimental offline sync with the server

Community

Want to contribute? Read the contribution guide. More than a hundred developers have contributed code to Serverpod so far.

License

All Serverpod packages are licensed under BSD-3, except for the main serverpod package, which uses the SSPL license. In short, you can use any of the client packages in your app without limitation. You can also host your Serverpod server without limitation, as long as you don't offer Serverpod as a cloud service to third parties (this is typically only relevant for cloud service providers).