Skip to content

Deploying a Twenty App

Introduction

Twenty is an open-source CRM with a modern React front end and a Node.js/GraphQL backend. This guide shows how to containerize Twenty, connect it to PostgreSQL (and optionally Redis), persist uploads, and deploy it to Klutch.sh over HTTP.

Prerequisites

  • GitHub repository containing your Dockerfile.
  • PostgreSQL database (managed or deployed separately).
  • Optional Redis instance for caching and queueing.
  • Klutch.sh project ready in klutch.sh/app.

Project structure

.
└── Dockerfile

Sample Dockerfile

FROM twentycrm/twenty:latest
# Default app port
ENV PORT=3000
EXPOSE 3000

Required environment variables

  • DATABASE_URL – PostgreSQL connection string, e.g., postgres://USER:PASSWORD@HOST:PORT/DB
  • APP_URL – public URL, e.g., https://example-app.klutch.sh
  • JWT_SECRET – strong secret for auth tokens
  • SESSION_SECRET – strong secret for session cookies

Optional environment variables

  • REDIS_URL – if using Redis for caching/queues.
  • PORT – override internal port if you change it.
  • NODE_ENV=production

Persistence

If you store file uploads locally, attach a volume:

  • Mount path: /app/storage
  • Size: based on expected attachment growth

Networking

  • Protocol: HTTP
  • Internal port: 3000
  • Users reach https://example-app.klutch.sh while Klutch.sh routes to port 3000 in the container.
Terminal window
curl -I http://localhost:3000

Deployment on Klutch.sh

  1. Push your Dockerfile to GitHub.
  2. In klutch.sh/app, create a new app and choose GitHub as the source.
  3. Klutch.sh automatically detects the Dockerfile in the repository root.
  4. Select HTTP traffic and set the internal port to 3000.
  5. Add environment variables for DATABASE_URL, APP_URL, JWT_SECRET, SESSION_SECRET, and any Redis configuration. Mark secrets as sensitive.
  6. Optionally attach a persistent volume at /app/storage if storing uploads locally.
  7. Deploy. After the app starts, create your initial workspace and user in the UI.

Verification

  • UI: open https://example-app.klutch.sh and confirm the onboarding screen loads.

  • Quick API check (if applicable):

    Terminal window
    curl -I https://example-app.klutch.sh

Next steps

  • Enforce strong secrets and rotate them periodically.
  • Enable database backups for PostgreSQL.
  • Configure Redis and object storage if you expect heavy usage or large attachments.