Created by Github action <!-- mintlify-editor-comments:start --> Mintlify --- 0 threads from 0 users in Mintlify - No unresolved comments <!-- mintlify-editor-comments:end --> <!-- mintlify-comment--> <a href="https://dashboard.mintlify.com/twenty/twenty/editor/i18n-docs?source=pr_comment" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-light.svg"><img src="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-light.svg" alt="Open in Mintlify Editor"></picture></a> <!-- /mintlify-comment --> Co-authored-by: github-actions <github-actions@twenty.com>
103 lines
2.5 KiB
Plaintext
103 lines
2.5 KiB
Plaintext
---
|
|
title: Comandi Backend
|
|
---
|
|
|
|
## Comandi utili
|
|
|
|
Questi comandi devono essere eseguiti dalla cartella packages/twenty-server.
|
|
Da qualsiasi altra cartella puoi eseguire `npx nx {command} twenty-server` (oppure `npx nx run twenty-server:{command}`).
|
|
|
|
### Impostazione iniziale
|
|
|
|
```
|
|
npx nx database:reset twenty-server # configura il database con dati di esempio per lo sviluppo
|
|
```
|
|
|
|
### Avvio del server
|
|
|
|
```
|
|
npx nx run twenty-server:start
|
|
```
|
|
|
|
### Lint
|
|
|
|
```
|
|
npx nx run twenty-server:lint # passa --fix per correggere gli errori di lint
|
|
```
|
|
|
|
### Test
|
|
|
|
```
|
|
npx nx run twenty-server:test:unit # esegui test unitari
|
|
npx nx run twenty-server:test:integration # esegui test di integrazione
|
|
```
|
|
|
|
Nota: puoi eseguire `npx nx run twenty-server:test:integration:with-db-reset` nel caso in cui sia necessario resettare il database prima di eseguire i test di integrazione.
|
|
|
|
### Ripristino del database
|
|
|
|
Se vuoi resettare e seminare il database, puoi eseguire il seguente comando:
|
|
|
|
```bash
|
|
npx nx run twenty-server:database:reset
|
|
```
|
|
|
|
### Migrazioni
|
|
|
|
#### Per oggetti negli schemi Core/Metadata (TypeORM)
|
|
|
|
```bash
|
|
npx nx run twenty-server:typeorm migration:generate src/database/typeorm/core/migrations/nameOfYourMigration -d src/database/typeorm/core/core.datasource.ts
|
|
```
|
|
|
|
#### Per gli oggetti del Workspace
|
|
|
|
Non ci sono file di migrazioni; le migrazioni sono generate automaticamente per ogni workspace, memorizzate nel database e applicate con questo comando
|
|
|
|
```bash
|
|
npx nx run twenty-server:command workspace:sync-metadata -f
|
|
```
|
|
|
|
<Warning>
|
|
|
|
Questo eliminerà il database e rieseguirà le migrazioni e il popolamento dei dati.
|
|
|
|
Assicurati di eseguire il backup dei dati che vuoi mantenere prima di eseguire questo comando.
|
|
|
|
</Warning>
|
|
|
|
## Tech Stack
|
|
|
|
Twenty utilizza principalmente NestJS per il backend.
|
|
|
|
Prisma è stato il primo ORM che abbiamo usato. Ma per permettere agli utenti di creare campi personalizzati e oggetti personalizzati, un livello più basso aveva più senso poiché abbiamo bisogno di avere un controllo granulare. Il progetto ora utilizza TypeORM.
|
|
|
|
Ecco come appare ora lo stack tecnologico.
|
|
|
|
**Core**
|
|
|
|
* [NestJS](https://nestjs.com/)
|
|
* [TypeORM](https://typeorm.io/)
|
|
* [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server)
|
|
|
|
**Database**
|
|
|
|
* [Postgres](https://www.postgresql.org/)
|
|
|
|
**Integrazioni di terze parti**
|
|
|
|
* [Sentry](https://sentry.io/welcome/) per il tracciamento degli errori
|
|
|
|
**Testing**
|
|
|
|
* [Jest](https://jestjs.io/)
|
|
|
|
**Strumenti**
|
|
|
|
* [Yarn](https://yarnpkg.com/)
|
|
* [ESLint](https://eslint.org/)
|
|
|
|
**Sviluppo**
|
|
|
|
* [AWS EKS](https://aws.amazon.com/eks/)
|