Contributing Guide
Thank you for your interest in contributing to Voidkey! This guide will help you get started with contributing to the project.
Getting Started
Section titled “Getting Started”Prerequisites
Section titled “Prerequisites”Before contributing, make sure you have:
- Node.js 18+ and npm 9+
- Go 1.21+
- Docker and Docker Compose
- Git
- Familiarity with TypeScript, Go, and containerization
Setting Up Development Environment
Section titled “Setting Up Development Environment”-
Fork and Clone
Terminal window git clone https://github.com/YOUR_USERNAME/voidkey.gitcd voidkey -
Install Dependencies
Terminal window # Install Node.js dependenciescd broker-core && npm installcd ../broker-server && npm install# Install Go dependenciescd ../cli && go mod download -
Start Development Environment
Terminal window cd ../sandboxdocker-compose up -d
See the Development Setup guide for detailed instructions.
How to Contribute
Section titled “How to Contribute”Types of Contributions
Section titled “Types of Contributions”We welcome several types of contributions:
- 🐛 Bug Reports: Help us identify and fix issues
- ✨ Feature Requests: Suggest new functionality
- 📝 Documentation: Improve or add documentation
- 🔧 Code Contributions: Fix bugs or implement features
- 🧪 Testing: Add or improve tests
- 🎨 UI/UX: Improve user experience
Before You Start
Section titled “Before You Start”- Check Existing Issues: Look for existing issues or discussions related to your contribution
- Create an Issue: For significant changes, create an issue to discuss the approach
- Assign Yourself: Comment on the issue to let others know you’re working on it
Development Workflow
Section titled “Development Workflow”1. Create a Branch
Section titled “1. Create a Branch”Create a descriptive branch name:
# Feature branchesgit checkout -b feature/add-azure-providergit checkout -b feature/improve-error-handling
# Bug fix branchesgit checkout -b fix/token-validation-issuegit checkout -b fix/memory-leak-in-server
# Documentation branchesgit checkout -b docs/update-api-referencegit checkout -b docs/add-examples2. Make Changes
Section titled “2. Make Changes”Follow our coding standards and best practices:
TypeScript (broker-core, broker-server)
Section titled “TypeScript (broker-core, broker-server)”- Use TypeScript strict mode
- Follow existing code style and patterns
- Add proper type definitions
- Include JSDoc comments for public APIs
- Use dependency injection where appropriate
Example:
/** * Validates an OIDC token and returns claims * @param token - The OIDC token to validate * @returns Promise resolving to token claims * @throws Error if token is invalid */async validateToken(token: string): Promise<TokenClaims> { // Implementation}Go (CLI)
Section titled “Go (CLI)”- Follow Go conventions and idioms
- Use
gofmtfor formatting - Add proper error handling
- Include tests for new functionality
- Use structured logging
Example:
func mintCredentials(keys []string) (*Credentials, error) { if len(keys) == 0 { return nil, fmt.Errorf("at least one key must be specified") }
// Implementation}3. Add Tests
Section titled “3. Add Tests”All contributions should include appropriate tests:
Unit Tests
Section titled “Unit Tests”// TypeScript unit testdescribe('NewFeature', () => { it('should handle valid input correctly', () => { const result = newFeature('valid-input'); expect(result).toBe('expected-output'); });
it('should throw error for invalid input', () => { expect(() => newFeature('invalid')).toThrow('Invalid input'); });});// Go unit testfunc TestNewFeature(t *testing.T) { result, err := NewFeature("valid-input") assert.NoError(t, err) assert.Equal(t, "expected-output", result)
_, err = NewFeature("invalid") assert.Error(t, err)}Integration Tests
Section titled “Integration Tests”Add integration tests for new features that interact with external services or multiple components.
4. Update Documentation
Section titled “4. Update Documentation”Update relevant documentation:
- API Documentation: Update if you’ve changed API interfaces
- Configuration: Update if you’ve added new configuration options
- README: Update if installation or usage has changed
- Examples: Add examples for new features
5. Run Tests and Checks
Section titled “5. Run Tests and Checks”Before submitting, ensure all tests pass:
# TypeScript testscd broker-core && npm testcd ../broker-server && npm test
# Go testscd ../cli && go test ./...
# Integration testscd ../broker-server && npm run test:integration
# Lintingcd ../broker-core && npm run lintcd ../broker-server && npm run lintcd ../cli && golangci-lint run6. Commit Changes
Section titled “6. Commit Changes”Use conventional commit messages:
# Format: type(scope): descriptiongit commit -m "feat(providers): add Azure AD identity provider"git commit -m "fix(cli): resolve token validation issue"git commit -m "docs(api): update authentication examples"git commit -m "test(core): add unit tests for token validation"Commit Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code refactoringperf: Performance improvementschore: Maintenance tasks
7. Push and Create Pull Request
Section titled “7. Push and Create Pull Request”git push origin your-branch-nameThen create a pull request on GitHub with:
- Clear title describing the change
- Detailed description explaining what and why
- Reference to related issues (e.g., “Fixes #123”)
- Testing notes if applicable
Pull Request Guidelines
Section titled “Pull Request Guidelines”PR Template
Section titled “PR Template”We use a pull request template. Make sure to:
- Fill out all sections of the template
- Link related issues using keywords like “Fixes #123”
- Describe testing done for the changes
- Add screenshots for UI changes
- Check all boxes in the checklist
Review Process
Section titled “Review Process”- Automated Checks: CI/CD pipelines run tests and checks
- Code Review: Maintainers review code for quality and style
- Testing: Changes are tested in integration environment
- Approval: At least one maintainer approval required
- Merge: Squash and merge to main branch
What We Look For
Section titled “What We Look For”- Code Quality: Clean, readable, and maintainable code
- Test Coverage: Adequate test coverage for new functionality
- Documentation: Updated documentation for changes
- Security: No security vulnerabilities introduced
- Performance: No significant performance regressions
- Backward Compatibility: Maintain API compatibility where possible
Coding Standards
Section titled “Coding Standards”Code Style
Section titled “Code Style”TypeScript
Section titled “TypeScript”// Use explicit typesinterface UserConfig { name: string; age: number; isActive: boolean;}
// Use async/await instead of Promisesasync function fetchData(): Promise<Data> { const response = await fetch('/api/data'); return response.json();}
// Use proper error handlingtry { const result = await riskyOperation(); return result;} catch (error) { logger.error('Operation failed', { error: error.message }); throw new Error('Failed to complete operation');}// Use proper error handlingfunc processData(data []byte) (*Result, error) { if len(data) == 0 { return nil, fmt.Errorf("data cannot be empty") }
result, err := parseData(data) if err != nil { return nil, fmt.Errorf("failed to parse data: %w", err) }
return result, nil}
// Use structured logginglogger.Info("Processing request", "user", userID, "keys", requestedKeys, "duration", duration)Naming Conventions
Section titled “Naming Conventions”- TypeScript: Use
camelCasefor variables and functions,PascalCasefor classes and interfaces - Go: Use Go conventions (
camelCasefor unexported,PascalCasefor exported) - Files: Use
kebab-casefor file names - Directories: Use
kebab-casefor directory names
Project Structure
Section titled “Project Structure”Follow the established project structure:
voidkey/├── broker-core/ # Core TypeScript library│ ├── src/│ │ ├── providers/ # Provider implementations│ │ ├── services/ # Business logic│ │ ├── utils/ # Utility functions│ │ └── types/ # Type definitions│ └── __tests__/ # Tests├── broker-server/ # NestJS HTTP server│ ├── src/│ │ ├── modules/ # NestJS modules│ │ ├── controllers/ # HTTP controllers│ │ ├── services/ # Business services│ │ └── dto/ # Data transfer objects│ └── test/ # Tests├── cli/ # Go CLI application│ ├── cmd/ # CLI commands│ ├── internal/ # Internal packages│ └── main.go # Entry point└── docs/ # DocumentationSpecific Contribution Areas
Section titled “Specific Contribution Areas”Adding New Providers
Section titled “Adding New Providers”Identity Providers
Section titled “Identity Providers”-
Create Provider Class
broker-core/src/providers/idp/my-idp.provider.ts export class MyIdpProvider implements IdpProvider {// Implementation} -
Add Tests
broker-core/src/providers/idp/__tests__/my-idp.provider.test.ts describe('MyIdpProvider', () => {// Tests}); -
Register Provider
broker-server/src/providers/providers.service.ts // Add to provider factory -
Update Documentation
- Add to Identity Providers page
- Add configuration example
- Add usage example
Access Providers
Section titled “Access Providers”Similar process for access providers - implement interface, add tests, register, and document.
Improving Error Handling
Section titled “Improving Error Handling”-
Define Error Types
export class ValidationError extends Error {constructor(message: string, public field: string) {super(message);this.name = 'ValidationError';}} -
Use Consistent Error Messages
if (!token) {throw new ValidationError('Token is required', 'token');} -
Add Error Tests
it('should throw ValidationError for missing token', () => {expect(() => validateToken('')).toThrow(ValidationError);});
Adding CLI Features
Section titled “Adding CLI Features”-
Create Command
cli/cmd/mycommand.go func newMyCommand() *cobra.Command {// Implementation} -
Add to Root Command
cli/cmd/root.go func init() {rootCmd.AddCommand(newMyCommand())} -
Add Tests
cli/cmd/mycommand_test.go func TestMyCommand(t *testing.T) {// Tests}
Getting Help
Section titled “Getting Help”Communication Channels
Section titled “Communication Channels”- GitHub Issues: For bugs, feature requests, and discussions
- GitHub Discussions: For questions and community discussions
- Discord: For real-time chat (link in repository)
Finding Good First Issues
Section titled “Finding Good First Issues”Look for issues labeled:
good first issue: Perfect for new contributorshelp wanted: Community help neededdocumentation: Documentation improvementsbeginner friendly: Easy to get started
Mentorship
Section titled “Mentorship”New contributors can:
- Ask questions in GitHub discussions
- Request mentorship in Discord
- Pair program with maintainers (by arrangement)
Recognition
Section titled “Recognition”Contributors are recognized through:
- Contributors List: Added to README and documentation
- Release Notes: Mentioned in release notes
- Hall of Fame: Featured contributors highlighted
- Swag: Stickers and other swag for significant contributors
Security
Section titled “Security”Reporting Security Issues
Section titled “Reporting Security Issues”For security vulnerabilities:
- Do not create public issues
- Email security@voidkey.io with details
- Use encrypted communication if possible
- Wait for acknowledgment before disclosure
Security Guidelines
Section titled “Security Guidelines”- Never commit secrets or credentials
- Use secure coding practices
- Validate all inputs
- Follow principle of least privilege
- Keep dependencies updated
Release Process
Section titled “Release Process”Versioning
Section titled “Versioning”We use Semantic Versioning:
- Major (1.0.0): Breaking changes
- Minor (0.1.0): New features, backward compatible
- Patch (0.0.1): Bug fixes, backward compatible
Release Schedule
Section titled “Release Schedule”- Minor releases: Monthly
- Patch releases: As needed
- Major releases: Quarterly or when breaking changes accumulate
License
Section titled “License”By contributing to Voidkey, you agree that your contributions will be licensed under the same license as the project (Apache 2.0 License).
Code of Conduct
Section titled “Code of Conduct”Please read and follow our Code of Conduct. We are committed to providing a welcoming and inclusive environment for all contributors.
Thank You
Section titled “Thank You”Thank you for contributing to Voidkey! Your contributions help make secure credential management accessible to everyone.
Next Steps
Section titled “Next Steps”- Development Setup - Set up your development environment
- Testing Guide - Learn about our testing practices
- API Reference - Understand the API structure
- Architecture Overview - Learn the system architecture