Contribute Code
Colibri welcomes pull requests, especially when they arrive with context. Use this checklist as a starting point and tailor it to your needs; the goal is to make reviewers productive and deployments safe.
1. Explore the project structure
cmd/apiholds the HTTP server bootstrap.internal/serverwires middleware and routes.internal/{posts,sources,categories}contain handlers and helpers.internal/databaseis generated withsqlcand mirrors the Postgres schema.
Spend a few minutes reading the files around the functionality you plan to change. When in doubt, search for existing patterns and mimic them.
2. Set up your local environment (Docker Compose)
- Duplicate
.env.exampleto.env. The Go services readDB_DRIVER=postgresand the*_FILEvariables that point to Docker secrets, so the default values are fine. - Create the secrets expected by
docker-compose.yml:secrets/db-password.txt: plain-text password for the local Postgres container.secrets/db-string.txt: full connection string, e.g.postgresql://postgres:<password>@postgres:5432/colibri_db?sslmode=disable(note that the host is the Compose service namepostgres).secrets/rabbitmq-url.txt: e.g.amqp://guest:guest@rabbitmq:5672/.secrets/google-api-key.txt: add a cheap google api key for summarization.
- Bring up the stack: `docker compose up --build. The fetcher will run once every 4 hours by default, you can change that in the docker-compose.yml or simply restart your container to trigger it.
3. Follow the coding conventions
- Stick to Go 1.22+ features, avoid third-party helpers when the standard library suffices.
- Handlers return JSON and keep response shapes in
internal/{domain}/{domain}.gostructs. - Prefer unit tests that work without external services.
- Keep middleware minimal. Rate limiting, security headers, and CORS are already configured in
internal/server/server.go.
4. Validate your change
- Run
go test ./.... - Run
go fmt ./.... - Run
staticcheck ./.... - Run
gosec ./.... - If you touched SQL, run
sqlc generateand ensure no unexpected diffs remain. - Update
docs/api/openapi.yamlwhen you add or modify endpoints, then regenerate docs withnpm --prefix docs run gen-api. - Run
npm --prefix docs run buildto confirm the documentation site still compiles.
5. Prepare the pull request
- Summarize the change.
- Link related issues or discussions.
- Include screenshots or API samples when you change user-facing behavior.
- Keep commits focused. Squash if you did multiple commits.