Getting started

Self-Hosting

Extending

Rest APIs
GraphQL APIs

Contributing

Frontend Development
Backend Development

User Guide

Local Setup

Local Setup
In this article

Mostly for contributors or curious developers

Follow this guide if you would like to setup the project locally to contribute.

Prerequisites

Linux and MacOS
Windows (WSL)

Before you can install and use Twenty, make sure you install the following on your computer:

npm won't work, you should use yarn instead. Yarn is now shipped with Node.js, so you don't need to install it separately. You only have to run corepack enable to enable Yarn if you haven't done it yet.


Step 1: Git Clone

In your terminal, run the following command.

SSH (Recommended)
HTTPS

If you haven't already set up SSH keys, you can learn how to do so here.

git clone [email protected]:twentyhq/twenty.git

Step 2: Position yourself at the root

cd twenty

You should run all commands in the following steps from the root of the project.

Step 3: Set up a PostgreSQL Database

We rely on pg_graphql and recommend you use the scripts below to provision a database with the right extensions.
You can access the database at localhost:5432, with user twenty and password twenty .

Linux
Mac OS
Windows (WSL)

Option 1: To provision your database locally:

make postgres-on-linux

Option 2: If you have docker installed:

make postgres-on-docker

Step 4: Setup environment variables

Use environment variables or .env files to configure your project.

Copy the .env.example files in /front and /server:

cp ./packages/twenty-front/.env.example ./packages/twenty-front/.env

cp ./packages/twenty-server/.env.example ./packages/twenty-server/.env

Step 5: Installing dependencies

Use nvm to install the correct node version. The .nvmrc ensures all contributors use the same version.

To build Twenty server and seed some data into your database, run the following commands:

nvm install # installs recommended node version

nvm use # use recommended node version

yarn

Step 6: Running the project

Setup your database with the following command:

npx nx database:reset twenty-server

Start the server and the frontend:

npx nx start twenty-server

npx nx start twenty-front

Alternatively, you can start both applications at once:

npx nx start

Twenty's server will be up and running at http://localhost:3000/graphql. Twenty's frontend will be running at http://localhost:3001. Just login using the seeded demo account: [email protected] (password: Applecar2025) to start using Twenty.

Troubleshooting

CR line breaks found [Windows]

This is due to the line break characters of Windows and the git configuration. Try running:

git config --global core.autocrlf false

Then delete the repository and clone it again.

Missing metadata schema

During Twenty installation, you need to provision your postgres database with the right schemas, extensions, and users. If you're successful in running this provisioning, you should have default and metadata schemas in your database. If you don't, make sure you don't have more than one postgres instance running on your computer.

Cannot find module 'twenty-emails' or its corresponding type declarations.

You have to build the package twenty-emails before running the initialization of the database with npx nx run twenty-emails:build

Missing twenty-x package

Make sure to run yarn in the root directory and then run npx nx server:dev twenty-server. If this still doesn't work try building the missing package manually.

Lint on Save not working

This should work out of the box with the eslint extension installed. If this doens't work try adding this to your vscode setting (on the dev container scope):

"editor.codeActionsOnSave": {

  "source.fixAll.eslint": "explicit"

}

Docker container build

To successfully build Docker images, ensure that your system has a minimum of 2GB of memory available. For users of Docker Desktop, please verify that you've allocated sufficient resources to Docker within the application's settings.

Noticed something to change?

As an open-source company, we welcome contributions through Github. Help us keep it up-to-date, accurate, and easy to understand by getting involved and sharing your ideas!

twenty github image
The #1 Open Source CRM
©2024 Twenty PBC