Thank you for your interest in contributing to the Web Decoy Node.js SDK! This guide will help you get started.
- Fork and clone the repository:
git clone https://github.com/your-username/node.git
cd node- Install dependencies:
npm install- Build all packages:
npm run buildnode/
├── packages/
│ ├── webdecoy/ # Core SDK
│ └── express/ # Express middleware
├── examples/
│ └── express-basic/ # Example applications
├── docs/ # Documentation (coming soon)
└── scripts/ # Build and utility scripts
Build all packages:
npm run buildBuild in watch mode for development:
npm run devBuild a specific package:
cd packages/webdecoy
npm run buildNavigate to an example and run it:
cd examples/express-basic
cp .env.example .env
# Edit .env with your API key
npm run devRun linter:
npm run lintOne flat config at the repo root (eslint.config.mjs) covers every package — don't add a per-package one. The ruleset is deliberately narrow, because type checking is TypeScript's job and formatting is Prettier's; what's left is the class of thing neither catches.
@typescript-eslint/no-explicit-any is a warning under a per-package budget, set in each package's lint script (eslint src --max-warnings N). CI fails if the count grows, so a new any needs either a real type or a deliberate decision to raise the number. Lower it when you remove one.
Four type-aware rules run on src (not on tests): no-floating-promises, no-misused-promises, await-thenable, require-await. They need a TypeScript program and are slower, so the set is deliberately small — these catch things tsc does not, and the rest of recommendedTypeChecked mostly duplicates strict at the cost of a large style backlog.
no-floating-promises is the one that earns its keep here. This SDK does a lot of deliberate fire-and-forget — violation reporting, honeytoken derivation, directory warmup — and an accidental one looks identical to an intentional one. Mark the deliberate ones with void, and say in a comment why the rejection is safe to drop.
Format code:
npm run formatRun tests:
npm run testRun tests for a specific package:
cd packages/webdecoy
npm test- Create a new directory under
packages/ - Add
package.jsonwith workspace reference to dependencies - Add build configuration (tsconfig.json, tsup config)
- Update root package.json workspaces if needed
- Create a new directory under
examples/ - Add package.json with workspace references
- Include a README.md with setup instructions
- Add .env.example for configuration
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following the code style
-
Add tests for new functionality
-
Update documentation as needed
-
Commit with a clear message:
git commit -m "Add: Description of your feature" -
Push and create a pull request
-
Create a bug fix branch:
git checkout -b fix/bug-description
-
Add a test that reproduces the bug
-
Fix the bug
-
Ensure the test passes
-
Commit and create a pull request
- TypeScript: All code should be written in TypeScript
- Formatting: Use Prettier (config in .prettierrc)
- Linting: Follow ESLint rules
- Naming: Use camelCase for variables/functions, PascalCase for classes
- Comments: Add JSDoc comments for public APIs
/**
* Analyze a request for suspicious patterns
*
* @param metadata - Request metadata to analyze
* @returns Analysis result with threat score
*/
export function analyzeRequest(metadata: RequestMetadata): LocalAnalysis {
// Implementation
}- Update documentation for any new features
- Add tests for new functionality
- Ensure all tests pass locally
- Update CHANGELOG.md with your changes
- Keep commits atomic - one logical change per commit
- Write clear PR descriptions explaining what and why
Add: New feature descriptionFix: Bug descriptionUpdate: Change descriptionDocs: Documentation updateRefactor: Code refactoring description
- Write unit tests for all new functions
- Write integration tests for middleware
- Test error cases and edge cases
- Aim for >80% code coverage
- Update README.md for user-facing changes
- Add JSDoc comments to all public APIs
- Update TypeScript types
- Include code examples where helpful
(For maintainers only)
- Open a "Prepare Node SDK x.y.z" pull request that sets the same version in every
packages/*/package.json(and the@webdecoy/nodedependency ranges) and adds the CHANGELOG entry. - Merge it. The Publish workflow runs on the push to
main, builds and tests, publishes every package whose version npm does not have yet, checks the registry, then tagsvx.y.zand creates the GitHub release from the CHANGELOG entry.
Publishing authenticates with npm trusted publishing from .github/workflows/publish.yml. If a run fails partway, re-run it: packages already on npm are skipped.
- Open an issue for bugs or feature requests
- Join our Discord for questions
- Email support@webdecoy.com for private inquiries
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Follow the project's coding standards
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Web Decoy! 🎉