Files
twenty/packages/twenty-docs/l/zh/developers/backend-development/server-commands.mdx
T
e02c24bd3a i18n - docs translations (#15904)
Created by Github action

---------

Co-authored-by: Abdul Rahman <ar5438376@gmail.com>
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: github-actions <github-actions@twenty.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2025-11-18 17:21:48 +01:00

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>
## 有用的命令
這些指令應在 packages/twenty-server 資料夾中執行。
這些指令應在 packages/twenty-server 資料夾中執行。
From any other folder you can run `npx nx {command} twenty-server` (or `npx nx run twenty-server:{command}`).
### 首次設定
```
npx nx database:reset twenty-server # setup the database with dev seeds
```
### 啟動伺服器
```
npx nx run twenty-server:start
```
### Lint
```
npx nx run twenty-server:lint # pass --fix to fix lint errors
```
### 測試
```
npx nx run twenty-server:test:unit # run unit tests
npx nx run twenty-server:test:integration # run integration tests
```
注意:如果需要在執行整合測試之前重置資料庫,可以執行 `npx nx run twenty-server:test:integration:with-db-reset`。
### 重置資料庫
如果您需要重置並初始化資料庫,可以執行以下指令:
```bash
npx nx run twenty-server:database:reset
```
### 遷移
#### 針對 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
```
#### 針對工作空間中的物件
沒有遷移檔案。每個工作空間的遷移會自動產生,儲存在資料庫中,並可用此命令套用。
```bash
npx nx run twenty-server:command workspace:sync-metadata -f
```
<Warning>
此操作將刪除資料庫並重新運行遷移和初始化過程。
確保在執行此命令前備份您想保留的任何數據。
</Warning>
## 技術棧
Twenty 主要使用 NestJS 為後端。
Prisma 是我們最早使用的 ORM。 但為了允許用戶創建自定義欄位和自定義物件,低層級的解決方案更合適,因為我們需要細緻的控制。 現項目使用 TypeORM。 但為了允許用戶創建自定義欄位和自定義物件,低層級的解決方案更合適,因為我們需要細緻的控制。 現項目使用 TypeORM。
這是技術堆疊目前的樣貌。
**核心**
- [NestJS](https://nestjs.com/)
- [TypeORM](https://typeorm.io/)
- [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server)
**資料庫**
- [Postgres](https://www.postgresql.org/)
**第三方整合**
- [Sentry](https://sentry.io/welcome/) 用於追踪錯誤
**測試**
- [Jest](https://jestjs.io/)
**工具**
- [Yarn](https://yarnpkg.com/)
- [ESLint](https://eslint.org/)
**開發**
- [AWS EKS](https://aws.amazon.com/eks/)