Thank you for your interest in contributing to Kayrock!
- Elixir 1.14 or later
- Erlang/OTP 24.3 or later
- Docker (for integration tests)
# Clone the repository
git clone https://github.com/kafkaex/kayrock.git
cd kayrock
# Install dependencies
mix deps.get
# Run tests
mix test
# Run static analysis
mix credo --strict
mix dialyzerKayrock uses code generation from kafka_protocol schemas. The generated code is in lib/generated/.
Important: Do not edit files in lib/generated/ manually.
To regenerate the protocol code:
mix gen.kafka_protocolThis is only needed when:
- Updating the
kafka_protocoldependency - Adding support for new Kafka protocol versions
mix testIntegration tests require a Kafka cluster. We use testcontainers:
# Requires Docker to be running
mix test.integrationAll contributions must pass:
-
Compilation without warnings
mix compile --warnings-as-errors
-
Unit tests
mix test -
Credo (code style)
mix credo --strict
-
Dialyzer (type checking)
mix dialyzer
-
Code formatting
mix format --check-formatted
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes
- Ensure all checks pass (see above)
- Commit with a descriptive message
- Push to your fork
- Open a Pull Request
Use clear, descriptive commit messages:
Add support for Kafka 3.x protocol changes
- Updated FetchRequest to support new fields
- Added tests for new behavior
- Updated documentation
Include:
- What the change does
- Why it's needed
- Any breaking changes
- Related issues (if applicable)
kayrock/
├── lib/
│ ├── kayrock/ # Core library code
│ │ ├── client.ex # Kafka client (development only)
│ │ ├── compression.ex # Compression handling
│ │ ├── record_batch.ex# Record batch serialization
│ │ └── ...
│ ├── generated/ # Auto-generated protocol code
│ └── mix/tasks/ # Mix tasks (code generation)
├── test/
│ ├── kayrock/ # Unit tests
│ ├── integration/ # Integration tests
│ └── support/ # Test helpers
└── config/ # Configuration
Kayrock includes a usage-rules.md file that provides guidelines for LLM-based coding assistants.
This file is automatically available to tools that support the usage_rules package.
If you use LLM coding assistants (Claude, Cursor, etc.), you can pull in Kayrock's usage rules:
# Add usage_rules to your project
mix igniter.install usage_rules
# Sync Kayrock's rules to your AI config file
mix usage_rules.sync CLAUDE.md kayrock --link-to-folder depsWhen updating usage-rules.md, ensure it includes:
- Common mistakes and how to avoid them
- Correct usage patterns with code examples
- API-specific guidance
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
By contributing, you agree that your contributions will be licensed under the MIT License.