Created by Github action --------- Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: github-actions <github-actions@twenty.com>
110 lines
2.6 KiB
Plaintext
110 lines
2.6 KiB
Plaintext
---
|
|
title: Backend Commands
|
|
image: /images/user-guide/kanban-views/kanban.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/kanban-views/kanban.png" alt="Header" />
|
|
</Frame>
|
|
|
|
## Przydatne polecenia
|
|
|
|
Te komendy muszą być wykonane z folderu packages/twenty-server.
|
|
From any other folder you can run `npx nx {command} twenty-server` (or `npx nx run twenty-server:{command}`).
|
|
|
|
### First time setup
|
|
|
|
```
|
|
npx nx database:reset twenty-server # setup the database with dev seeds
|
|
```
|
|
|
|
### Uruchamianie serwera
|
|
|
|
```
|
|
npx nx run twenty-server:start
|
|
```
|
|
|
|
### Lint
|
|
|
|
```
|
|
npx nx run twenty-server:lint # pass --fix to fix lint errors
|
|
```
|
|
|
|
### Test
|
|
|
|
```
|
|
npx nx run twenty-server:test:unit # run unit tests
|
|
npx nx run twenty-server:test:integration # run integration tests
|
|
```
|
|
|
|
Uwaga: Możesz uruchomić `npx nx run twenty-server:test:integration:with-db-reset` w przypadku potrzeby zresetowania bazy przed przeprowadzeniem testów integracyjnych.
|
|
|
|
### Resetowanie bazy danych
|
|
|
|
Jeśli chcesz zresetować i zapełnić bazę danych, możesz uruchomić następującą komendę:
|
|
|
|
```bash
|
|
npx nx run twenty-server:database:reset
|
|
```
|
|
|
|
### Migracje
|
|
|
|
#### Dla obiektów w schematach 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
|
|
```
|
|
|
|
#### Dla obiektów w Workspace
|
|
|
|
Brak plików migracji, migracje są generowane automatycznie dla każdego workspace'u,
|
|
zapisywane w bazie danych i stosowane poprzez tę komendę
|
|
|
|
```bash
|
|
npx nx run twenty-server:command workspace:sync-metadata -f
|
|
```
|
|
|
|
<Warning>
|
|
|
|
To spowoduje usunięcie bazy danych i ponowne uruchomienie migracji i zapełnienie danymi.
|
|
|
|
Upewnij się, że kopie zapasowe danych, które chcesz zachować, są wykonane przed uruchomieniem tej komendy.
|
|
|
|
</Warning>
|
|
|
|
## Stos Technologiczny
|
|
|
|
Twenty głównie używa NestJS na backendzie.
|
|
|
|
Prisma była pierwszym ORM-em, którego używaliśmy. Ale aby umożliwić użytkownikom tworzenie niestandardowych pól i obiektów, zależało nam na niższym poziomie kontroli, co miało większy sens patrząc z tej perspektywy. Projekt teraz używa TypeORM.
|
|
|
|
Tak wygląda teraz stos technologiczny.
|
|
|
|
**Core**
|
|
|
|
- [NestJS](https://nestjs.com/)
|
|
- [TypeORM](https://typeorm.io/)
|
|
- [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server)
|
|
|
|
**Database**
|
|
|
|
- [Postgres](https://www.postgresql.org/)
|
|
|
|
**Integracje zewnętrzne**
|
|
|
|
- [Sentry](https://sentry.io/welcome/) do śledzenia błędów
|
|
|
|
**Testowanie**
|
|
|
|
- [Jest](https://jestjs.io/)
|
|
|
|
**Narzędzia**
|
|
|
|
- [Yarn](https://yarnpkg.com/)
|
|
- [ESLint](https://eslint.org/)
|
|
|
|
**Rozwój**
|
|
|
|
- [AWS EKS](https://aws.amazon.com/eks/)
|
|
|