> ## Documentation Index
> Fetch the complete documentation index at: https://docs.twenty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 命令

> 用于开发 Twenty 的实用命令。

可以在存储库根目录使用 `npx nx` 运行命令。 使用 `npx nx run {project}:{command}` 显式指定目标。

## 启动应用

```bash theme={null}
npx nx start twenty-front          # Frontend dev server (http://localhost:3001)
npx nx start twenty-server         # Backend server (http://localhost:3000)
npx nx run twenty-server:worker    # Background worker
```

## 数据库

```bash theme={null}
npx nx database:reset twenty-server                          # Reset and seed database
npx nx run twenty-server:database:migrate:prod               # Run migrations
npx nx run twenty-server:database:migrate:generate --name <name> --type <fast|slow>  # Generate a migration
```

## 代码检查

```bash theme={null}
npx nx lint:diff-with-main twenty-front    # Lint changed files (fastest)
npx nx lint:diff-with-main twenty-server
npx nx lint twenty-front --configuration=fix  # Auto-fix
```

## 类型检查

```bash theme={null}
npx nx typecheck twenty-front
npx nx typecheck twenty-server
```

## 测试

```bash theme={null}
# Frontend
npx nx test twenty-front                          # Jest unit tests
npx nx storybook:build twenty-front               # Build Storybook
npx nx storybook:test twenty-front                # Storybook tests

# Backend
npx nx run twenty-server:test:unit                # Unit tests
npx nx run twenty-server:test:integration         # Integration tests
npx nx run twenty-server:test:integration:with-db-reset  # Integration with DB reset

# Single file (fastest)
npx jest path/to/test.test.ts --config=packages/{project}/jest.config.mjs
```

## GraphQL

```bash theme={null}
npx nx run twenty-front:graphql:generate                        # Regenerate types
npx nx run twenty-front:graphql:generate --configuration=metadata  # Metadata schema
```

## 翻译

```bash theme={null}
npx nx run twenty-front:lingui:extract   # Extract strings
npx nx run twenty-front:lingui:compile   # Compile translations
```

## 构建

```bash theme={null}
npx nx build twenty-shared   # Must be built first
npx nx build twenty-front
npx nx build twenty-server
```
