---
title: "Deploy Twenty"
description: "Twenty CRM with worker, Postgres and file storage, admin set at deploy"
category: "Other"
url: https://railway.com/deploy/twenty-2
---

# Deploy Twenty

Twenty CRM with worker, Postgres and file storage, admin set at deploy

**[Deploy Twenty on Railway](https://railway.com/template/twenty-2)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/twenty-2/manifest.json

- **Creator:** Dektion Studio
- **Category:** Other
- **Total deploys:** 4

## Template content

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

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

### Twenty https://raw.githubusercontent.com/twentyhq/twenty/1e14eecba3a8ad8c72bb09da74f7c95d21f4cf04/packages/twenty-front/public/images/icons/android/android-launchericon-192-192.png

- **Source:** dektionstudio/railway-template-images
- **Health check:** /healthz
- **Public domain:** Yes

### Twenty Worker https://raw.githubusercontent.com/twentyhq/twenty/1e14eecba3a8ad8c72bb09da74f7c95d21f4cf04/packages/twenty-front/public/images/icons/android/android-launchericon-192-192.png

- **Image:** twentycrm/twenty:v2.42.6
- **Start command:** `node dist/queue-worker/queue-worker`

### Redis https://devicons.railway.com/i/redis.svg

- **Image:** redis:7.4
- **Start command:** `/bin/sh -c 'exec redis-server --requirepass "$REDIS_PASSWORD" --maxmemory-policy noeviction --appendonly yes --dir /data'`

## Buckets

- **Files**

## Documentation

# Deploy and Host Twenty on Railway

[Twenty](https://github.com/twentyhq/twenty) is an open-source CRM: companies, people, opportunities, notes and tasks, custom objects and fields, email and calendar sync, workflows, and a GraphQL and REST API.

This template runs the official image (v2.42.6) the way upstream's Docker Compose file does, as a server and a background worker, with Postgres, Redis and a private Railway Bucket for files.

## About Hosting Twenty

On a fresh Twenty, the first person who signs up creates the workspace and becomes the server admin. On a public URL that can be anyone. This template does it for you: the deploy form asks for your email, a password is generated into `TWENTY_ADMIN_PASSWORD`, and a start step creates your account and the workspace as soon as the server answers. After that, signing up needs an invitation. Open `TWENTY_URL` and sign in with that email and password.

Upstream's compose file has the server and the worker share a disk for uploaded files. Railway can't share a volume between two services, so files go to a Railway Bucket instead. Twenty streams files through its own server, so the bucket stays private.

Twenty is heavy for a 1 GB service. With Node's default heap limit, the server ran out of memory while starting, so `NODE_OPTIONS` raises the limit to 640 MB. My first start step was a small Node script; it cost about 100 MB, so it's now a shell script using the image's own curl and jq. The worker runs `node` directly instead of through yarn, which saved another 0.3 GB.

Before publishing I tested the final version on a fresh deploy. The start step reported the account and workspace as created, and a sign-up from another address was refused with "New workspace setup is disabled". The admin signed in as server admin with the workspace active, created a company and a person in it, and uploaded a file that read back byte for byte from the bucket. After a restart the start step left everything alone, and the company, the person and the file were still there.

## Common Use Cases

- Track companies, contacts and deals in a CRM you host and can extend with custom objects
- Sync a Gmail or Microsoft mailbox and calendar into the CRM (needs your own OAuth app, see Twenty's docs)
- Automate follow-ups with Twenty's workflows, or connect other tools through its API and webhooks

## Dependencies for Twenty Hosting

Nothing beyond the template: Postgres, Redis and the bucket are included. Email sending, Google or Microsoft sign-in and mailbox sync need their own credentials, set as variables on both Twenty services.

### Deployment Dependencies

- Twenty: https://github.com/twentyhq/twenty
- Self-hosting docs: https://docs.twenty.com/developers/self-host/self-host
- Image: `twentycrm/twenty:v2.42.6`
- The wrapper this template builds: https://github.com/dektionstudio/railway-template-images/tree/main/twenty

### Implementation Details

```
TWENTY_ADMIN_EMAIL / TWENTY_ADMIN_PASSWORD   # admin account, created with the workspace on first start
APP_SECRET, ENCRYPTION_KEY                   # generated; keep them (ENCRYPTION_KEY protects stored OAuth tokens)
SERVER_URL=https://          # change it when you add a custom domain
STORAGE_TYPE=s3, STORAGE_S3_*                # the private Railway Bucket
NODE_OPTIONS=--max-old-space-size=640        # raise it on plans with more memory per service
```

The worker takes the shared settings from the server's variables (`${{Twenty.APP_SECRET}}` and so on). When you add a setting such as email credentials, add it to the worker too, as a reference to the server's variable. To upgrade, change `TWENTY_VERSION` on the server and the image tag of the worker to the same release; Twenty runs its upgrade migrations on start and supports jumping versions. Back up Postgres first.

Idle, the server used 0.73 GB of RAM, the worker 0.65 GB, Postgres 0.16 GB and Redis 0.01 GB.

## Why Deploy Twenty on Railway?

You get your own CRM on a public HTTPS address in one deploy, with the admin account already yours and the files kept in private storage. The tradeoff is memory: the four services use about 1.6 GB at idle, which is around $15 a month in RAM on Railway's usage pricing.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/twenty-2
