Created by Github action --------- Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: github-actions <github-actions@twenty.com>
109 lines
2.5 KiB
Plaintext
109 lines
2.5 KiB
Plaintext
---
|
|
title: Backend Kommandoer
|
|
image: /images/user-guide/kanban-views/kanban.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/kanban-views/kanban.png" alt="Header" />
|
|
</Frame>
|
|
|
|
## Nyttige kommandoer
|
|
|
|
Disse kommandoer skal udføres fra mappen packages/twenty-server.
|
|
From any other folder you can run `npx nx {command} twenty-server` (or `npx nx run twenty-server:{command}`).
|
|
|
|
### Førstegangsopsætning
|
|
|
|
```
|
|
npx nx database:reset twenty-server # setup the database with dev seeds
|
|
```
|
|
|
|
### Starter serveren
|
|
|
|
```
|
|
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
|
|
```
|
|
|
|
Bemærk: du kan køre `npx nx run twenty-server:test:integration:with-db-reset` hvis du har brug for at nulstille databasen før kørsel af integrationstests.
|
|
|
|
### Nulstilling af databasen
|
|
|
|
If you want to reset and seed the database, you can run the following command:
|
|
|
|
```bash
|
|
npx nx run twenty-server:database:reset
|
|
```
|
|
|
|
### Migrationer
|
|
|
|
#### For objects in Core/Metadata schemas (TypeORM)
|
|
|
|
```bash
|
|
npx nx run twenty-server:typeorm migration:generate src/database/typeorm/core/migrations/nameOfYourMigration -d src/database/typeorm/core/core.datasource.ts
|
|
```
|
|
|
|
#### For Workspace objekter
|
|
|
|
Der er ingen migrationsfiler, migrationer genereres automatisk for hvert arbejdsområde, opbevares i databasen og anvendes med denne kommando
|
|
|
|
```bash
|
|
npx nx run twenty-server:command workspace:sync-metadata -f
|
|
```
|
|
|
|
<Warning>
|
|
|
|
This will drop the database and re-run the migrations and seed.
|
|
|
|
Sørg for at tage backup af alle data, du vil beholde, før du kører denne kommando.
|
|
|
|
</Warning>
|
|
|
|
## Tek Stack
|
|
|
|
Twenty bruger primært NestJS til backenden.
|
|
|
|
Prisma var den første ORM, vi brugte. Men for at tillade brugere at oprette tilpassede felter og objekter gav det mere mening med et lavere niveau, da vi har brug for at have detaljeret kontrol. Projektet bruger nu TypeORM.
|
|
|
|
Her er hvordan tech stakken nu ser ud.
|
|
|
|
**Core**
|
|
|
|
- [NestJS](https://nestjs.com/)
|
|
- [TypeORM](https://typeorm.io/)
|
|
- [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server)
|
|
|
|
**Database**
|
|
|
|
- [Postgres](https://www.postgresql.org/)
|
|
|
|
**Tredjeparts integrationer**
|
|
|
|
- [Sentry](https://sentry.io/welcome/) til sporing af fejl
|
|
|
|
**Testning**
|
|
|
|
- [Jest](https://jestjs.io/)
|
|
|
|
**Værktøjer**
|
|
|
|
- [Yarn](https://yarnpkg.com/)
|
|
- [ESLint](https://eslint.org/)
|
|
|
|
**Udvikling**
|
|
|
|
- [AWS EKS](https://aws.amazon.com/eks/)
|
|
|