--- title: Configurazione Locale description: "La guida per i collaboratori (o sviluppatori curiosi) che vogliono eseguire Twenty localmente." image: /images/user-guide/fields/field.png --- Header ## Prerequisiti 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 v24.5.0](https://nodejs.org/en/download) - [yarn v4](https://yarnpkg.com/getting-started/install) - [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) `npm` non funzionerà, dovresti usare `yarn` invece. Yarn è ora incluso con Node.js, quindi non è necessario installarlo separatamente. Devi solo eseguire `corepack enable` per abilitare Yarn se non l'hai ancora fatto. 1. Installa WSL Apri PowerShell come amministratore ed esegui: ```powershell 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 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 Usa `nvm` per installare la versione corretta di `node`. Il file `.nvmrc` garantisce che tutti i collaboratori utilizzino la stessa versione. ```bash 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 nvm install # installs recommended node version nvm use # use recommended node version corepack enable ``` --- ## Passaggio 1: Clona con Git Nel tuo terminale, esegui il seguente comando. 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 git clone git@github.com:twentyhq/twenty.git ``` ```bash git clone https://github.com/twentyhq/twenty.git ``` ## Passaggio 2: Posizionati alla radice ```bash cd twenty ``` Dovresti eseguire tutti i comandi nei passaggi successivi dalla radice del progetto. ## Passaggio 3: Configura un database PostgreSQL **Option 1 (preferred):** To provision your database locally: Use the following link to install Postgresql on your Linux machine: [Postgresql Installation](https://www.postgresql.org/download/linux/) ```bash psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" ``` Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors. ```` **Option 2:** If you have docker installed: ```bash make postgres-on-docker ``` ```` **Option 1 (preferred):** To provision your database locally with `brew`: ```` ```bash 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;" ``` You can verify if the PostgreSQL server is running by executing: ```bash brew services list ``` The installer might not create the `postgres` user by default when installing via Homebrew on MacOS. Instead, it creates a PostgreSQL role that matches your macOS username (e.g., "john"). To check and create the `postgres` user if necessary, follow these steps: ```bash # Connect to PostgreSQL psql postgres or psql -U $(whoami) -d postgres ``` Once at the psql prompt (postgres=#), run: ```bash # List existing PostgreSQL roles \du ``` You'll see output similar to: ```bash Role name | Attributes | Member of -----------+-------------+----------- john | Superuser | {} ``` If you do not see a `postgres` role listed, proceed to the next step. Create the `postgres` role manually: ```bash CREATE ROLE postgres WITH SUPERUSER LOGIN; ``` This creates a superuser role named `postgres` with login access. **Option 2:** If you have docker installed: ```bash make postgres-on-docker ``` ```` All the following steps are to be run in the WSL terminal (within your virtual machine) ```` **Option 1:** To provision your Postgresql locally: Use the following link to install Postgresql on your Linux virtual machine: [Postgresql Installation](https://www.postgresql.org/download/linux/) ```bash psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" ``` Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors. **Option 2:** If you have docker installed: Running Docker on WSL adds an extra layer of complexity. Only use this option if you are comfortable with the extra steps involved, including turning on [Docker Desktop WSL2](https://docs.docker.com/desktop/wsl). ```bash make postgres-on-docker ``` ```` Puoi ora accedere al database su [localhost:5432](localhost:5432), con utente `postgres` e password `postgres`. ## Passaggio 4: Configura un database Redis (cache) Twenty richiede una cache redis per offrire le migliori prestazioni **Option 1:** To provision your Redis locally: Use the following link to install Redis on your Linux machine: [Redis Installation](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/) ```` **Option 2:** If you have docker installed: ```bash make redis-on-docker ``` ```` **Option 1 (preferred):** To provision your Redis locally with `brew`: ```bash brew install redis ``` Start your redis server: ```brew services start redis``` ```` **Option 2:** If you have docker installed: ```bash make redis-on-docker ``` ```` **Option 1:** To provision your Redis locally: Use the following link to install Redis on your Linux virtual machine: [Redis Installation](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/) ```` **Option 2:** If you have docker installed: ```bash make redis-on-docker ``` ```` Se hai bisogno di una GUI cliente, 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/l/it/developers/self-hosting/setup) Copia i file `.env.example` in `/front` e `/server`: ```bash cp ./packages/twenty-front/.env.example ./packages/twenty-front/.env cp ./packages/twenty-server/.env.example ./packages/twenty-server/.env ``` ## Passaggio 6: Installazione delle dipendenze Per costruire il server Twenty e popolare alcuni dati nel tuo database, esegui il seguente comando: ```bash yarn ``` Nota che `npm` o `pnpm` non funzioneranno ## Passaggio 7: Esecuzione del progetto 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. Redis dovrebbe essere già in esecuzione. If not, run: ```bash brew services start redis ``` 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 npx nx database:reset twenty-server ``` Avvia il server, il worker e i servizi del frontend: ```bash npx nx start twenty-server npx nx worker twenty-server npx nx start twenty-front ``` In alternativa, puoi avviare tutti i servizi contemporaneamente: ```bash 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/l/it/developers/self-hosting/troubleshooting) per le soluzioni.