---
title: "Deploy Aphex Website (Postgres + S3)"
description: "Aphex Website Template using Postgres & S3"
category: "CMS"
url: https://railway.com/deploy/aphex-website-postgres-s3
---

# Deploy Aphex Website (Postgres + S3)

Aphex Website Template using Postgres & S3

**[Deploy Aphex Website (Postgres + S3) on Railway](https://railway.com/template/aphex-website-postgres-s3)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/aphex-website-postgres-s3/manifest.json

- **Creator:** Ben's Projects
- **Category:** CMS
- **Total deploys:** 3

## Template content

### aphex-website

- **Source:** IcelandicIcecream/aphex-website
- **Health check:** /healthz
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Buckets

- **Bucket**

## Documentation

# Deploy and Host Aphex CMS on Railway

Aphex CMS is an open-source, developer-first content management system built on SvelteKit.
Unlike headless CMSes, it is **embedded**: the same app that serves your website also runs
the editing studio, so there is no separate backend to deploy and no content API to wire
up. This template deploys a complete, editable website — a block-based page builder, a
blog, full-text search and visual editing — backed by PostgreSQL and S3-compatible object
storage.

## About Hosting Aphex CMS

Hosting Aphex means running one SvelteKit container alongside a PostgreSQL database and an
object store for uploaded media. The app serves the public site, the `/admin` studio, a
REST and GraphQL API, and an MCP endpoint from the same process.

It needs three things to work correctly, and this template arranges all of them: a
database it can migrate on boot, a bucket for media that survives redeploys, and a public
URL it can derive its own origin from. Migrations run automatically at container start.
The background job queue — scheduled publishing, event consumers — runs in-process, so no
separate worker service or cron is required at a single replica. Session secrets and the
plugin-secret encryption key are generated once at deploy and must then stay stable for
the life of the instance.

Uploaded media is never served from the bucket directly. Every asset is addressed through
the app at `/media/:id/:filename`, which is what lets private files stay private and
resized variants be generated on demand and cached permanently.

## Why Deploy Aphex CMS 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 Aphex CMS 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.

Specifically for Aphex, Railway removes the two setup steps that normally stand between you
and a working CMS. The Postgres service and the Bucket service are provisioned and wired to
the app automatically, so there are **no required fields** on this template — no database
URL to paste, no S3 account to create, no access keys to generate. Railway also supplies the
public domain, which the container reads at startup to derive its own auth origin, so
sign-in works on the first boot without you configuring a URL.

## Common Use Cases

- **Marketing and company websites** — a block-based page builder with reusable layout
  blocks and four hero treatments, editable by non-developers without touching code.
- **Blogs and publications** — dated articles with rich text, inline media and code blocks,
  categories, related posts, a paginated archive and full-text search.
- **Client sites built by agencies** — define the content model in TypeScript, hand over a
  studio with roles, invitations and per-field access control, and let the client edit
  visually on the live page.
- **Content backends for teams already using SvelteKit** — a typed Local API for server
  code, plus REST, GraphQL and an MCP server so AI agents can read and write content.

## Dependencies for Aphex CMS Hosting

- **PostgreSQL** — content, users, sessions and the job queue.
- **S3-compatible object storage** — uploaded media.

### Deployment Dependencies

- [Aphex CMS documentation](https://docs.getaphex.com)
- [Railway deployment guide](https://docs.getaphex.com/deployment/railway)
- [Source repository](https://github.com/IcelandicIcecream/aphex)
- [Resend](https://resend.com) — optional, required for password reset, email verification
  and team invitations.

### Implementation Details

**First steps after deploying**

1. **Go to `/login` and create your account immediately.** The first account to sign up
   becomes super admin. On a public URL that is a race, so either set
   `APHEX_BOOTSTRAP_EMAIL` before deploying or claim the instance as soon as it is live.
2. Open `/admin`. Your organization and roles are created for you on first sign-in.
3. Example content — real articles, images and navigation — is created on the first boot,
   so every block and page has something in it. Set `APHEX_SEED=false` to start empty.
4. Edit Site Settings, Header and Footer to make it yours.

**Optional environment variables**

| Variable | Effect |
| --- | --- |
| `APHEX_BOOTSTRAP_EMAIL` | Restricts the super-admin claim to one address. |
| `RESEND_API_KEY`, `APHEX_EMAIL_FROM` | Enables password reset, email verification and invitations. |
| `AUTH_REQUIRE_EMAIL_VERIFICATION` | Requires a verified email to sign in. Only turn this on **after** email works, or the first sign-up cannot complete. |
| `APHEX_SEED` | Set `false` to skip the example content. |

**Things that will bite you**

- **Keep every service in the same region.** Railway sets the region per service. If the
  app and Postgres end up in different regions, every page render waits on cross-region
  round trips and the site becomes dramatically slower — with no error anywhere.
- **`AUTH_SECRET` and `APHEX_SECRET_ENCRYPTION_KEY` must stay stable.** Rotating the first
  signs everyone out and invalidates every API key; rotating the second makes stored plugin
  secrets permanently unreadable.
- **Without email configured, a lost password is unrecoverable.** The account you sign up
  with is the only way in.
- **Scaling past one replica** requires turning off `APHEX_EMBEDDED_WORKER` and driving
  `POST /api/internal/workers/run` from a cron service with `APHEX_WORKER_SECRET` set.
  Turning it off without a replacement leaves nothing processing the queue: scheduled
  publishes are accepted, report success, and never happen.

**Prefer to build locally?** `pnpm create aphex` scaffolds the same template on your
machine, using SQLite with no infrastructure to run.


## Similar templates

- [Libredesk - Complete Setup](https://railway.com/deploy/libredesk-complete-setup) — Complete self-hosted omnichannel customer support desk.
- [Paperless-ngx](https://railway.com/deploy/paperless-ngx-3) — Paperless-ngx — document management with OCR and full-text search
- [Instatic CMS - Postgres](https://railway.com/deploy/instatic-cms-postgres) — Design, build and manage powerful static sites from state-of-the-art CMS

Open this page in a browser: https://railway.com/deploy/aphex-website-postgres-s3
