| layout | docs |
|---|---|
| title | Contributing |
| description | How to contribute to NUTS — development setup, testing, code style, and pull request guidelines |
| permalink | /docs/contributing/ |
NUTS is open source and we appreciate contributions of all kinds — bug reports, feature ideas, documentation improvements, and code.
-
Fork the NUTS repository
-
Clone your fork:
git clone https://github.com/YOUR-USERNAME/nuts.git cd nuts -
Set up the development environment:
./scripts/setup-dev.sh
Or manually:
make docker-up
NUTS has two test layers:
Unit tests use an embedded NATS server — no external dependencies needed:
make test-unitOr directly:
go test -v -timeout 120s .Functional tests use Godog (Cucumber for Go) with Gherkin syntax. They require Docker services:
make test-functionalOr step by step:
docker compose up -d --build
sleep 5
cd functional_test && go test -v -timeout 120s ./...
docker compose down -vThe BDD scenarios are in features/sse_streaming.feature:
Feature: SSE Streaming with JetStream
Scenario: Connect to SSE endpoint and receive messages
Given I am connected to SSE endpoint "/events?topic=notifications"
When I publish message '{"alert": "test"}' to subject "events.notifications"
Then I should receive an SSE event with topic "notifications"
And the event should have an IDmake testThis runs both unit and functional tests in order.
- Format with
go fmt ./...before committing - Follow standard Go conventions and idioms
- Keep the Caddy module API surface clean and consistent
- Create a feature branch from
main - Make your changes with clear, focused commits
- Ensure all tests pass:
make test - Push your branch and open a pull request against
main - Describe what your PR does and why
Found a bug or have a feature request? Please open an issue with:
- A clear title and description
- Steps to reproduce (for bugs)
- Your environment (Go version, OS, NATS version)
- Expected vs. actual behavior
By contributing, you agree that your contributions will be licensed under the BSD 4-Clause License.