Contributing to oss-ratelimit
Find out how you can contribute to the development of oss-ratelimit, including reporting bugs, suggesting features, and submitting code changes.
Contributing to oss-ratelimit
First off, thank you for considering contributing to oss-ratelimit
! We appreciate you taking the time to help improve this project. Your contributions make the open-source community thrive.
This project is maintained by Saad Bukhari (GitHub: @codersaadi).
There are many ways to contribute, from reporting bugs and suggesting features to writing code and improving documentation.
Ways to Contribute
Reporting Bugs
Found something not working as expected? Please open a bug report using the issue template. Provide clear steps to reproduce, environment details, and logs if possible.
Requesting Features
Have an idea for a new feature or an improvement to an existing one? Open an issue using the feature request template to discuss it.
Asking Questions
Have questions about usage, architecture, or contribution? Feel free to start a discussion on GitHub.
Code Contributions
If you'd like to contribute code, please follow these steps:
1. Prerequisites
- Node.js: A recent LTS version (check
.nvmrc
if available). - Package Manager: We recommend using
pnpm
(npm install -g pnpm
), butnpm
oryarn
should also work. - Git: For version control.
- Redis: A running Redis instance (local or remote) for testing.
Local Redis
You'll need a Redis server accessible for running the library and its tests. You can easily run one using Docker: docker run -d --name oss-ratelimit-redis -p 6379:6379 redis
2. Fork & Clone
- Fork the repository on GitHub.
- Clone your fork locally:
Clone your fork - Add the original repository as an upstream remote:
Add upstream remote
3. Install Dependencies
Install project dependencies using your preferred package manager:
4. Environment Setup
The library might require environment variables, especially for connecting to Redis during tests or development.
- Create a
.env
file in the project root (copy.env.example
if it exists). - Set the necessary variables, typically
RATELIMIT_REDIS_URL
:
5. Create a Branch
Create a new branch for your changes, based on the main
branch (or the relevant development branch). Use a descriptive name.
6. Make Your Changes
- Write your code, following the existing style and patterns.
- Ensure your code is well-commented, especially for complex logic.
- Add or update tests for your changes (see Testing section).
- Update documentation (README, JSDoc, Fumadocs pages) if necessary.
7. Linting & Formatting
We use tools like ESLint, Prettier, or Biome to maintain code quality and consistency. Run the linting and formatting commands before committing.
Please ensure your code adheres to the project's linting and formatting rules. Commits might be blocked or CI checks might fail otherwise.
8. Testing
Ensure all existing tests pass, and add new tests to cover your changes.
Contributions that include tests are much more likely to be accepted quickly. Tests ensure your changes work as expected and prevent regressions in the future.
9. Commit Your Changes
- Stage your changes (
git add .
). - Commit them with a clear and descriptive message. We recommend following the Conventional Commits specification.
Example Commit
10. Push and Create Pull Request
- Push your branch to your fork:
Push to your fork - Go to the original
oss-ratelimit
repository on GitHub. - Click "New pull request" or respond to the prompt to create a PR from your recently pushed branch.
- Base Repository:
codersaadi/oss-ratelimit
| Base Branch:main
(or relevant dev branch) - Head Repository:
YOUR_USERNAME/oss-ratelimit
| Compare Branch:feature/your-descriptive-name
- Fill out the PR template:
- Provide a clear title and description of your changes.
- Link to any relevant issues (e.g.,
Fixes #123
). - Explain the purpose of the changes and how you tested them.
- Submit the Pull Request.
11. Code Review
- The maintainer(s) will review your pull request.
- Be prepared to discuss your changes and make adjustments based on feedback.
- Once approved, your changes will be merged! 🎉
Code of Conduct
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. Please read the CODE_OF_CONDUCT.md
file.
We are committed to providing a welcoming and inclusive environment. Any violations of the Code of Conduct may result in temporary or permanent bans from participating in the project community.
License
By contributing, you agree that your contributions will be licensed under the MIT License that covers the project. Make sure you understand its implications.
Thank you again for your interest in contributing to oss-ratelimit
!