---
title: "Deploy a Dart App on Railway, Part 1"
description: "A Flutter + Serverpod trivia app is deployed to Railway with a Railway-hosted PostgreSQL database, using the Railway CLI and a custom multi-stage Dockerfile that compiles the Dart server and bundles a Flutter web build into Serverpod's static webserver."
url: "https://swe.quest/articles/deploy-a-dart-app-on-railway-part-1-9c43a3141edcb7ac"
canonical: "https://blog.railway.com/p/deploy-a-dart-app-part-1"
source: "Railway"
published: "2024-12-13"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["deployment","containers","cloud","postgres"]
---

# Deploy a Dart App on Railway, Part 1

A post on [Railway](https://swe.quest/sources/railway.md), published 2024-12-13, 7 min read, How-to. Original: [https://blog.railway.com/p/deploy-a-dart-app-part-1](https://blog.railway.com/p/deploy-a-dart-app-part-1)

## Summary

A Flutter + Serverpod trivia app is deployed to Railway with a Railway-hosted PostgreSQL database, using the Railway CLI and a custom multi-stage Dockerfile that compiles the Dart server and bundles a Flutter web build into Serverpod's static webserver. Database credentials are wired in through Railway variable references, and migrations are applied in production mode. Because Railway exposes only one port per domain, a Caddy reverse proxy template routes traffic between Serverpod's API port (8080) and web port (8082). A curl request to the example hello endpoint confirms the deployment works.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- Dart and Flutter basics
- Docker multi-stage builds ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- PostgreSQL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))

## Keywords

Railway, Serverpod, Flutter, Dart, Caddy, Docker, PostgreSQL

## Related posts

- [Deploy a Dart App on Railway, Part 2](https://swe.quest/articles/deploy-a-dart-app-on-railway-part-2-287e095280b728a4.md): Railway · 2024-12-13 · Medium · 10 min read · Identity & auth, Real-time systems, Deployment, Mobile
  Building Trivyal, a Kahoot-style trivia app, on Serverpod and Flutter and deploying it to Railway.
- [Getting started with Ruby on Rails and Postgres on Supabase](https://swe.quest/articles/getting-started-with-ruby-on-rails-and-postgres-on-supabase-03d6ca4747754aea.md): Supabase · 2024-01-29 · Medium · 3 min read · Ruby, PostgreSQL, Deployment
  A Rails app can be wired to a Supabase-hosted Postgres database by scaffolding with \`rails new -d=postgresql\` and supplying the Supabase pooler connection URI through the \`DATABASE\_URL\` environment variable.
- [Building a SaaS application on Railway](https://swe.quest/articles/building-a-saas-application-on-railway-c33704a725fc6e9e.md): Railway · 2024-12-13 · Medium · 12 min read · React, PostgreSQL, Deployment, TypeScript, Identity & auth
  A step-by-step tutorial for building a job board SaaS MVP with Remix, PostgreSQL via Drizzle ORM, Clerk authentication and shadcn/ui, then deploying it to Railway.
- [Migrating From Heroku To Railway](https://swe.quest/articles/migrating-from-heroku-to-railway-dbd89b10c75a9d07.md): Railway · 2022-08-19 · Medium · 7 min read · Deployment, Cloud platforms, Ruby
  Moving a Heroku app to Railway comes down to three steps: deploy from a GitHub repo, import Heroku config vars, and add Postgres and Redis as separate database services.
- [Deploy Authorizer on Railway](https://swe.quest/articles/deploy-authorizer-on-railway-6b6e28c962bd461a.md): Railway · 2022-01-28 · Medium · 3 min read · Identity & auth, React, Deployment
  Authorizer, an open-source self-hosted alternative to Auth0, can be deployed on Railway with a one-click template that provisions PostgreSQL and Redis automatically and wires up DATABASE\_URL and REDIS\_URL.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
