---
title: "Deploy Twenty Self-Hosted (Docker)"
description: "Step-by-step guide to self-hosting Twenty with Docker Compose. "
---
# Deploy Twenty
A modern open-source CRM alternative to Salesforce and Pipedrive.
⭐ 15.0k stars
📜 AGPL-3.0
🔴 Advanced
⏱ ~20 minutes
## What You'll Get
A fully working Twenty instance running on your server. Your data stays on your hardware — no third-party access, no usage limits, no surprise invoices.
## Prerequisites
- A server with Docker and Docker Compose installed ([setup guide](/quick-start/choosing-a-server))
- A domain name pointed to your server (optional but recommended)
- Basic terminal access (SSH)
## The Config
Create a directory for Twenty and add this `docker-compose.yml`:
```yaml
# -------------------------------------------------------------------------
# 🚀 Created and distributed by The AltStack
# 🌍 https://thealtstack.com
# -------------------------------------------------------------------------
version: '3.8'
services:
twenty:
image: twentyhq/twenty:latest
container_name: twenty
restart: unless-stopped
depends_on:
- db
ports:
- "3000:3000"
environment:
- PG_DATABASE_URL=postgres://twenty:twenty@db:5432/twenty
- FRONTEND_URL=http://localhost:3000
db:
image: postgres:15-alpine
container_name: twenty-db
restart: unless-stopped
environment:
- POSTGRES_USER=twenty
- POSTGRES_PASSWORD=twenty
- POSTGRES_DB=twenty
volumes:
- twenty_db_data:/var/lib/postgresql/data
volumes:
twenty_db_data:
```
## Let's Ship It
```bash
# Create a directory
mkdir -p /opt/twenty && cd /opt/twenty
# Create the docker-compose.yml (paste the config above)
nano docker-compose.yml
# Pull images and start
docker compose up -d
# Watch the logs
docker compose logs -f
```
## Environment Variables
| Variable | Default | Required |
|---|---|---|
| `PG_DATABASE_URL` | `postgres://twenty:twenty@db:5432/twenty` | No |
| `FRONTEND_URL` | `http://localhost:3000` | No |
| `POSTGRES_USER` | `twenty` | No |
| `POSTGRES_PASSWORD` | `twenty` | No |
| `POSTGRES_DB` | `twenty` | No |
## Post-Deployment Checklist
- [ ] Service is accessible on the configured port
- [ ] Admin account created (if applicable)
- [ ] Reverse proxy configured ([Caddy guide](/concepts/reverse-proxies))
- [ ] SSL/HTTPS working
- [ ] Backup script set up ([backup guide](/concepts/backups))
- [ ] Uptime monitor added ([Uptime Kuma](/deploy/uptime-kuma))
## The "I Broke It" Section
**Container won't start?**
```bash
docker compose logs twenty | tail -50
```
**Port already in use?**
```bash
# Find what's using the port
lsof -i :PORT_NUMBER
```
**Need to start fresh?**
```bash
docker compose down -v # ⚠️ This deletes volumes/data!
docker compose up -d
```
## Going Further
- [Twenty on AltStack Directory](https://thealtstack.com/alternative-to/twenty)
- [Twenty Self-Hosted Guide](https://thealtstack.com/self-hosted/twenty)
- [Official Documentation](https://twenty.com)
- [GitHub Repository](https://github.com/twentyhq/twenty)