有用的命令
這些指令應在 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。
重置資料庫
如果您需要重置並初始化資料庫,可以執行以下指令:
npx nx run twenty-server:database:reset
npx nx run twenty-server:typeorm migration:generate src/database/typeorm/core/migrations/nameOfYourMigration -d src/database/typeorm/core/core.datasource.ts
針對工作空間中的物件
沒有遷移檔案。每個工作空間的遷移會自動產生,儲存在資料庫中,並可用此命令套用。
npx nx run twenty-server:command workspace:sync-metadata -f
此操作將刪除資料庫並重新運行遷移和初始化過程。確保在執行此命令前備份您想保留的任何數據。
技術棧
Twenty 主要使用 NestJS 為後端。
Prisma 是我們最早使用的 ORM。 但為了允許用戶創建自定義欄位和自定義物件,低層級的解決方案更合適,因為我們需要細緻的控制。 現項目使用 TypeORM。
這是技術堆疊目前的樣貌。
核心
資料庫
第三方整合
測試
工具
開發