---
title: "Deploy PocketBase"
description: "Single-file backend with database, auth, realtime APIs, and storage."
category: "Starters"
url: https://railway.com/deploy/pocketbase-6
---

# Deploy PocketBase

Single-file backend with database, auth, realtime APIs, and storage.

**[Deploy PocketBase on Railway](https://railway.com/template/pocketbase-6)**

- **Creator:** Agastya Fauzan Alfath's Projects
- **Category:** Starters

## Template content

### PocketBase

- **Image:** ghcr.io/muchobien/pocketbase:0.39.9@sha256:c0667fe6c5197ff226ff642120ab1ad870c3f2f27300940a61e5a7fa082b6816
- **Start command:** `/bin/sh -c 'set -eu; /usr/local/bin/pocketbase superuser upsert "$PB_ADMIN_EMAIL" "$PB_ADMIN_PASSWORD" --dir=/pb_data; exec /usr/local/bin/pocketbase serve --http="$PB_HOST:$PB_PORT" --dir=/pb_data --publicDir=/pb_public --hooksDir=/pb_hooks --encryptionEnv=ENCRYPTION'`
- **Health check:** /api/health
- **Public domain:** Yes

## Documentation

# Deploy and Host PocketBase on Railway

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/pocketbase-6)

**Published on the Railway marketplace:** https://railway.com/deploy/pocketbase-6

PocketBase is an open-source backend in a single executable. It combines an embedded SQLite database, authentication, realtime subscriptions, file storage, a dashboard UI, and REST-style APIs, making it useful for prototypes, mobile apps, SaaS products, and compact production services without a separate database server.

## About Hosting PocketBase

Hosting PocketBase requires one public container and one persistent volume. This template pins the Umbrel-tested PocketBase 0.39.9 image and exposes its documented port `8090` through Railway HTTPS. PocketBase binds to `0.0.0.0`, stores its SQLite database, uploads, settings, and backups under `/pb_data`, and reports readiness through `/api/health`. A generated 32-character key encrypts stored application settings, while a generated superuser password protects the dashboard before the public server starts. The initial email is `admin@pocketbase.invalid`; change it to an address you control after signing in. No external database or cache is required.

## Common Use Cases

- Building mobile, web, and SaaS backends with authentication and realtime APIs
- Prototyping data models and access rules from a browser dashboard
- Hosting compact applications that need SQLite-backed records and file storage

## Dependencies for PocketBase Hosting

- One Railway persistent volume mounted at `/pb_data`
- One Railway-generated HTTPS service domain targeting port `8090`

### Deployment Dependencies

- [PocketBase 0.39.9 release](https://github.com/pocketbase/pocketbase/releases/tag/v0.39.9)
- [PocketBase production and Docker guidance](https://pocketbase.io/docs/going-to-production/)
- [`muchobien/pocketbase-docker` image documentation](https://github.com/muchobien/pocketbase-docker)
- [Umbrel PocketBase package](https://github.com/getumbrel/umbrel-apps/tree/master/pocketbase)

## Implementation Details

| Service | Image | Networking and health | Persistent storage |
| --- | --- | --- | --- |
| `PocketBase` | `ghcr.io/muchobien/pocketbase:0.39.9` pinned to Umbrel's digest | Public port `8090`; bind `0.0.0.0`; health check `/api/health` | `/pb_data` for SQLite data, uploads, settings, and local backups |

The startup command upserts the generated superuser before starting the public server, so a new deployment is not left with a claimable first-superuser flow. It then runs PocketBase with its documented data, public, hooks, bind, and encryption flags. Retrieve the generated password from the deployed service variables, sign in at `/_/`, and immediately replace the placeholder superuser email with an address you control. Back up `/pb_data`; a Railway volume protects against redeploy loss but is not an independent backup.

## Why Deploy PocketBase on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying PocketBase on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway
- [Flask WebSocket Chat](https://railway.com/deploy/flask-websocket-chat) — Single file, realtime multi-user websocket chat using flask-socketio

Open this page in a browser: https://railway.com/deploy/pocketbase-6
