Skip to content

Commit b909778

Browse files
committed
fixed cursor rules formatting and added references to frontend & cursor rules to Claude.md
1 parent 1803449 commit b909778

File tree

2 files changed

+19
-53
lines changed

2 files changed

+19
-53
lines changed

.cursorrules

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ This project is called "Coder" - an application for managing remote development
44

55
Coder provides a platform for creating, managing, and using remote development environments (also known as Cloud Development Environments or CDEs). It leverages Terraform to define and provision these environments, which are referred to as "workspaces" within the project. The system is designed to be extensible, secure, and provide developers with a seamless remote development experience.
66

7-
# Core Architecture
7+
## Core Architecture
88

99
The heart of Coder is a control plane that orchestrates the creation and management of workspaces. This control plane interacts with separate Provisioner processes over gRPC to handle workspace builds. The Provisioners consume workspace definitions and use Terraform to create the actual infrastructure.
1010

1111
The CLI package serves dual purposes - it can be used to launch the control plane itself and also provides client functionality for users to interact with an existing control plane instance. All user-facing frontend code is developed in TypeScript using React and lives in the `site/` directory.
1212

1313
The database layer uses PostgreSQL with SQLC for generating type-safe database code. Database migrations are carefully managed to ensure both forward and backward compatibility through paired `.up.sql` and `.down.sql` files.
1414

15-
# API Design
15+
## API Design
1616

1717
Coder's API architecture combines REST and gRPC approaches. The REST API is defined in `coderd/coderd.go` and uses Chi for HTTP routing. This provides the primary interface for the frontend and external integrations.
1818

1919
Internal communication with Provisioners occurs over gRPC, with service definitions maintained in `.proto` files. This separation allows for efficient binary communication with the components responsible for infrastructure management while providing a standard REST interface for human-facing applications.
2020

21-
# Network Architecture
21+
## Network Architecture
2222

2323
Coder implements a secure networking layer based on Tailscale's Wireguard implementation. The `tailnet` package provides connectivity between workspace agents and clients through DERP (Designated Encrypted Relay for Packets) servers when direct connections aren't possible. This creates a secure overlay network allowing access to workspaces regardless of network topology, firewalls, or NAT configurations.
2424

25-
## Tailnet and DERP System
25+
### Tailnet and DERP System
2626

2727
The networking system has three key components:
2828

@@ -35,7 +35,7 @@ The networking system has three key components:
3535

3636
3. **Direct Connections**: When possible, the system establishes peer-to-peer connections between clients and workspaces using STUN for NAT traversal. This requires both endpoints to send UDP traffic on ephemeral ports.
3737

38-
## Workspace Proxies
38+
### Workspace Proxies
3939

4040
Workspace proxies (in the Enterprise edition) provide regional relay points for browser-based connections, reducing latency for geo-distributed teams. Key characteristics:
4141

@@ -45,9 +45,10 @@ Workspace proxies (in the Enterprise edition) provide regional relay points for
4545
- Managed through the `coder wsproxy` commands
4646
- Implemented primarily in the `enterprise/wsproxy/` package
4747

48-
# Agent System
48+
## Agent System
4949

5050
The workspace agent runs within each provisioned workspace and provides core functionality including:
51+
5152
- SSH access to workspaces via the `agentssh` package
5253
- Port forwarding
5354
- Terminal connectivity via the `pty` package for pseudo-terminal support
@@ -57,7 +58,7 @@ The workspace agent runs within each provisioned workspace and provides core fun
5758

5859
Agents communicate with the control plane using the tailnet system and authenticate using secure tokens.
5960

60-
# Workspace Applications
61+
## Workspace Applications
6162

6263
Workspace applications (or "apps") provide browser-based access to services running within workspaces. The system supports:
6364

@@ -69,17 +70,17 @@ Workspace applications (or "apps") provide browser-based access to services runn
6970

7071
The implementation is primarily in the `coderd/workspaceapps/` directory with components for URL generation, proxying connections, and managing application state.
7172

72-
# Implementation Details
73+
## Implementation Details
7374

7475
The project structure separates frontend and backend concerns. React components and pages are organized in the `site/src/` directory, with Jest used for testing. The backend is primarily written in Go, with a strong emphasis on error handling patterns and test coverage.
7576

7677
Database interactions are carefully managed through migrations in `coderd/database/migrations/` and queries in `coderd/database/queries/`. All new queries require proper database authorization (dbauthz) implementation to ensure that only users with appropriate permissions can access specific resources.
7778

78-
# Authorization System
79+
## Authorization System
7980

8081
The database authorization (dbauthz) system enforces fine-grained access control across all database operations. It uses role-based access control (RBAC) to validate user permissions before executing database operations. The `dbauthz` package wraps the database store and performs authorization checks before returning data. All database operations must pass through this layer to ensure security.
8182

82-
# Testing Framework
83+
## Testing Framework
8384

8485
The codebase has a comprehensive testing approach with several key components:
8586

@@ -91,7 +92,7 @@ The codebase has a comprehensive testing approach with several key components:
9192

9293
4. **Enterprise Testing**: Enterprise features have dedicated test utilities in the `coderdenttest` package.
9394

94-
# Open Source and Enterprise Components
95+
## Open Source and Enterprise Components
9596

9697
The repository contains both open source and enterprise components:
9798

@@ -100,9 +101,10 @@ The repository contains both open source and enterprise components:
100101
- The boundary between open source and enterprise is managed through a licensing system
101102
- The same core codebase supports both editions, with enterprise features conditionally enabled
102103

103-
# Development Philosophy
104+
## Development Philosophy
104105

105106
Coder emphasizes clear error handling, with specific patterns required:
107+
106108
- Concise error messages that avoid phrases like "failed to"
107109
- Wrapping errors with `%w` to maintain error chains
108110
- Using sentinel errors with the "err" prefix (e.g., `errNotFound`)
@@ -111,7 +113,7 @@ All tests should run in parallel using `t.Parallel()` to ensure efficient testin
111113

112114
Git contributions follow a standard format with commit messages structured as `type: <message>`, where type is one of `feat`, `fix`, or `chore`.
113115

114-
# Development Workflow
116+
## Development Workflow
115117

116118
Development can be initiated using `scripts/develop.sh` to start the application after making changes. Database schema updates should be performed through the migration system using `create_migration.sh <name>` to generate migration files, with each `.up.sql` migration paired with a corresponding `.down.sql` that properly reverts all changes.
117119

CLAUDE.md

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Coder Development Guidelines
22

3+
Read [cursor rules](.cursorrules).
4+
35
## Build/Test/Lint Commands
46

57
### Main Commands
@@ -33,13 +35,6 @@
3335
- Create packages when used during implementation
3436
- Validate abstractions against implementations
3537

36-
### TypeScript/React
37-
38-
- Use TypeScript for all frontend code
39-
- Follow ESLint and Prettier configurations
40-
- Components should be atomic, reusable, and free of business logic
41-
- Modules can contain Coder-specific business logic
42-
4338
### Error Handling
4439

4540
- Use descriptive error messages
@@ -70,7 +65,7 @@
7065

7166
## Database queries
7267

73-
- MUST DO! Any changes to database - adding queries, modifying queries should be done in the `coderd\database\queries\*.sql` files.
68+
- MUST DO! Any changes to database - adding queries, modifying queries should be done in the `coderd\database\queries\*.sql` files. Use `make gen` to generate necessary changes after.
7469
- MUST DO! Queries are grouped in files relating to context - e.g. `prebuilds.sql`, `users.sql`, `provisionerjobs.sql`.
7570
- After making changes to any `coderd\database\queries\*.sql` files you must run `make gen` to generate respective ORM changes.
7671

@@ -106,35 +101,4 @@
106101

107102
## Frontend
108103

109-
### Tech Stack
110-
111-
- React with TypeScript
112-
- Material UI v5 for components
113-
- TanStack Query v4 for data fetching
114-
- Emotion for styling
115-
- Formik with Yup for forms and validation
116-
117-
### Structure
118-
119-
- `/site/` directory contains all UI code
120-
- Components in `/site/src/components`
121-
- Feature modules in `/site/src/modules`
122-
- Pages in `/site/src/pages`
123-
124-
### State Management
125-
126-
- React Query for API data fetching and caching
127-
- Context-based state with providers
128-
- React Router for navigation
129-
130-
### Accessibility
131-
132-
- Color contrast meets WCAG AA compliance (4.5:1 ratio)
133-
- Proper labeling for input elements
134-
- Include descriptive text for images
135-
136-
### Testing
137-
138-
- End-to-end testing with Playwright
139-
- Integration testing with Jest and react-testing-library
140-
- Visual testing with Storybook and Chromatic
104+
For building Frontend refer to [this document](docs/contributing/frontend.md)

0 commit comments

Comments
 (0)