What you will set up
Twenty is a CRM: it keeps track of the companies you work with, the people at them, and the deals you hope to win, with notes, tasks and files on each. It looks and works much like a spreadsheet, with views you filter, sort and group, a board for your deals, and a search that covers everything. You can add your own fields and objects, and it has an API, webhooks and workflows for automation.
Twenty is developed in the open on GitHub by Twenty.com PBC, a company registered in Delaware in the United States, which also sells it as a hosted service. It is open source under the AGPL-3.0 licence. A few features, such as single sign-on and audit logs, need a paid licence key and are marked Organization in the settings.
Here Twenty runs as a Compose project under a user of its own called twenty, from Twenty's official image, with PostgreSQL for its data and Valkey for its job queue, behind Caddy from the rootless Docker guide. The Docker setup follows that tested base; the app results below come from the tested Podman guide on a Melonslab server and were not re-measured under Docker.
The app-specific results below were recorded in the Podman test on a fresh Melonslab VC-P Alloy (2 vCPU, 8 GB) with Debian 13:
- Twenty 2.46.0 started with PostgreSQL 16 and Valkey 9. The first account was created over an SSH tunnel before Twenty could be reached from the internet. Afterwards, a sign-up from outside was refused.
- A company, a person, a deal, a note and a task were created, and a file was attached to the person. Search found a word in the note's text.
- A colleague joined with an invitation, and another through the invite link. With the invite link switched off, a third was refused.
- Two-factor authentication worked, and the list of devices showed each visitor's real address, over IPv4 and IPv6, and ignored a forged
X-Forwarded-Forheader. - A webhook reached another app on the same server with the setting in step 10, and Twenty still showed each visitor's real address.
- The interface was shown in Swedish.
- Without email set up, invitations and password resets were written to the worker's log instead, as step 9 describes.
- A mailbox on a test mail server was connected with Connect via IMAP/SMTP, and an email from a customer was imported and shown with that person. A mail server on a private address was refused until it was allowed, as step 9 shows.
- Twenty's built-in workflow kept a copy of each new person in its run log, and the copy stayed after the person was deleted for good. Step 7 shows how to stop that.
- With telemetry switched off, the server sent nothing to Twenty when a user signed up. With it on, it contacted
twenty-telemetry.com. - An update from Twenty 2.45.8 to 2.46.0 went through
docker compose pull && docker compose up -d. Twenty was restored from a backup into empty volumes, and everything came back by itself after a reboot.
In the Podman test, the pod used about 1.5 GB of memory once it had settled, nearly all of it the Twenty server and its worker, at about 730 MB each; PostgreSQL and Valkey used about 50 MB together. Right after a start it was about 2.2 GB. The images take about 1.8 GB of disk.
Before you start
You need:
- a server set up as in the rootless Docker guide, with Caddy running, and at least 4 GB of memory;
- an A record and an AAAA record for
crm.example.compointing at your server.
The examples use crm.example.com for Twenty and 203.0.113.10 for your server's IPv4 address, which ip -brief address show eth0 shows. Replace them throughout.
1. Create the user
As root:
useradd -m -s /bin/bash -U twenty
loginctl enable-linger twenty
Do not add the user to the docker group. The daemon is rootless and belongs to this user.
Everything up to step 5 runs as twenty.
2. Create the secrets
As twenty, make one private file with the three values Twenty needs:
umask 077
mkdir -p /home/twenty/twenty/data/db /home/twenty/twenty/data/files
pw=$(openssl rand -hex 24)
{
printf 'POSTGRES_PASSWORD=%s\n' "$pw"
printf 'PG_DATABASE_URL=postgres://twenty:%s@db:5432/twenty\n' "$pw"
printf 'ENCRYPTION_KEY=%s\n' "$(openssl rand -base64 32 | tr -d '\n')"
} > /home/twenty/twenty/secrets.env
unset pw
chmod 600 /home/twenty/twenty/secrets.env
The first line makes the database password. Twenty reads it as part of a database address, so the second line builds that address with the password in it; db is the Compose service name. The third makes the encryption key, which Twenty uses for sessions, two-factor secrets and the passwords of connected accounts. Without it a restored backup is of little use, so step 11 saves a copy. Only twenty can read the file.
3. Define the Compose services
As twenty, create the Compose file:
cat > /home/twenty/twenty/compose.yaml <<'YAML'
services:
db:
image: docker.io/library/postgres:16
env_file:
- ./secrets.env
environment:
POSTGRES_DB: twenty
POSTGRES_USER: twenty
volumes:
- ./data/db:/var/lib/postgresql/data
restart: always
redis:
image: docker.io/valkey/valkey:9-alpine
command: --maxmemory-policy noeviction
restart: always
server:
image: docker.io/twentycrm/twenty:v2
depends_on:
- db
- redis
ports:
# Only Caddy, on this server, can reach Twenty: the port is not open to the internet.
- "127.0.0.1:8117:3000"
env_file:
- ./secrets.env
environment:
SERVER_URL: http://localhost:8117
TRUST_PROXY: 203.0.113.10
TELEMETRY_ENABLED: "false"
REDIS_URL: redis://redis:6379
STORAGE_TYPE: local
volumes:
- ./data/files:/app/packages/twenty-server/.local-storage
restart: always
worker:
image: docker.io/twentycrm/twenty:v2
command: yarn worker:prod
depends_on:
- server
env_file:
- ./secrets.env
environment:
SERVER_URL: http://localhost:8117
TELEMETRY_ENABLED: "false"
REDIS_URL: redis://redis:6379
STORAGE_TYPE: local
DISABLE_DB_MIGRATIONS: "true"
DISABLE_CRON_JOBS_REGISTRATION: "true"
volumes:
- ./data/files:/app/packages/twenty-server/.local-storage
restart: always
YAML
chown -R twenty:twenty /home/twenty/twenty
The server serves the web app and the API; the worker sends email, runs imports, workflows and scheduled jobs from the same image with the same settings. Only the server updates the database. SERVER_URL is the address Twenty puts in links; it is http://localhost:8117 for now so you can create your account through an SSH tunnel, and step 5 changes it. TRUST_PROXY names the address Twenty trusts to tell it the visitor's real address. Caddy's connections arrive from the server's own IPv4 address in the tested Podman setup; under Docker the address may differ, so check the Devices list and adjust it if every device shows the same address. TELEMETRY_ENABLED=false stops the server sending each new user's email address and name to Twenty. Valkey is the job queue, with noeviction so it does not drop queued jobs. Attached files go in ./data/files; everything else is in the database. The v2 tag follows Twenty 2; PostgreSQL stays on 16.
Start it:
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose pull && docker compose up -d"
The first pull downloads about 1.8 GB of images, and Twenty then takes a few minutes to set up its database. It is ready when this prints active:
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose ps"
4. Create your account over an SSH tunnel
Until a workspace exists, whoever opens Twenty first creates it and becomes its admin. Create yours now, while Twenty can only be reached from the server itself.
On your own computer, open a tunnel to the server, and keep it open:
ssh -L 8117:127.0.0.1:8117 root@203.0.113.10
Open http://localhost:8117 in your browser, and choose Continue with Email. Enter your email address, choose Continue, then a password of at least 8 characters, and Sign up. Twenty then asks for a Name for your workspace, such as your company's name, and Create workspace. If it offers an app to install, choose Skip. Enter your First Name and Last name, choose Continue, and at Invite your team choose Skip, then Skip anyway.
Twenty opens your workspace, with five example companies, such as Airbnb and Stripe, and people and deals to go with them. Your account is the workspace's admin, and the only one with the Admin Panel. Close the tunnel with exit.
5. Put Caddy in front
As twenty, give Twenty its public address and restart it:
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && sed -i 's|http://localhost:8117|https://crm.example.com|g' compose.yaml && docker compose restart"
The restart takes about two minutes: the server checks its database each time it starts.
6. Check who can get in
With one workspace in place, nobody can sign up on their own: an address without an invitation gets "User does not have access to this workspace". People join in two ways, both under Settings > Members > Invite:
- Invite by email sends an invitation to an address, valid for 30 days. Until email works (step 9), the invitation is not sent, but its link is in the worker's log.
- Invite by link is a link that lets anyone who has it join. If you do not use it, switch off Invite by Link under Settings > General > Security. The link then answers "You do not have permission to perform this action."
New members get the Member role: they see and change all records, but the workspace settings are not in their menu. Settings > Members > Roles shows what each role may do, and you can make roles of your own.
Under Settings > Profile, each user can switch on Two Factor Authentication with an authenticator app, and see their Devices: the browsers that are logged in, with the address each was last used from. Settings > General > Security can require two-factor authentication for everyone.
7. Companies, people and deals
The menu on the left has your records: Companies, People, Opportunities (your deals), Tasks and Notes. To start:
- Delete the examples: open Companies, tick the box at the top of the list to select all, open the menu with ⋮ at the top right, and choose Delete Companies. Do the same under People and Opportunities. The same menu has See deleted Companies, should you need one back.
- Companies > Create, type the name, such as
Björkvägen Bygg AB, and press Enter. The record opens on the right, where you fill in its fields. - People > Create, and type the first name, Tab, and the last name. On the person's record, the pencil next to Company links them to a company.
- Opportunities > Create adds a deal, with an Amount, a Stage and a Close date. Choose All Opportunities above the list, then By Stage, to see your deals as a board with a column for each stage.
Each record has tabs for its Timeline and Tasks, and under More its Notes and Files, where Add file attaches a file from your computer. The search at the top left finds records by name, and notes by their text.
Under Settings > Data model, you can add fields to any object, such as an organisation number on companies, and create objects of your own. Settings > Experience sets your time zone and date format.
Twenty comes with an active workflow, Create company when adding a new person. It runs every time a person is created or changed, and its run log under Workflows > Workflow Runs keeps a copy of the whole record, with name, email address and job title. That matters when someone asks you to delete their data. Deleting the person, even with Permanently destroy Person under See deleted People, leaves the copy. Nobody can delete a run by hand, not even an admin: Twenty answers "You do not have permission to perform this workflow action". By Twenty's code, it removes finished runs itself once they are 14 days old; we did not wait to see it. With this guide's settings, the workflow also fails at its first step and creates no companies, because its code steps need a feature that is off by default. Unless you use it, open Workflows > Workflows > Create company when adding a new person and choose Deactivate. After that, new and changed people no longer end up in the run log. Emails imported from a connected mailbox (step 9) also stay when the person is deleted. Add their address to the Blocklist under Settings > Accounts, and Twenty deletes the emails it imported from that address.
8. Use Twenty in Swedish
Twenty comes translated into Swedish. A user whose browser is set to Swedish gets it from their first login; anyone else picks Swedish under Settings > Experience > Language. The menus, buttons and the names of the standard objects then change, so Companies becomes Företag and Opportunities Affärsmöjligheter.
9. Email
Twenty sends email for invitations, password resets and the Change Password link in each profile. This guide does not set up email, and without it, Twenty writes each email to the worker's log instead of sending it. Nothing shows an error: Forgot your password? answers "If this email is registered, a password reset link has been sent", and an invitation shows as sent in the list. To find the link, as twenty:
docker compose logs worker 2>&1 | grep -E 'Sent email to|https://[^ ]*/(invite|reset-password)/' | grep -vE '<|href'
To send email, point Twenty at your email provider's SMTP server. Then append the SMTP password to /home/twenty/twenty/secrets.env and add these lines under environment: for both the server and worker services, with your own server, account and sender address:
printf 'SMTP_PASSWORD=%s\n' 'the-smtp-password' >> /home/twenty/twenty/secrets.env
EMAIL_DRIVER: SMTP
EMAIL_SMTP_HOST: smtp.example.com
EMAIL_SMTP_PORT: 587
EMAIL_SMTP_USER: crm@example.com
EMAIL_FROM_ADDRESS: crm@example.com
EMAIL_FROM_NAME: Exempel AB
Restart as in step 5, and try Forgot your password? on the login page. On port 587, Twenty switches to TLS with STARTTLS when the server offers it, as email providers do; for port 465, which uses TLS from the start, change the port. If no email arrives, docker compose logs worker shows the error. We checked these settings against a test server on the same machine, without TLS, not with a real email provider.
Each user can also connect their own mailbox, so that their emails show on the records of the people involved. Under Settings > Accounts, choose Connect via IMAP/SMTP, and enter the mailbox's IMAP server, for reading, and its SMTP server, for sending, each with its port and Connection security. Twenty tests both before it saves. On the next page, choose what other users may see of each email (Metadata, the default, shows only the time and who took part) and which people Twenty creates by itself, then Add account. We connected a mailbox on a test mail server, and an email from a customer was imported and showed up with that person. Gmail and Microsoft 365 get buttons of their own there, but only with an app registered with Google or Microsoft, which is not covered here.
Twenty refuses mail servers on private addresses, such as 192.168.1.10, so that users cannot reach other machines on your network through it. To connect one, add the following to environment: for both the server and worker services, separate several names with commas, and restart as in step 5:
OUTBOUND_HTTP_ALLOWED_INTERNAL_HOSTS: mail.internal.example.com
A mail server on a public address, as at email providers, needs nothing.
10. Outside services
With the settings from step 3, we captured the server's DNS lookups and outgoing connections while Twenty started, sat idle, and while users signed up and records were created. What we saw:
- Telemetry. By default, every time a user signs up, the server sends their email address, name and workspace, and your server's address, to
twenty-telemetry.com, run by Twenty. WithTELEMETRY_ENABLED=falseit sent nothing. With the line removed, our capture showed a lookup oftwenty-telemetry.comat the next sign-up. - The app catalog. When the worker starts, and every hour after, it fetches the list of apps for Settings > Apps from
registry.npmjs.org, the npm package registry run by GitHub, andunpkg.com, a public mirror of it. It sends nothing about your data. There is no setting to switch it off.
The browser makes some requests of its own:
- Company logos load from
twenty-icons.com, run by Twenty, which gets the domain name of each company you look at. - Each time Twenty loads, it fetches its own logo from
twentyhq.github.io, on GitHub, even after you upload a logo for your workspace under Settings > General. - The emails Twenty sends show its logo from
app.twenty.com, which loads when the recipient opens the email.
Webhooks, under Settings > MCP & APIs, call the addresses you give them, and the AI features need a key from an AI provider, which this guide does not set up.
In the Podman test, a webhook to another app on the same server reached Twenty itself, and a host mapping did not help because Twenty refuses private addresses. The fix there was to give the twenty user's containers addresses of their own and change TRUST_PROXY accordingly. That workaround was not re-tested under Docker: if you need webhooks to apps on this server, check the address shown in the Devices list and adjust TRUST_PROXY in compose.yaml before relying on it.
11. Back up
As twenty:
mkdir -p /home/twenty/backup
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose exec -T db pg_dump -U twenty twenty" > /home/twenty/backup/twenty-db.sql
tar czf /home/twenty/backup/twenty-files.tgz -C /home/twenty/twenty data/files
cp /home/twenty/twenty/secrets.env /home/twenty/backup/encryption-key.txt
That is the database, with all your records, users and settings, the attached files, and the encryption key. The dump runs while Twenty keeps working. Copy /home/twenty/backup to another machine, for example with restic, and store it safely: it holds all your customer data and the key.
To restore into empty data directories, as twenty, with the backup in /home/twenty/backup:
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose down"
rm -rf /home/twenty/twenty/data/db /home/twenty/twenty/data/files
tar xzf /home/twenty/backup/twenty-files.tgz -C /home/twenty/twenty
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose up -d db"
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose exec -T db psql -U twenty -d twenty -q -o /dev/null" < /home/twenty/backup/twenty-db.sql
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose up -d"
Starting only the database first loads the backup before Twenty sets up an empty one. The psql line prints nothing when all goes well. On a new server, put the saved ENCRYPTION_KEY line into secrets.env instead of generating a new one in step 2, and skip step 4.
12. Update
Add the weekly docker-update.service and docker-update.timer from the rootless Docker guide, with WorkingDirectory=/home/twenty/twenty, then enable the timer as twenty. The service pulls new images and recreates the containers. Twenty updates its database when the server starts, which takes a few minutes after an update. To update now:
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose pull && docker compose up -d"
Twenty can skip versions. To see that the database is up to date afterwards:
uid=$(id -u twenty)
runuser -u twenty -- env HOME=/home/twenty XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/twenty/twenty && docker compose exec -T server yarn command:prod upgrade:status 2>&1 | grep Workspaces:"
It prints Workspaces: 1 up to date, 0 behind, 0 failed (1 total). Take a backup first, and read the release notes on GitHub before larger updates. A move to Twenty 3 will need a new tag.
Troubleshooting
docker compose up -d returns, but the page does not load. Twenty is still setting up. docker compose ps shows the services, and docker compose logs -f server shows what the server is doing.
Invite links start with http://localhost:8117. SERVER_URL is still the one for the tunnel. Do step 5.
Every device in the profile has the server's own address. TRUST_PROXY in /home/twenty/twenty/compose.yaml must name the address Caddy's connections arrive from. Check the agent logs on the Podman test and the Devices list: if everyone shows the same address, change it and restart with docker compose restart. Logins through the SSH tunnel always show the server's address.
Connecting a mailbox fails with "The server address you entered is not allowed". The mail server has a private address. Allow it with OUTBOUND_HTTP_ALLOWED_INTERNAL_HOSTS in the server and worker environments, as in step 9. Addresses that start with 169.254. are refused even when listed.
An invited colleague gets no email. Email is not set up: the link is in the worker's log, as step 9 shows. With email set up, docker compose logs worker shows the SMTP error.
Compose says permission denied. Run it as twenty from /home/twenty/twenty, with DOCKER_HOST pointing at the user's socket.