Thank you for your interest in contributing! This guide explains how to get started.
- Node.js (LTS version recommended)
- Docker and Docker Compose
- Git
# Clone the repository
git clone https://github.com/<owner>/couch-rules-engine.git
cd couch-rules-engine
# Install dependencies
npm install
# Start CouchDB via Docker
docker-compose up -d
# Run the test suite
npm testCopy .env.example to .env and adjust values as needed:
cp .env.example .env- Create a branch from
masterfor your change. - Make your changes following the code style and patterns below.
- Write or update tests for your changes.
- Run the full test suite and ensure all tests pass.
- Submit a pull request with a clear description of the change.
- Vanilla JavaScript only — no frameworks (React, Vue, Angular, etc.)
- Pure CSS with CSS custom properties for theming in the web interface
- No unnecessary dependencies — prefer built-in Node.js capabilities
- ESLint and Prettier are configured — run
npm run lintbefore committing
Each validator follows this structure:
// validators/ruleName.js
exports.ruleName = function (doc) {
if (invalidCondition) {
throw { forbidden: 'Human-readable error message' };
}
return true;
};Use the rule generator to scaffold new rules:
npm run create-rule -- --name myRule --field fieldName --type range --min 0 --max 100- Create the validator file:
validators/newRule.js - Export the validation function following the pattern above
- Create a test file:
test/unit/validators/newRule.test.js - Run
npm testto verify everything works - Load into CouchDB:
npm run load <db> <user> <password>
# All tests
npm test
# Unit tests only
npm run test:unit
# Validator tests only
npm run test:validators
# Integration tests (requires running CouchDB)
npm run test:integration
# Watch mode
npm run test:watchUse clear, descriptive commit messages:
feat: add income threshold validatorfix: correct household size boundary checkdocs: update CONTRIBUTING guidetest: add edge case tests for numberOfDependents
- Reference any related issues in the PR description
- Ensure all CI checks pass
- Keep PRs focused — one feature or fix per PR
- Update documentation if your change affects user-facing behavior
- Use GitHub Issues to report bugs or request features
- Include steps to reproduce for bug reports
- Check existing issues before creating a new one
By contributing, you agree that your contributions will be licensed under the project's ISC License.