> ## Documentation Index
> Fetch the complete documentation index at: https://docs.twenty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configurazione Locale

> La guida per i collaboratori (o sviluppatori curiosi) che vogliono eseguire Twenty localmente.

## Prerequisiti

> [tab] Linux e macOS
>
> Prima di poter installare e usare Twenty, assicurati di installare quanto segue sul tuo computer:
>
> * [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
>
> * [Node v26](https://nodejs.org/en/download)
>
> * [yarn v4](https://yarnpkg.com/getting-started/install)
>
> * [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md)
>
> > [!WARNING]
> >
> > `npm` non funzionerà, dovresti usare `yarn` invece. Node 26 non include più Corepack, quindi installalo una volta con `npm install -g corepack`, quindi esegui `corepack enable` per abilitare Yarn.

> [tab] Windows (WSL)
>
> 1. Installa WSL
>    Apri PowerShell come amministratore ed esegui:
>
> ```powershell theme={null}
> wsl --install
> ```
>
> Dovresti ora vedere un prompt per riavviare il computer. In caso contrario, riavvialo manualmente.
>
> Al riavvio, si aprirà una finestra di PowerShell e installerà Ubuntu. Questo potrebbe richiedere un po' di tempo.
> Vedrai un prompt per creare un nome utente e una password per la tua installazione di Ubuntu.
>
> 2. Installa e configura Git
>
> ```bash theme={null}
> sudo apt-get install git
>
> git config --global user.name "Your Name"
>
> git config --global user.email "youremail@domain.com"
> ```
>
> 3. Installa nvm, node.js e yarn
>
> > [!WARNING]
> >
> > Usa `nvm` per installare la versione corretta di `node`. Il file `.nvmrc` garantisce che tutti i collaboratori utilizzino la stessa versione.
>
> ```bash theme={null}
> sudo apt-get install curl
>
> curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
> ```
>
> Chiudi e riapri il tuo terminale per usare nvm. Poi esegui i seguenti comandi.
>
> ```bash theme={null}
>
> nvm install # installs recommended node version
>
> nvm use # use recommended node version
>
> npm install -g corepack
> corepack enable
> ```

***

## Passaggio 1: Clona con Git

Nel tuo terminale, esegui il seguente comando.

> [tab] SSH (Consigliato)
>
> Se non hai già configurato le chiavi SSH, puoi imparare come farlo [qui](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh).
>
> ```bash theme={null}
> git clone git@github.com:twentyhq/twenty.git
> ```

> [tab] HTTPS
>
> ```bash theme={null}
> git clone https://github.com/twentyhq/twenty.git
> ```

## Passaggio 2: Posizionati alla radice

```bash theme={null}
cd twenty
```

Dovresti eseguire tutti i comandi nei passaggi successivi dalla radice del progetto.

## Passaggio 3: Configura un database PostgreSQL

> [tab] Linux
>
> **Opzione 1 (preferita):** Per predisporre il database in locale:
> Usa il seguente link per installare PostgreSQL sulla tua macchina Linux: [Installazione di PostgreSQL](https://www.postgresql.org/download/linux/)
>
> ```bash theme={null}
>   psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;"
> ```
>
> Nota: Potrebbe essere necessario aggiungere `sudo -u postgres` al comando prima di `psql` per evitare errori di permessi.
>
> **Opzione 2:** Se hai Docker installato:
>
> ```bash theme={null}
>   make -C packages/twenty-docker postgres-on-docker
> ```

> [tab] Mac OS
>
> **Opzione 1 (preferita):** Per predisporre il database in locale con `brew`:
>
> ```bash theme={null}
>   brew install postgresql@16
>   export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"
>   brew services start postgresql@16
>   psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;"
> ```
>
> Puoi verificare se il server PostgreSQL è in esecuzione eseguendo:
>
> ```bash theme={null}
>   brew services list
> ```
>
> Il programma di installazione potrebbe non creare l'utente `postgres` per impostazione predefinita quando si installa
> tramite Homebrew su macOS. Invece, crea un ruolo di PostgreSQL che corrisponde al tuo nome utente macOS
> (es., "john").
> Per controllare e creare l'utente `postgres` se necessario, segui questi passaggi:
>
> ```bash theme={null}
>   # Connect to PostgreSQL
>   psql postgres
>   or
>   psql -U $(whoami) -d postgres
> ```
>
> Una volta nel prompt di psql (postgres=#), esegui:
>
> ```bash theme={null}
>  # List existing PostgreSQL roles
>  \du
> ```
>
> Vedrai un output simile a:
>
> ```bash theme={null}
>  Role name | Attributes  | Member of
>  -----------+-------------+-----------
>  john      | Superuser   | {}
> ```
>
> Se non vedi un ruolo `postgres` elencato, procedi al passo successivo.
> Crea manualmente il ruolo `postgres`:
>
> ```bash theme={null}
>  CREATE ROLE postgres WITH SUPERUSER LOGIN;
> ```
>
> Questo crea un ruolo superuser chiamato `postgres` con accesso di login.
>
> ```bash theme={null}
> Role name | Attributes  | Member of
> -----------+-------------+-----------
> postgres  | Superuser   | {}
> john      | Superuser   | {}
> ```
>
> **Opzione 2:** Se hai Docker installato:
>
> ```bash theme={null}
>   make -C packages/twenty-docker postgres-on-docker
> ```

> [tab] Windows (WSL)
>
> Tutti i passaggi seguenti devono essere eseguiti nel terminale WSL (all'interno della tua macchina virtuale)
>
> **Opzione 1:** Per predisporre PostgreSQL in locale:
> Usa il seguente link per installare PostgreSQL sulla tua macchina virtuale Linux: [Installazione di PostgreSQL](https://www.postgresql.org/download/linux/)
>
> ```bash theme={null}
>   psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;"
> ```
>
> Nota: Potrebbe essere necessario aggiungere `sudo -u postgres` al comando prima di `psql` per evitare errori di permessi.
>
> **Opzione 2:** Se hai Docker installato:
> Eseguire Docker su WSL aggiunge un livello extra di complessità.
> Usa questa opzione solo se ti senti a tuo agio con i passaggi extra coinvolti, incluso l'attivazione di [Docker Desktop WSL2](https://docs.docker.com/desktop/wsl).
>
> ```bash theme={null}
>   make -C packages/twenty-docker postgres-on-docker
> ```

Ora puoi accedere al database all'indirizzo `localhost:5432`.

Se hai utilizzato l'opzione Docker sopra, le credenziali predefinite sono utente `postgres` e password `postgres`. Per le installazioni native di PostgreSQL, usa le credenziali e i ruoli configurati sulla tua macchina.

## Passaggio 4: Configura un database Redis (cache)

Twenty richiede una cache Redis per offrire le migliori prestazioni.

> [tab] Linux
>
> **Opzione 1:** Per predisporre Redis in locale:
> Usa il seguente link per installare Redis sulla tua macchina Linux: [Installazione di Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/)
>
> **Opzione 2:** Se hai Docker installato:
>
> ```bash theme={null}
>   make -C packages/twenty-docker redis-on-docker
> ```

> [tab] Mac OS
>
> **Opzione 1 (preferita):** Per predisporre Redis in locale con `brew`:
>
> ```bash theme={null}
> brew install redis
> ```
>
> Avvia il tuo server Redis:
>
> ```bash theme={null}
> brew services start redis
> ```
>
> **Opzione 2:** Se hai Docker installato:
>
> ```bash theme={null}
>   make -C packages/twenty-docker redis-on-docker
> ```

> [tab] Windows (WSL)
>
> **Opzione 1:** Per predisporre Redis in locale:
> Usa il seguente link per installare Redis sulla tua macchina virtuale Linux: [Installazione di Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/)
>
> **Opzione 2:** Se hai Docker installato:
>
> ```bash theme={null}
>   make -C packages/twenty-docker redis-on-docker
> ```

Se hai bisogno di una GUI client, ti consigliamo [Redis Insight](https://redis.io/insight/) (versione gratuita disponibile).

## Passaggio 5: Configura le variabili d'ambiente

Usa variabili d'ambiente o file `.env` per configurare il tuo progetto. Maggiori informazioni [qui](https://docs.twenty.com/it/developers/self-host/capabilities/setup.md).

Copia i file `.env.example` in `/front` e `/server`:

```bash theme={null}
cp ./packages/twenty-front/.env.example ./packages/twenty-front/.env
cp ./packages/twenty-server/.env.example ./packages/twenty-server/.env
```

> [!NOTE]
>
> **Modalità multi-workspace:** Per impostazione predefinita, Twenty viene eseguito in modalità a singolo workspace in cui può essere creato un solo workspace. Per abilitare il supporto multi-workspace (utile per testare le funzionalità basate sui sottodomini), imposta `IS_MULTIWORKSPACE_ENABLED=true` nel file `.env` del server. Vedi [Modalità multi-workspace](https://docs.twenty.com/it/developers/self-host/capabilities/setup.md#multi-workspace-mode) per i dettagli.

## Passaggio 6: Installazione delle dipendenze

Per costruire il server Twenty e popolare alcuni dati nel tuo database, esegui il seguente comando:

```bash theme={null}
yarn
```

Nota che `npm` o `pnpm` non funzioneranno

## Passaggio 7: Esecuzione del progetto

> [tab] Linux
>
> A seconda della tua distribuzione Linux, il server Redis potrebbe essere avviato automaticamente.
> In caso contrario, controlla la [guida all'installazione di Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/) per la tua distribuzione.

> [tab] Mac OS
>
> Redis dovrebbe essere già in esecuzione. In caso contrario, esegui:
>
> ```bash theme={null}
> brew services start redis
> ```

> [tab] Windows (WSL)
>
> A seconda della tua distribuzione Linux, il server Redis potrebbe essere avviato automaticamente.
> In caso contrario, controlla la [guida all'installazione di Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/) per la tua distribuzione.

Configura il tuo database con il seguente comando:

```bash theme={null}
npx nx database:reset twenty-server
```

Avvia il server, il worker e i servizi del frontend:

```bash theme={null}
npx nx start twenty-server
npx nx worker twenty-server
npx nx start twenty-front
```

In alternativa, puoi avviare tutti i servizi contemporaneamente:

```bash theme={null}
npx nx start
```

## Passo 8: Utilizza Twenty

**Frontend**

Il frontend di Twenty sarà in esecuzione su [http://localhost:3001](http://localhost:3001).
Puoi accedere utilizzando l'account demo predefinito: `tim@apple.dev` (password: `tim@apple.dev`)

**Backend**

* Il server di Twenty sarà attivo e funzionante su [http://localhost:3000](http://localhost:3000)
* L'API GraphQL è accessibile su [http://localhost:3000/graphql](http://localhost:3000/graphql)
* L'API REST è raggiungibile su [http://localhost:3000/rest](http://localhost:3000/rest)

## Risoluzione dei problemi

Se riscontri problemi, controlla [Risoluzione dei problemi](https://docs.twenty.com/it/developers/self-host/capabilities/troubleshooting.md) per le soluzioni.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.