---
title: Yarn Setup
sidebar_position: 1
description: |
  Set up the project with Yarn
  (MacOs and Linux)
sidebar_custom_props:
  icon: TbScript
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

In this document, you'll learn how to install the project using yarn. We recommend this method since it's the easiest way to get started but you can also run the project with [Docker](/contributor/local-setup/docker-setup) or [WSL2](/contributor/local-setup/wsl-setup).  

:::info
`npm` currently does not support local packages satisfactorily. We strongly recommend using `yarn` instead.
:::

## Prerequisites

Before you can install and use Twenty, make sure you install the following on your computer:
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- [Node v18](https://nodejs.org/en/download) 
- [yarn v1](https://classic.yarnpkg.com/lang/en/docs/install/) 
- [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md)

---

## Step 1: Git Clone

In your terminal, run the following command. 

:::info Note

We recommend using SSH for this step. If you already haven't set up SSH keys, please do so first. You can learn more about it [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh). 

:::

<Tabs>
<TabItem value="ssh" label="SSH (Recommended)" default>

```bash
git clone git@github.com:twentyhq/twenty.git
```
</TabItem>
<TabItem value="https" label="HTTPS" >

```bash
git clone https://github.com/twentyhq/twenty.git
```

</TabItem>
</Tabs>


## Step 2: Set up PostgreSQL Database
You need to have a PostgreSQL instance available to be able to use Twenty.
This database needs to be provisioned with a `twenty` user (password: `twenty`), a `default` database and a `test` database.

<Tabs>
<TabItem value="linux" label="Linux" default>
<b>Option 1:</b> To provision your database locally:
<br /><br />

```bash
cd twenty
./infra/dev/scripts/setup-postgres-linux.sh
```

<b>Option 2:</b> Alternatively if you have docker installed:
<br /><br />

```bash
cd twenty
make provision-postgres
```
This will create a Docker container, exposing a PostgresSQL instance at [http://localhost:5432](http://localhost:5432).
You can access this using `twenty` postgres user (password: `twenty`)
  </TabItem>
  <TabItem value="mac-os" label="Mac OS" default>

<b>Option 1:</b> To provision your database locally:
<br /><br />

```bash
cd twenty
./infra/dev/scripts/setup-postgres-macos.sh
```

<b>Option 2:</b> Alternatively if you have docker installed:
<br /><br />

```bash
cd twenty
make provision-postgres
```
This will create a Docker container, exposing a PostgresSQL instance at [http://localhost:5432](http://localhost:5432).
You can access this using `twenty` postgres user (password: `twenty`)

  </TabItem>
  <TabItem value="wsl" label="Windows (WSL)">

We recommend that you provision your database locally:
```bash
cd twenty
bash ./infra/dev/scripts/setup-postgres-linux.sh
```
This will create a Docker container, exposing a PostgresSQL instance at [http://localhost:5432](http://localhost:5432).
You can access this using `twenty` postgres user (password: `twenty`)
  </TabItem>
</Tabs>


## Step 3: Setup env variables

Twenty requires a few environment variables to be set. Locally, we recommend setting them through a `.env` file.

To do so, make copies of the `.env.example` files in `/front` and `/server`:
```bash
cp ./front/.env.example ./front/.env
cp ./server/.env.example ./server/.env
```

## Step 4: Server setup

:::info

We recommend that you use `nvm` to install the correct `node` version. We have added a `server/.nvmrc` to ensure all contributors use the same version.

:::

To build Twenty server and seed some data into your database, run the following commands:
```bash
cd server
nvm install #recommended
nvm use #recommended 
yarn
yarn database:init
yarn start:dev
```

Twenty's server will be up and running at [http://localhost:3000/graphql](http://localhost:3000/graphql).

## Step 5: Frontend setup

:::info

For the frontend setup, too, we recommend using `nvm` to install the right node version. 

:::

To set up the frontend, run the following commands in another terminal:

```bash
cd front
nvm install #recommended
nvm use #recommended 
yarn
yarn start
```

Twenty's frontend will be running at [http://localhost:3001](http://localhost:3001). Simply login using our seeded demo account: `tim@apple.dev` to start using Twenty.

