Contributing
Thank you for your interest in contributing to bunqueue! This guide will help you get started.
Code of Conduct
Be respectful and inclusive. We welcome contributors of all backgrounds and experience levels.
Getting Started
Prerequisites
- Bun v1.0+
- Git
- A GitHub account
Setup
# Fork the repo on GitHub, then:git clone https://github.com/YOUR_USERNAME/bunqueue.gitcd bunqueuebun installRunning Tests
# Run all testsbun test
# Run specific test filebun test test/queue.test.ts
# Run with coveragebun test --coverageCode Style
We use ESLint and Prettier:
# Check lintingbun run lint
# Format codebun run formatMaking Changes
Branch Naming
feat/description- New featuresfix/description- Bug fixesdocs/description- Documentationrefactor/description- Code refactoringtest/description- Test additions
Commit Messages
Follow Conventional Commits:
feat: add stall detection for workersfix: resolve memory leak in event listenersdocs: update API referencerefactor: simplify batch operationstest: add DLQ filtering testsPull Request Process
- Create a feature branch
- Make your changes
- Add/update tests
- Update documentation
- Run
bun testandbun run lint - Push and create a PR
PR Template
## DescriptionBrief description of changes
## Type of Change- [ ] Bug fix- [ ] New feature- [ ] Breaking change- [ ] Documentation
## TestingHow was this tested?
## Checklist- [ ] Tests pass- [ ] Linting passes- [ ] Documentation updatedProject Structure
src/├── cli/ # CLI commands├── client/ # Embedded client SDK├── domain/ # Core business logic├── application/ # Use cases├── infrastructure/ # External services└── shared/ # UtilitiesKey Files
src/domain/queue/shard.ts- Queue sharding logicsrc/application/queueManager.ts- Central coordinatorsrc/client/queue.ts- Client Queue classsrc/client/worker.ts- Client Worker class
Architecture Guidelines
File Size
- Max 300 lines per file
- Split if larger
Lock Order
jobIndexcompletedJobsshards[N]processingShards[N]
Memory Management
- Use bounded collections
- Clean up event listeners
- Release resources in shutdown
Testing Guidelines
Test Structure
describe('Feature', () => { beforeEach(() => { // Setup });
afterEach(() => { // Cleanup });
it('should do something', () => { // Test });});What to Test
- Happy path
- Edge cases
- Error handling
- Concurrent operations
Documentation
Code Comments
/** Brief description */function simpleFunction() {}
/** * Longer description for complex functions * @param input - Description * @returns Description */function complexFunction(input: string): Result {}README Updates
Update README.md for:
- New features
- Changed APIs
- New environment variables
Release Process
- Update version in
package.json - Update CHANGELOG.md
- Create PR titled
release: v1.x.x - After merge, tag and publish
Getting Help
Recognition
Contributors are listed in:
- GitHub contributors page
- README.md acknowledgments
Thank you for contributing! 🎉