Railway
Deploy TimeWren on Railway with a web service, PostgreSQL, a storage volume and a separate scheduler service.
Choose this method if you want managed hosting on Railway. The setup has three parts: the web service, a PostgreSQL database and a scheduler service. Both services pull the published image and never build the app.
Note: A one-click Railway template with all services has not been published yet. Railway's config-as-code describes one service, not a whole project, so you add the database, volume and scheduler yourself as described below.
Requirements
- A Railway account and project.
- The repository
timewren/timewren, which containsrailway.jsonanddeploy/railway/.
Set up
-
Add PostgreSQL to the project. Then deploy the web service from the GitHub repository
timewren/timewrenwith/railway.jsonas the config path. Mount a volume at/app/data/storageand keep a single replica. -
Set these variables on the web service. Railway references such as
${{Postgres.DATABASE_URL}}are literal values, and the name must match your database service:Variable Value DATABASE_URL${{Postgres.DATABASE_URL}}BETTER_AUTH_SECRETan independent random secret ENCRYPTION_KEYoutput of openssl rand -hex 32CRON_SECRETan independent random secret NEXT_PUBLIC_APP_URLpublic HTTPS URL, no trailing slash NEXT_PUBLIC_BRANDtimewrenMIGRATE_ON_START1STORAGE_DRIVERlocalSTORAGE_LOCAL_PATH/app/data/storageREQUIRE_EMAIL_VERIFICATIONfalseuntil mail is configuredHOSTNAME0.0.0.0PORT3000 -
Generate a public domain for the web service, set
NEXT_PUBLIC_APP_URLto that HTTPS URL and redeploy. Add optional mail and integration variables from.env.examplewhen you need them. -
Add a second service from the same repository. Select
/deploy/railway/cron.jsonas its config path and set:Variable Value CRON_SECRET${{TimeWren.CRON_SECRET}}APP_URLhttp://${{TimeWren.RAILWAY_PRIVATE_DOMAIN}}:3000Replace
TimeWrenwith the actual name of your web service. Keep one scheduler replica, no public domain, no volume and no serverless sleeping.
Do not skip the scheduler: exports, imports, syncs and reminders need it. It runs node scripts/cron.mjs, never needs database credentials, and migrations only run in the web service at startup.
How the config works
railway.json points both services at deploy/railway/Dockerfile, which only contains FROM ghcr.io/timewren/timewren:latest. To pin a release, change the tag in that Dockerfile. The web service uses /api/health as its health check and requires the mount path /app/data/storage. Valkey is optional and not needed for one app replica.
Create your account first
The first registered account becomes admin. Set ADMIN_EMAIL and a mail transport before you expose the service if you need to reserve that account. Back up the database, the storage volume and ENCRYPTION_KEY.