Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 95 additions & 105 deletions docs/05-build-your-first-app/01-creating-endpoints.md

Large diffs are not rendered by default.

428 changes: 31 additions & 397 deletions docs/05-build-your-first-app/02-models-and-data.md

Large diffs are not rendered by default.

455 changes: 105 additions & 350 deletions docs/05-build-your-first-app/03-working-with-the-database.md

Large diffs are not rendered by default.

54 changes: 36 additions & 18 deletions docs/05-build-your-first-app/04-deployment.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,57 @@
---
sidebar_label: Deploy your server
title: Deploy your app
sidebar_class_name: sidebar-icon-get-started-step-4
slug: /get-started/deployment
description: Deploy your Serverpod recipe app to Serverpod Cloud with the scloud CLI, then explore other hosting options.
---

# Deploy your server
<!-- markdownlint-disable MD025 -->

## Server requirements
# Deploy your app

Serverpod is written in Dart and compiles to native code, allowing it to run on any platform supported by the [Dart tooling](https://dart.dev/get-dart#system-requirements).
Your recipe app runs locally. The last step is to put it online. The recommended path is [Serverpod Cloud](/cloud), which hosts your server and database with zero configuration.

Many users prefer to deploy Serverpod using Docker. The project includes a basic Dockerfile that you can use to build a Docker image, which can then be run on any Docker-compatible platform.
## Deploy to Serverpod Cloud

For non-Docker deployments, you'll need to [compile the Dart code](https://dart.dev/tools/dart-compile) and manually copy your assets and configuration files to the server. This manual step is necessary since [asset bundling is not yet supported by Dart](https://github.com/dart-lang/sdk/issues/55195).
Install the Serverpod Cloud CLI:

## Server configuration
```bash
$ dart pub global activate serverpod_cloud_cli
```

By default Serverpod is active on three ports:
From your project's root folder, launch the app. This creates a Cloud project, provisions a managed Postgres database (separate from the embedded one `serverpod start` runs locally), and deploys your server along with the web build of your app:

- **8080**: The main port for the server - this is where the generated client will connect to.
- **8081**: The port for connecting with the [Serverpod Insights](../tools/insights) tooling. You may want to restrict which IP addresses can connect to this port.
- **8082**: The built in webserver is running on this port.
```bash
$ scloud launch
```

You will also need to configure the database connection in the `config/production.yaml` file and **securely** provide the `config/passwords.yaml` file to the server.
The first upload includes your Flutter web build and can exceed the default timeout on a slower connection. If the upload times out, retry with a higher limit (in seconds), for example, `scloud launch --timeout 600`.

## Health checks
Your Gemini API key lives in `passwords.yaml`, which stays on your machine and is never deployed. Set it as a secret in Cloud so the deployed server can call Gemini:

The server exposes a health check on the root endpoint `/` on port **8080**. Load balancers and monitoring systems can use this endpoint to verify that your server is running and healthy. The endpoint returns a basic health status response.
```bash
$ scloud password set geminiApiKey
```

## Deploying with Serverpod Cloud
Whenever you make changes later, redeploy with:

Serverpod Cloud is a managed service that allows you to deploy your Serverpod applications without having to worry about the underlying infrastructure.
```bash
$ scloud deploy
```

Serverpod Cloud is currently in private beta. Request access by [filling out this form](https://docs.google.com/forms/d/e/1FAIpQLSfBteB7hoLJ2xPgs0CXj9RpLt2gogvJZSpEv2ye8ziWuXfGFA/viewform). Once you have access, you can deploy your Serverpod applications to the cloud in just a few minutes and with zero configuration.
See the [Serverpod Cloud documentation](/cloud) for the full walkthrough, including custom domains, logs, and your free trial.

## Other deployment options

Check out [Custom hosting](../08-deployments/custom-hosting/01-choosing-a-strategy.md) for more information on how to deploy your Serverpod application to other platforms.
Prefer to host the server yourself? See [Custom hosting](../08-deployments/custom-hosting/01-choosing-a-strategy.md) for running on a server cluster, a serverless platform, or your own machine.

## What you've built

You've built and deployed a full-stack app with Flutter and Serverpod:

- A custom endpoint that calls an external API from the server.
- A type-safe data model shared between the server and the Flutter app.
- Persistent storage with the database.
- A Flutter app that talks to your server through the generated client.

We're excited to see what you'll build next. If you need help, join the [Discord community](https://serverpod.dev/discord) or ask in our [community on GitHub](https://github.com/serverpod/serverpod/discussions). To go deeper into any topic, browse the [Concepts](../06-concepts/01-working-with-endpoints/01-working-with-endpoints.md) section.
Binary file modified static/img/getting-started/endpoint-chrome-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/img/getting-started/final-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/img/getting-started/flutter-web-ingredients.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/getting-started/tui-logs.png
Comment thread
Swiftaxe marked this conversation as resolved.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading