-
Notifications
You must be signed in to change notification settings - Fork 23
docs: enhance contributing docs #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,325 @@ | ||||||||
| # Contributing to Ctrlplane | ||||||||
|
|
||||||||
| Thanks for your interest in contributing! This guide covers everything you need to get a local dev environment running, find your way around the repo, and open a pull request we can review quickly. | ||||||||
|
|
||||||||
| If you're planning a larger change, please **open an issue or GitHub Discussion first** so we can align on the approach before you invest time in it. | ||||||||
|
|
||||||||
| ## Table of Contents | ||||||||
|
|
||||||||
| - [Code of Conduct](#code-of-conduct) | ||||||||
| - [Getting Help](#getting-help) | ||||||||
| - [Reporting Bugs and Requesting Features](#reporting-bugs-and-requesting-features) | ||||||||
| - [Development Setup](#development-setup) | ||||||||
| - [Repository Structure](#repository-structure) | ||||||||
| - [Architecture at a Glance](#architecture-at-a-glance) | ||||||||
| - [Service-Specific Guides](#service-specific-guides) | ||||||||
| - [Code Style and Conventions](#code-style-and-conventions) | ||||||||
| - [Testing](#testing) | ||||||||
| - [Commit Messages](#commit-messages) | ||||||||
| - [Opening a Pull Request](#opening-a-pull-request) | ||||||||
|
|
||||||||
| ## Code of Conduct | ||||||||
|
|
||||||||
| This project follows the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). By participating, you agree to uphold it. Report unacceptable behavior to `conduct@ctrlplane.dev`. | ||||||||
|
|
||||||||
| ## Getting Help | ||||||||
|
|
||||||||
| - **Questions about using Ctrlplane** → [GitHub Discussions](https://github.com/ctrlplanedev/ctrlplane/discussions) or [Discord](https://ctrlplane.dev/discord) | ||||||||
| - **Contributor questions** → `#contributors` on Discord, or comment on an issue | ||||||||
| - **Security vulnerabilities** → email `security@ctrlplane.dev`; please do not open a public issue. See [SECURITY.md](SECURITY.md) for details. | ||||||||
|
|
||||||||
| ## Reporting Bugs and Requesting Features | ||||||||
|
|
||||||||
| - **Bugs**: open a [bug report](https://github.com/ctrlplanedev/ctrlplane/issues/new?template=bug_report.yml) with reproduction steps, expected vs. actual behavior, and your environment (OS, Node version, Go version if relevant). | ||||||||
| - **Features / enhancements**: open a [feature request](https://github.com/ctrlplanedev/ctrlplane/issues/new?template=feature_request.yml) describing the problem you're solving, not just the solution you have in mind. | ||||||||
| - Browse [`good first issue`](https://github.com/ctrlplanedev/ctrlplane/labels/good%20first%20issue) for beginner-friendly work and [`help wanted`](https://github.com/ctrlplanedev/ctrlplane/labels/help%20wanted) for where we'd appreciate outside help. | ||||||||
|
|
||||||||
| ## Development Setup | ||||||||
|
|
||||||||
| ### Prerequisites | ||||||||
|
|
||||||||
| | Tool | Version | Notes | | ||||||||
| | ------- | ------------ | -------------------------------------------------- | | ||||||||
| | Node.js | `>= 22.10.0` | Managed by Flox, or install directly | | ||||||||
| | pnpm | `^10.2.0` | Managed by Flox, or install directly | | ||||||||
| | Go | `1.26+` | Only needed for `workspace-engine` | | ||||||||
| | Docker | latest | For Postgres, Kafka, and local observability stack | | ||||||||
|
|
||||||||
| **Recommended path**: install [Flox](https://flox.dev/docs/install-flox/install/) and run `flox activate` in the repo — it provisions Node, pnpm, Go, and the rest of the toolchain at the versions this repo expects. | ||||||||
|
|
||||||||
| **Manual path**: install Node, pnpm, Go, and Docker yourself. Any compatible versions work. | ||||||||
|
|
||||||||
| ### First-Time Setup | ||||||||
|
|
||||||||
| ```bash | ||||||||
| git clone https://github.com/ctrlplanedev/ctrlplane.git | ||||||||
| cd ctrlplane | ||||||||
|
|
||||||||
| # (Recommended) activate the tooling environment | ||||||||
| flox activate | ||||||||
|
|
||||||||
| # Create your local env file from the example | ||||||||
| cp .env.example .env | ||||||||
|
|
||||||||
| # Start local services (Postgres, Kafka, Jaeger, Prometheus, OTel collector) | ||||||||
| docker compose -f docker-compose.dev.yaml up -d | ||||||||
|
|
||||||||
| # Install dependencies and build all packages | ||||||||
| pnpm i && pnpm build | ||||||||
|
|
||||||||
| # Apply database migrations | ||||||||
| pnpm -F @ctrlplane/db migrate | ||||||||
|
|
||||||||
| # Start all dev servers | ||||||||
| pnpm dev | ||||||||
| ``` | ||||||||
|
|
||||||||
| Once everything is running: | ||||||||
|
|
||||||||
| - **Web app**: http://localhost:5173 | ||||||||
| - **API**: http://localhost:3000 (tRPC + REST) | ||||||||
| - **workspace-engine**: http://localhost:8081 | ||||||||
| - **Jaeger (traces)**: http://localhost:16686 | ||||||||
| - **Prometheus (metrics)**: http://localhost:9999 | ||||||||
| - **Drizzle Studio (DB UI)**: `pnpm -F @ctrlplane/db studio` | ||||||||
|
|
||||||||
| **Logging in locally**: with no OAuth providers configured, the app falls back to email + password auth. Visit the web app, sign up with any email/password, and you're in. To test OAuth flows, set `AUTH_GOOGLE_CLIENT_ID` / `AUTH_OKTA_*` / `AUTH_OIDC_*` in `.env`. | ||||||||
|
|
||||||||
| ### Resetting Your Environment | ||||||||
|
|
||||||||
| When you need a clean slate — corrupted DB, schema conflicts, stale Kafka state: | ||||||||
|
|
||||||||
| ```bash | ||||||||
| docker compose -f docker-compose.dev.yaml down -v # wipes all volumes | ||||||||
| docker compose -f docker-compose.dev.yaml up -d | ||||||||
| pnpm -F @ctrlplane/db migrate | ||||||||
| pnpm dev | ||||||||
| ``` | ||||||||
|
|
||||||||
| ### Day-to-Day Commands | ||||||||
|
|
||||||||
| | Command | Description | | ||||||||
| | --------------------------------- | ----------------------------------------- | | ||||||||
| | `pnpm dev` | Start all dev servers (hot reload) | | ||||||||
| | `pnpm build` | Build all packages | | ||||||||
| | `pnpm test` | Run all TypeScript tests | | ||||||||
| | `pnpm lint` | Lint all TypeScript code | | ||||||||
| | `pnpm lint:fix` | Auto-fix lint errors | | ||||||||
| | `pnpm format:fix` | Auto-format all TypeScript code | | ||||||||
| | `pnpm typecheck` | TypeScript type check across all packages | | ||||||||
| | `pnpm -F <pkg> test` | Run tests for a specific package | | ||||||||
| | `pnpm -F <pkg> test -- -t "name"` | Run a specific test by name | | ||||||||
|
|
||||||||
| **Database:** | ||||||||
|
|
||||||||
| ```bash | ||||||||
| pnpm -F @ctrlplane/db migrate # Apply pending migrations | ||||||||
| pnpm -F @ctrlplane/db push # Push schema changes without a migration file (dev only) | ||||||||
| pnpm -F @ctrlplane/db studio # Open Drizzle Studio UI | ||||||||
| ``` | ||||||||
|
|
||||||||
| **workspace-engine (Go):** | ||||||||
|
|
||||||||
| ```bash | ||||||||
| cd apps/workspace-engine | ||||||||
| go run . # Run the service binary (without building) | ||||||||
| go test ./... # Run tests | ||||||||
| golangci-lint run # Lint | ||||||||
| go fmt ./... # Format | ||||||||
| ``` | ||||||||
|
|
||||||||
| By default `workspace-engine` runs all controllers. To run a subset (useful when debugging one), set `SERVICES` in `.env`: | ||||||||
|
|
||||||||
| ```bash | ||||||||
| SERVICES=deployment-plan,policy-eval | ||||||||
| ``` | ||||||||
|
|
||||||||
| ## Repository Structure | ||||||||
|
|
||||||||
| ```text | ||||||||
| apps/ | ||||||||
| api/ # Node/Express REST + tRPC API — core business logic | ||||||||
| web/ # React 19 + React Router frontend | ||||||||
|
||||||||
| web/ # React 19 + React Router frontend | |
| web/ # React 19 + React Router frontend | |
| relay/ # Go relay service |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prerequisites table says Go is only needed for
workspace-engine, but this repo also hasapps/relay(a Go module). Please includerelayhere (or adjust the note) so contributors don't skip installing Go when working on relay.