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/webdecoy-node.git
cd webdecoy-node- Install dependencies:
npm install- Build all packages:
npm run buildwebdecoy-node/
├── 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 lintFormat 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)
- Update version in all package.json files
- Update CHANGELOG.md
- Create a git tag
- Push to GitHub
- Publish to npm
- 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! 🎉