Read cursor rules.
make buildormake build-fat- Build all "fat" binaries (includes "server" functionality)make build-slim- Build "slim" binariesmake test- Run Go testsmake test RUN=TestFunctionNameorgo test -v ./path/to/package -run TestFunctionName- Test singlemake test-postgres- Run tests with Postgres databasemake test-race- Run tests with Go race detectormake test-e2e- Run end-to-end testsmake lint- Run all lintersmake fmt- Format all codemake gen- Generates mocks, database queries and other auto-generated files
pnpm build- Build frontendpnpm dev- Run development serverpnpm check- Run code checkspnpm format- Format frontend codepnpm lint- Lint frontend codepnpm test- Run frontend tests
- Follow Effective Go and Go's Code Review Comments
- Use
gofumptfor formatting - Create packages when used during implementation
- Validate abstractions against implementations
- Use descriptive error messages
- Wrap errors with context
- Propagate errors appropriately
- Use proper error types
- (
xerrors.Errorf("failed to X: %w", err))
- Use clear, descriptive names
- Abbreviate only when obvious
- Follow Go and TypeScript naming conventions
- Document exported functions, types, and non-obvious logic
- Follow JSDoc format for TypeScript
- Use godoc format for Go code
- Follow Conventional Commits 1.0.0
- Format:
type(scope): message - Types:
feat,fix,docs,style,refactor,test,chore - Keep message titles concise (~70 characters)
- Use imperative, present tense in commit titles
- MUST DO! Any changes to database - adding queries, modifying queries should be done in the
coderd\database\queries\*.sqlfiles. Usemake gento generate necessary changes after. - MUST DO! Queries are grouped in files relating to context - e.g.
prebuilds.sql,users.sql,provisionerjobs.sql. - After making changes to any
coderd\database\queries\*.sqlfiles you must runmake gento generate respective ORM changes.
- coderd: Main API service connecting workspaces, provisioners, and users
- provisionerd: Execution context for infrastructure-modifying providers
- Agents: Services in remote workspaces providing features like SSH and port forwarding
- Workspaces: Cloud resources defined by Terraform
- Templates define infrastructure for workspaces using Terraform
- Environment variables pass context between Coder and templates
- Official modules extend development environments
- Permissions defined at site, organization, and user levels
- Object-Action model protects resources
- Built-in roles: owner, member, auditor, templateAdmin
- Permission format:
<sign>?<level>.<object>.<id>.<action>
- PostgreSQL 13+ recommended for production
- Migrations managed with
migrate - Database authorization through
dbauthzpackage
For building Frontend refer to this document