Contributing to Emmett โ
WARNING
We created this page with the help of the GenAI tool.
We're currently double-checking it to ensure the information is 100% correct and free of hallucinations.
We welcome contributions! This guide covers everything you need to get started.
Ways to Contribute โ
| Type | Description |
|---|---|
| ๐ Bug Reports | Found something broken? Open an issue |
| ๐ก Feature Requests | Have an idea? Start a discussion |
| ๐ Documentation | Improve guides, fix typos, add examples |
| ๐งช Tests | Increase coverage, add edge cases |
| ๐ป Code | Fix bugs, implement features |
Getting Started โ
Prerequisites โ
- Node.js 22+
- npm 11+
- Docker (for integration tests)
Setup โ
bash
# Clone the repository
git clone https://github.com/event-driven-io/emmett.git
cd emmett
# Install dependencies
npm install
# Build all packages
npm run build
# Run tests
npm run testProject Structure โ
src/
โโโ packages/
โ โโโ emmett/ # Core package
โ โโโ emmett-postgresql/ # PostgreSQL event store
โ โโโ emmett-esdb/ # EventStoreDB adapter
โ โโโ emmett-mongodb/ # MongoDB event store
โ โโโ emmett-sqlite/ # SQLite event store
โ โโโ emmett-expressjs/ # Express.js integration
โ โโโ emmett-fastify/ # Fastify integration
โ โโโ emmett-testcontainers/ # Test utilities
โ โโโ emmett-shims/ # Polyfills
โโโ docs/ # Documentation (VitePress)
โโโ samples/ # Sample applicationsDevelopment Workflow โ
Running Tests โ
bash
# All tests
npm run test
# Specific package
npm -ws @event-driven-io/emmett run test
# Watch mode
npm --ws @event-driven-io/emmett run test:watch
# With coverage
npm run test:coverageBuilding โ
bash
# All packages
npm run build
# Specific package
npm --ws @event-driven-io/emmett run build
# Watch mode (development)
npm --ws @event-driven-io/emmett run build:watchLinting and Formatting โ
bash
# Check linting
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run formatMaking Changes โ
1. Create a Branch โ
bash
git checkout -b feature/your-feature-name
# or
git checkout -b fix/issue-description2. Make Your Changes โ
- Follow existing code style
- Add tests for new functionality
- Update documentation if needed
3. Test Your Changes โ
bash
# Run tests for affected packages
npm run test
# Run full build
npm run build4. Commit Your Changes โ
Remember to make your commit message meaningful and group changes into commits logically.
5. Open a Pull Request โ
- Fill out the PR template
- Link related issues
- Wait for CI to pass
- Address review feedback
Code Style โ
TypeScript Guidelines โ
typescript
// โ
Good: Use explicit types for exports
export type ShoppingCartEvent =
| Event<'ProductItemAdded', { productId: string; quantity: number }>
| Event<'ShoppingCartConfirmed', { confirmedAt: Date }>;
// โ
Good: Use readonly for immutable data
interface ShoppingCart {
readonly id: string;
readonly items: readonly ProductItem[];
}
// โ
Good: Prefer const assertions
const STATUSES = ['Pending', 'Confirmed', 'Cancelled'] as const;
// โ
Good: Use discriminated unions
type Result<T> = { success: true; value: T } | { success: false; error: Error };Testing Guidelines โ
typescript
// โ
Good: Use BDD-style specifications
describe('Shopping Cart', () => {
it('adds product to empty cart', () =>
spec([]).when(addProductCommand).then([productAddedEvent]));
});
// โ
Good: Test edge cases
it('rejects negative quantity', () =>
spec([])
.when({ type: 'AddProduct', data: { quantity: -1 } })
.thenThrows(ValidationError));Adding a New Package โ
- Create package directory under
src/packages/ - Add
package.jsonwith proper naming - Add to workspace in root
npm-workspace.yaml - Create README following package README template
- Add to documentation
Documentation โ
Running Docs Locally โ
bash
cd src/docs
npm install
npm run devWriting Documentation โ
- Use VitePress markdown features
- Include working code examples
- Follow the Diataxis framework:
- Tutorials: Learning-oriented (Getting Started)
- How-to Guides: Task-oriented (Guides)
- Reference: Information-oriented (API Reference)
- Explanation: Understanding-oriented (deep dives)
Issue Guidelines โ
Bug Reports โ
Include:
- Emmett version
- Node.js version
- Minimal reproduction
- Expected vs actual behavior
- Error messages/stack traces
Feature Requests โ
Include:
- Use case description
- Proposed API (if applicable)
- Alternatives considered
Getting Help โ
- ๐ฌ Discord - Quick questions
- ๐ฌ GitHub Discussions - Longer discussions
- ๐ GitHub Issues - Bug reports
Recognition โ
Contributors are recognized in:
- Release notes
- README contributors section
- GitHub contributors page
Code of Conduct โ
We follow the Contributor Covenant. Be respectful, inclusive, and constructive.
License โ
By contributing, you agree that your contributions will be licensed under the MIT License.
