---
title: "Deploy Spacebot"
description: "Deploy Spacebot with Caddy HTTP Basic Auth and persistent storage."
category: "AI/ML"
url: https://railway.com/deploy/spacebot-3
---

# Deploy Spacebot

Deploy Spacebot with Caddy HTTP Basic Auth and persistent storage.

**[Deploy Spacebot on Railway](https://railway.com/template/spacebot-3)**

- **Creator:** Agaz Self-Host
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### caddy

- **Image:** caddy:2.10.2-alpine
- **Start command:** `sh -euc 'test -n "${BASIC_AUTH_USERNAME:-}" && test -n "${BASIC_AUTH_PASSWORD:-}" && test -n "${SPACEBOT_UPSTREAM:-}"; hash="$(caddy hash-password --plaintext "$BASIC_AUTH_PASSWORD")"; printf ":${PORT:-80} {\n  handle /healthz {\n    respond \"ok\" 200\n  }\n  handle {\n    basic_auth {\n      %s %s\n    }\n    reverse_proxy %s\n  }\n}\n" "$BASIC_AUTH_USERNAME" "$hash" "$SPACEBOT_UPSTREAM" > /etc/caddy/Caddyfile; caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile; exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile'`
- **Health check:** /healthz
- **Public domain:** Yes

### spacebot

- **Image:** ghcr.io/spacedriveapp/spacebot:latest
- **Health check:** /api/health

## Documentation

# Deploy and Host Spacebot on Railway

Spacebot is an open-source, self-hosted AI agent platform from Spacedrive. It provides a web UI, persistent agent memory, local workspaces, scheduled work, and integrations for channels such as Discord, Slack, Telegram, Twitch, and email. Spacebot supports multiple LLM providers and can run in setup mode until a provider credential is added.

## About Hosting Spacebot

This template runs the official Spacebot container together with a small Caddy reverse-proxy service. Spacebot stays private inside Railway’s network while Caddy supplies the public HTTPS endpoint and HTTP Basic Authentication. Spacebot’s `/data` directory is mounted to a Railway volume so configuration, SQLite/LanceDB/redb data, agent workspaces, logs, and browser caches survive redeploys and restarts. Add at least one provider key after deployment, then configure channels and models as needed.

## Common Use Cases

* Run a private, self-hosted AI assistant with persistent memory.
* Connect an agent to Discord, Slack, Telegram, Twitch, or email.
* Automate recurring research, browser, workspace, and notification tasks.

## Dependencies for Spacebot Hosting

* Spacebot container image: `ghcr.io/spacedriveapp/spacebot:latest`.
* Caddy `2.10.2-alpine` reverse proxy for HTTP Basic Authentication.
* A Railway volume mounted at `/data`.

### Deployment Dependencies

* [Spacebot Docker deployment guide](https://docs.spacebot.sh/docker)
* [Spacebot configuration reference](https://docs.spacebot.sh/config)
* [Spacebot source repository](https://github.com/spacedriveapp/spacebot)
* [Caddy Basic Authentication directive](https://caddyserver.com/docs/caddyfile/directives/basic_auth)

### Implementation Details

The Caddy service is the only public service. It proxies authenticated traffic to Spacebot through the private reference `${{spacebot.RAILWAY_PRIVATE_DOMAIN}}:19898`. Caddy exposes `/healthz` without authentication so Railway can perform health checks; all other routes require HTTP Basic Authentication. The Caddy startup command hashes the supplied password with `caddy hash-password` before writing its runtime configuration.

## Why Deploy Spacebot 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 Spacebot 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

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/spacebot-3
