Skip to main content
Version: Next

Choosing a strategy

You can run a Serverpod server anywhere that supports a Dart process or a Docker container: a managed server cluster, a serverless platform, or your own machine. This page covers the trade-offs, and the following pages walk through each path. For the managed path, see Serverpod Cloud.

Server cluster or serverless?

The two main options are running on a cluster of servers or on a serverless platform. Run on a cluster (such as Google Cloud Engine) if your server holds state. Run serverless (such as Google Cloud Run) if your server is stateless. An example of a stateful server is Pixorama, where the server keeps live state in memory. If you only make API calls that read and write a database, serverless may be the better fit.

Server clusterServerless
ProsAll features are supported. Great for real-time communication. Cost-efficient at scale.Minimal starting cost. Easier configuration. Minimal maintenance.
ConsSlightly higher starting cost. More complex to set up.Limited feature set. The server cannot hold state.

Serverless does not support:

  • Future calls. (Possible to configure, but requires a more advanced setup.)
  • Health metrics.
  • On-server caching. Caching can still happen while a serverless instance stays warm, but it can be lost at any time. Caching with Redis is supported.
  • In-memory state. Store shared state in an external service such as Postgres, Redis, or another API instead.

Pick a guide

Approximate costs

A minimal server cluster on Google Cloud Platform:

ServiceMin cost
Compute Engine Instance$7 / mo
Cloud Load Balancing$19 / mo
Cloud SQL for PostgreSQL$10 / mo

A minimal serverless setup on Google Cloud Run, where you only pay for the traffic you serve and no load balancer is required:

ServiceMin cost
Cloud Run$0 / mo
Cloud SQL for PostgreSQL$10 / mo
info

These prices are rough approximations to give you a sense of hosting costs. Actual costs vary and change over time. Do your own research before provisioning infrastructure.