|
| 1 | +# Contributing to Platformatic Kafka |
| 2 | + |
| 3 | +Welcome to the Platformatic Kafka development guide! This document will help you set up your development environment and contribute to the project. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Platformatic is an open-source, modern, high-performance, pure TypeScript/JavaScript type safe client for Apache Kafka. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +- **Node.js**: Version 20.19.4, 22.18.0 or 24.6.0 or higher |
| 12 | +- **pnpm**: Package manager (follow the [pnpm installation guide](https://pnpm.io/installation)) |
| 13 | +- **Docker** (optional): Only required for running tests locally. |
| 14 | + |
| 15 | +## Getting Started |
| 16 | + |
| 17 | +### 1. Clone and Setup |
| 18 | + |
| 19 | +```bash |
| 20 | +git clone https://github.com/platformatic/kafka.git |
| 21 | +cd kafka |
| 22 | +``` |
| 23 | + |
| 24 | +### 2. Install Dependencies |
| 25 | + |
| 26 | +```bash |
| 27 | +pnpm install |
| 28 | +``` |
| 29 | + |
| 30 | +### 4. Setup Docker Environment (Optional) |
| 31 | + |
| 32 | +This step is only required if you plan to run tests locally. |
| 33 | + |
| 34 | +```bash |
| 35 | +docker compose up -d |
| 36 | +``` |
| 37 | + |
| 38 | +## Development Workflow |
| 39 | + |
| 40 | +### Essential Commands |
| 41 | + |
| 42 | +```bash |
| 43 | +# Development workflow |
| 44 | +pnpm test # Run all tests |
| 45 | +pnpm run build # Build the package |
| 46 | +pnpm run lint # Lint the package |
| 47 | +``` |
| 48 | + |
| 49 | +### Testing |
| 50 | + |
| 51 | +Tests require Docker for Kafka cluster setup. |
| 52 | + |
| 53 | +``` |
| 54 | +docker compose up -d |
| 55 | +``` |
| 56 | + |
| 57 | +You can eventually provide a `KAFKA_VERSION` environment variable to select a specific version of Kafka. |
| 58 | +Note that the images use Confluent Kafka so you need to add 4 to your desider version. For instance, to run on Kafka 3.9.0: |
| 59 | + |
| 60 | +``` |
| 61 | +bash |
| 62 | +KAFKA_VERSION=7.9.0 docker compose up -d |
| 63 | +``` |
| 64 | + |
| 65 | +Then you run the test normally: |
| 66 | + |
| 67 | +```bash |
| 68 | +pnpm test |
| 69 | +``` |
| 70 | + |
| 71 | +## Pull Request Process |
| 72 | + |
| 73 | +### Before Submitting |
| 74 | + |
| 75 | +1. Ensure all tests pass: `pnpm test` |
| 76 | +2. Run linting: `pnpm run lint` |
| 77 | +3. Build all packages: `pnpm run build` |
| 78 | + |
| 79 | +### Creating a Pull Request |
| 80 | + |
| 81 | +1. If your PR fixes a GitHub issue, add this at the top of the PR description: |
| 82 | + |
| 83 | +``` |
| 84 | +Fixes #<issue-number>. |
| 85 | +``` |
| 86 | + |
| 87 | +2. Ensure all checks pass and get approval |
| 88 | +3. Merge using "squash and merge" option |
| 89 | + |
| 90 | +## Developer Certificate of Origin |
| 91 | + |
| 92 | +All contributions must include a Developer Certificate of Origin (DCO) sign-off. Use the `-s` flag when committing: |
| 93 | + |
| 94 | +```bash |
| 95 | +git commit -s -m "Your commit message" |
| 96 | +``` |
| 97 | + |
| 98 | +This automatically adds your `Signed-off-by` line to the commit message. If working with AI assistance, ensure both contributors are signed off. |
| 99 | + |
| 100 | +``` |
| 101 | +Developer Certificate of Origin |
| 102 | +Version 1.1 |
| 103 | +
|
| 104 | +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. |
| 105 | +1 Letterman Drive |
| 106 | +Suite D4700 |
| 107 | +San Francisco, CA, 94129 |
| 108 | +
|
| 109 | +Everyone is permitted to copy and distribute verbatim copies of this |
| 110 | +license document, but changing it is not allowed. |
| 111 | +
|
| 112 | +
|
| 113 | +Developer's Certificate of Origin 1.1 |
| 114 | +
|
| 115 | +By making a contribution to this project, I certify that: |
| 116 | +
|
| 117 | +(a) The contribution was created in whole or in part by me and I |
| 118 | + have the right to submit it under the open source license |
| 119 | + indicated in the file; or |
| 120 | +
|
| 121 | +(b) The contribution is based upon previous work that, to the best |
| 122 | + of my knowledge, is covered under an appropriate open source |
| 123 | + license and I have the right under that license to submit that |
| 124 | + work with modifications, whether created in whole or in part |
| 125 | + by me, under the same open source license (unless I am |
| 126 | + permitted to submit under a different license), as indicated |
| 127 | + in the file; or |
| 128 | +
|
| 129 | +(c) The contribution was provided directly to me by some other |
| 130 | + person who certified (a), (b) or (c) and I have not modified |
| 131 | + it. |
| 132 | +
|
| 133 | +(d) I understand and agree that this project and the contribution |
| 134 | + are public and that a record of the contribution (including all |
| 135 | + personal information I submit with it, including my sign-off) is |
| 136 | + maintained indefinitely and may be redistributed consistent with |
| 137 | + this project or the open source license(s) involved. |
| 138 | +``` |
| 139 | + |
| 140 | +If you want to know how to retroactively add the DCO to your commits, |
| 141 | +check out [this guide](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md). |
| 142 | + |
| 143 | +## Getting Help |
| 144 | + |
| 145 | +- Check the [documentation](https://docs.platformatic.dev/) |
| 146 | +- Join our [Discord community](https://discord.gg/platformatic) for real-time help and discussions |
| 147 | +- Open an issue on GitHub |
| 148 | + |
| 149 | +Thank you for contributing to Platformatic Kafka! 🚀 |
0 commit comments