Deploying a Serverpod Application
Deploy Serverpod applications to Globe with database configuration and support for both server and Flutter client deployments.
Serverpod is a full-stack framework for building scalable server applications in Dart. It includes a server component and a Flutter client library. Globe supports deploying both the Serverpod server and Flutter client applications. This page outlines requirements and deployment behavior.
Project Setup
To create a new Serverpod project:
-
Install the Serverpod CLI:
dart pub global activate serverpod_cli -
Create a new Serverpod project:
serverpod create my_serverpod_app cd my_serverpod_app -
Test your server locally:
cd my_serverpod_app_server dart run bin/main.dart
Serverpod creates directories with your project name as a prefix. For a
project named my_serverpod_app, the directories will be
my_serverpod_app_server and my_serverpod_app_flutter.
Database Requirements
Serverpod requires a PostgreSQL database. Compatible providers include Neon, Supabase, or any PostgreSQL service.
Required connection details:
- Host: Database host URL
- Database name: Name of the database
- User: Database username
- Password: Database password (configured as environment variable)
Configuration
Database connection details are stored in Serverpod's configuration files located in my_serverpod_app_server/config/.
Example config/production.yaml:
database:
host: your-database-host
name: your-database-name
user: your-database-username
# password is injected via SERVERPOD_DATABASE_PASSWORD environment variable
The staging.yaml file can be configured with separate staging database credentials.
Database passwords are not stored in configuration files. They are injected at runtime via environment variables.
Flutter Client
| Variable | Description |
|---|---|
SERVER_URL | Deployed server URL (include trailing slash) |
Different values can be configured for preview and production environments. See Environment Variables for configuration details.
Deploying to Globe
Serverpod projects contain two deployable components that are linked and deployed separately.
Server Deployment
-
From the project root directory, link the server project:
globe link -
Select
my_serverpod_app_serveras the root directory when prompted -
Configure the
SERVERPOD_DATABASE_PASSWORDenvironment variable in the Globe dashboard -
Deploy to production:
globe deploy --prod
The deployment URL (e.g., https://my-serverpod-server.globeapp.dev/) is required for the Flutter client configuration.
Flutter Client Deployment
-
From the project root directory, link the Flutter project:
globe link -
Select
my_serverpod_app_flutteras the root directory when prompted -
Configure the
SERVER_URLenvironment variable with the deployed server URL (include trailing slash) -
Deploy to production:
globe deploy --prod
Deployment Behavior
Globe handles Serverpod deployments with the following behavior:
- Preset detection: Serverpod server projects are automatically recognized as Dart backend applications
- Database configuration: Connection details are read from
config/production.yamlwith passwords injected via environment variables - Flutter client: Deployed as a standard Flutter Web application to Globe's CDN
- Multi-project structure: Each component (server, Flutter client) is linked and deployed as a separate Globe project
Related Topics
- Serverpod documentation - Official Serverpod framework documentation
- Environment Variables - Managing secrets and configuration
- Managing deployments - Understand deployment lifecycle
- Globe CLI reference - Command-line deployment tools
