---
title: "Deploy Twenty CRM (Self-Hosted Salesforce Alternative)"
description: "Self-host Twenty CRM: a modern Salesforce alternative with no seat fees."
category: "CMS"
url: https://railway.com/deploy/self-hosted-twenty-crm
---

# Deploy Twenty CRM (Self-Hosted Salesforce Alternative)

Self-host Twenty CRM: a modern Salesforce alternative with no seat fees.

**[Deploy Twenty CRM (Self-Hosted Salesforce Alternative) on Railway](https://railway.com/template/self-hosted-twenty-crm)**

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

- **Creator:** blueorange
- **Category:** CMS

## Template content

### Twenty https://raw.githubusercontent.com/twentyhq/twenty/6fd8dab55243cda291fa45f896caaa9d5e5160b8/packages/twenty-chrome-extension/public/logo/32-32.svg

- **Image:** twentycrm/twenty:latest

### Twenty Worker https://raw.githubusercontent.com/twentyhq/twenty/6fd8dab55243cda291fa45f896caaa9d5e5160b8/packages/twenty-chrome-extension/public/logo/32-32.svg

- **Image:** twentycrm/twenty:latest

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

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

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Buckets

- **Bucket**

## Documentation

# Deploy and Host Twenty CRM on Railway

![Twenty logo](https://cdn.jsdelivr.net/gh/selfhst/icons/png/twenty.png)

Twenty is a modern CRM with **60,000+ GitHub stars**, built as an open alternative to Salesforce and HubSpot. It gives sales and ops teams companies, people and opportunities, Kanban pipelines, custom objects, workflows, email and calendar sync, and full REST and GraphQL APIs, in a fast, spreadsheet-like interface. This template runs the complete Twenty stack on Railway: the server, a background worker, PostgreSQL, Redis and a Railway Bucket for file uploads, all wired over the private network with one shared secret. Twenty Cloud costs $9 to $39 per user per month. Self-hosting on Railway costs about $15–25/month for the whole stack, however many teammates you add.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Twenty** | The `twentycrm/twenty` server: web app, API and database migrations on port `3000`. Registers scheduled jobs. |
| **Twenty Worker** | The same image running background jobs: email and calendar sync, workflows and imports, through BullMQ. |
| **Postgres** | PostgreSQL 18 with SSL. Stores every company, person, opportunity, note and custom object. |
| **Redis** | Redis 8.2 with a password and a volume. Holds the job queue and cache the worker reads from. |
| **Bucket** | A Railway Bucket (S3-compatible) for avatars, attachments and imported files. |

The server and worker share one generated `APP_SECRET`, one Postgres database, one Redis queue and one bucket. Only the server runs migrations and registers cron jobs, so the two never compete.

---

## About Hosting Twenty CRM

Twenty is not a single container. A working install needs four things to agree, and most broken setups get one wrong.

**The worker is mandatory.** The server answers web and API requests, but email sync, calendar sync, workflow runs and CSV imports happen in a separate worker process. Without it, the app looks fine and nothing in the background ever runs. This template deploys the worker from the same image and turns off migrations and cron registration on it, so only the server does those.

**One secret for both processes.** `APP_SECRET` signs login sessions and encrypts stored credentials such as connected mailboxes. The worker references the server's value, so they always match. If they drift apart, logins fail and connected accounts stop syncing.

**The public URL must match.** `SERVER_URL` is built from the Twenty service's public domain. If it doesn't match the address you open in your browser, sign-in redirects in a loop. That is the most common Twenty support question.

**Redis and file storage.** The job queue runs on Redis, and uploads go to the included Railway Bucket through Twenty's S3 driver, so files survive redeploys without extra setup. Switch `STORAGE_TYPE` to `local` if you'd rather keep files on the Twenty volume.

Typical cost: **~$15–25/month** on Railway for all five pieces at small-team usage. The server and worker each idle at around 0.5 GB of RAM. Twenty's core is AGPL-3.0, and a few enterprise features need a paid licence.

---

## Deploy Twenty CRM in Under 5 Minutes

1. Click **Deploy on Railway**. All services build and connect in about 3–5 minutes, and the server runs its migrations on first boot.
2. Open the **Twenty** service, then **Settings** and **Networking**. Check that a public domain points to port `3000`, and generate one if it doesn't. Redeploy so `SERVER_URL` picks it up.
3. Open that domain. Twenty's setup screen creates your workspace and first admin account.
4. Import companies and people from CSV, or connect Gmail or Outlook so emails and meetings attach to contacts.
5. Build your pipeline stages, add custom fields, and invite your team from **Settings**.

No per-seat bills. No record limits.

---

## Common Use Cases

- **Replace Salesforce or HubSpot.** Move your sales pipeline to a modern CRM and stop paying per seat.
- **Startup sales pipeline.** Track leads, deals and follow-ups in Kanban stages from day one.
- **Custom objects for anything.** Model partners, investors, candidates, vendors or assets with their own fields and views.
- **Product-led CRM.** Push sign-ups, trials and usage from your app into Twenty through the GraphQL or REST API.
- **Agency client management.** Keep clients, projects and contacts in one shared workspace.
- **Workflow automation.** Trigger actions when records change, run scheduled jobs, and call webhooks without extra tools.

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `APP_SECRET` | 🔐 Auto-generated | Signs sessions and encrypts stored secrets. The worker references the same value. |
| `SERVER_URL` | ✅ Auto-set | `https://` plus the Twenty public domain. Must match the URL you open. |
| `PG_DATABASE_URL` | ✅ Auto-injected | Private Postgres connection, on both server and worker. |
| `REDIS_URL` | ✅ Auto-injected | Private Redis connection for the BullMQ job queue. |
| `STORAGE_TYPE` | ✅ Set | `s3`, using the Railway Bucket. Set `local` to store uploads on the volume. |
| `STORAGE_S3_NAME`, `STORAGE_S3_REGION`, `STORAGE_S3_ENDPOINT` | ✅ Auto-injected | Bucket name, region and endpoint from the Railway Bucket. |
| `STORAGE_S3_ACCESS_KEY_ID`, `STORAGE_S3_SECRET_ACCESS_KEY` | 🔐 Auto-injected | Bucket credentials. |
| `DISABLE_DB_MIGRATIONS` | ✅ Set | `false` on the server, `true` on the worker. |
| `DISABLE_CRON_JOBS_REGISTRATION` | ✅ Set | `false` on the server, `true` on the worker. |
| `NODE_PORT`, `PORT` | ✅ Set | `3000`, where the server listens. |
| `ENABLE_ALPINE_PRIVATE_NETWORKING` | ✅ Set | `true`, so the image resolves Railway's private IPv6 hostnames. |

**Email and calendar sync.** To connect Gmail or Outlook, add Twenty's Google or Microsoft OAuth variables (client ID, secret and callback URLs) to both the server and the worker. The Twenty self-hosting docs list them.

**Custom domain.** Add your domain to the Twenty service in Railway, then redeploy so `SERVER_URL` uses it.

---

## Twenty CRM vs. Alternatives

| | Twenty on Railway | Twenty Cloud | Salesforce | HubSpot |
|---|---|---|---|---|
| **Monthly cost** | ~$15–25 usage, flat | $9–39 per user | Per user, higher tiers | Free tier, then per seat |
| **Self-hosted** | ✅ Yes | ❌ No | ❌ No | ❌ No |
| **Per-seat fees** | ✅ None | ❌ Yes | ❌ Yes | ❌ Yes |
| **Custom objects** | ✅ Yes | ✅ Yes | ✅ Yes | ⚠️ Paid tiers |
| **REST and GraphQL API** | ✅ Both | ✅ Both | ⚠️ REST and SOQL | ⚠️ REST |
| **Data on your own infrastructure** | ✅ Yes | ❌ Hosted | ❌ Hosted | ❌ Hosted |
| **License** | ✅ AGPL-3.0 core | ✅ AGPL-3.0 core, hosted | ❌ Proprietary | ❌ Proprietary |

---

## Dependencies for Twenty CRM Hosting

- Railway account. Hobby works for a small team; Pro for more RAM as records and syncs grow.
- A public domain on the Twenty service (Railway-generated or your own).
- Optional: Google or Microsoft OAuth apps for email and calendar sync, and SMTP for outgoing mail.

### Deployment Dependencies

- [Twenty on GitHub](https://github.com/twentyhq/twenty): source code and releases
- [Twenty Self-Hosting Docs](https://twenty.com/developers/section/self-hosting): environment variables and setup
- [Twenty Docker image](https://hub.docker.com/r/twentycrm/twenty): image tags
- [Railway Private Networking](https://docs.railway.com/guides/private-networking): how services connect

### Implementation Details

Both Twenty services run `twentycrm/twenty:latest`, and the worker is told to skip migrations and cron registration. The server references Postgres, Redis and the Bucket directly. The worker references the server's secret, URL and storage settings, so changing them on the server updates both. Redis runs with `--requirepass` and saves to its volume every 60 seconds when data changes.

The image tag is `latest`, so a redeploy can pull a newer Twenty release. Back up Postgres before redeploying, or pin a version tag such as `v2.55.0` for controlled upgrades.

---

## Frequently Asked Questions

**What is Twenty, and is it really free?**
Twenty is a modern CRM whose core is AGPL-3.0 and free to self-host with no user limits. You pay only for Railway usage. A few enterprise features need Twenty's commercial licence.

**How much does it cost compared to Twenty Cloud or Salesforce?**
About $15–25/month on Railway for the whole stack. Twenty Cloud is $9–39 per user per month, so a 10-person team pays $90–390. Salesforce and HubSpot also charge per seat.

**Why does login keep redirecting me back to the sign-in page?**
`SERVER_URL` doesn't match the address you opened. Make sure the Twenty service has a public domain on port 3000, open exactly that URL, and redeploy after changing domains.

**Why aren't emails syncing or workflows running?**
Those run in the Twenty Worker. Check it is running and connected to Redis, and that Google or Microsoft OAuth variables are on both the server and the worker.

**Can I import my data from Salesforce or HubSpot?**
Yes. Export companies, people and deals to CSV and import them in Twenty, or use the REST or GraphQL API for larger, scripted migrations.

**How do I upgrade Twenty safely?**
Back up the Postgres volume, then redeploy both Twenty services together so they run the same version. The server applies database migrations on startup.

---

## Why Deploy and Host Twenty CRM 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 Twenty CRM on Railway, you get a complete, correctly wired CRM stack with a worker, database, queue and file storage, at a flat monthly cost with no per-seat fees.


## 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/self-hosted-twenty-crm
