Thank you for your interest in contributing to reDB Node! This document provides guidelines and information for contributors to help make the contribution process smooth and effective.
- Code of Conduct
- Getting Started
- Development Environment
- Project Structure
- Development Workflow
- Branch Protection and Governance
- Code Standards
- Testing
- Documentation
- Submitting Changes
- Review Process
- Release Process
- Community Guidelines
This project is committed to providing a welcoming and inclusive environment for all contributors. By participating in this project, you agree to abide by our Code of Conduct. Please report unacceptable behavior to the project maintainers.
- Be respectful and inclusive of all contributors
- Use welcoming and inclusive language
- Be collaborative and open to constructive feedback
- Focus on what is best for the community
- Show empathy towards other community members
Before you begin contributing, ensure you have the following installed:
- Go 1.23+ - Download
- PostgreSQL 17+ - Download
- Redis Server - Download
- Protocol Buffers Compiler - Installation Guide
- Git - Download
- Make - Usually pre-installed on Unix-like systems
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/redb-open.git cd redb-open - Add the upstream remote:
git remote add upstream https://github.com/redbco/redb-open.git
-
Install development tools:
make dev-tools
-
Generate Protocol Buffer code:
make proto
-
Build the project:
make local -
Run tests to ensure everything is working:
make test
-
Start PostgreSQL:
# Ubuntu/Debian sudo systemctl start postgresql # macOS (with Homebrew) brew services start postgresql
-
Start Redis:
# Ubuntu/Debian sudo systemctl start redis-server # macOS (with Homebrew) brew services start redis
-
Create a database user:
sudo -u postgres psql CREATE USER your_admin_user WITH ENCRYPTED PASSWORD 'your_admin_password' CREATEDB CREATEROLE LOGIN; \q
-
Initialize the application:
./redb-node --initialize
Understanding the project structure will help you navigate and contribute effectively:
redb-open/
├── cmd/ # Command-line applications
│ ├── cli/ # CLI client
│ └── supervisor/ # Service orchestrator
├── services/ # Core microservices
│ ├── anchor/ # Database connectivity (16+ adapters)
│ ├── clientapi/ # Primary REST API (50+ endpoints)
│ ├── core/ # Central business logic hub
│ ├── mcpserver/ # AI/LLM integration (MCP protocol)
│ ├── mesh/ # Distributed coordination and consensus
│ ├── security/ # Authentication and authorization
│ ├── transformation/ # Data processing and obfuscation
│ ├── unifiedmodel/ # Database abstraction and schema translation
│ └── webhook/ # External system integration
├── pkg/ # Shared libraries and utilities
└── api/proto/ # Protocol Buffer definitions
services/- Main microservices (most contributions will be here)pkg/- Shared libraries (common utilities and frameworks)api/proto/- Protocol Buffer definitions (for API changes)cmd/- Command-line applications
We use a feature branch workflow:
- Main branch (
main) - Always contains production-ready code - Feature branches - Created from
mainfor new features/fixes - Release branches - Created from
mainfor release preparation
# Ensure you're on main and up to date
git checkout main
git pull upstream main
# Create and switch to a new feature branch
git checkout -b feature/your-feature-name
# Or for bug fixes
git checkout -b fix/your-bug-descriptionfeature/- New featuresfix/- Bug fixesdocs/- Documentation updatesrefactor/- Code refactoringtest/- Adding or updating testschore/- Maintenance tasks
Examples:
feature/add-mysql-adapterfix/security-jwt-validationdocs/update-api-documentation
This project implements branch protection to ensure code quality and security. The current configuration is designed to support both single maintainer and community-driven development.
- Required approvals: 1 (will increase to 2 as community grows)
- Status checks: Build, test, and lint must pass
- Emergency bypass: Available for maintainers
- Signed commits: Not required (will be enabled later)
- Linear history: Not required (will be enabled later)
main- Production-ready code (strictest protection)develop- Integration branch (moderate protection)release/*- Release preparation brancheshotfix/*- Critical bug fixes
As the community grows, we will progressively enhance our governance structure:
- ✅ 1 approval required for pull requests
- ✅ Basic CI/CD checks (build, test, lint)
- ✅ Maintainer bypass for emergencies
- ✅ Simple CODEOWNERS (maintainer only)
- ✅ Keep 1 approval requirement
- ✅ Enable CODEOWNERS reviews
- ✅ Add signed commits requirement
- ✅ Add security scanning
- ✅ Add dependency scanning
- ✅ Increase to 2 required approvals
- ✅ Add community maintainers
- ✅ Enable advanced protection features
- ✅ Add performance monitoring
- ✅ Establish governance committee
- ✅ Multiple maintainer teams
- ✅ Advanced security features
- ✅ Comprehensive testing requirements
- ✅ Formal governance structure
- 5 contributors: Enable CODEOWNERS reviews
- 10 contributors: Increase to 2 required approvals
- 50 contributors: Add community maintainers
- 100 contributors: Establish governance committee
For critical fixes and emergencies:
Maintainers can bypass protection rules for urgent fixes:
# Maintainers can push directly to protected branches
git push origin main# Create emergency fix branch
git checkout -b hotfix/critical-security-fix
# Make the fix
git commit -m "fix(security): critical vulnerability patch"
# Merge directly
git checkout main
git merge hotfix/critical-security-fix --no-ff
# Clean up
git branch -d hotfix/critical-security-fixFor critical issues, create PRs with emergency prefix:
# Create emergency PR with [EMERGENCY] prefix
git checkout -b hotfix/urgent-fix
# Make changes
git commit -m "fix: urgent issue resolution"
git push origin hotfix/urgent-fix
# Create PR with title: "[EMERGENCY] Urgent fix: description"For detailed emergency procedures, see EMERGENCY_PROCEDURES.md
The project uses CODEOWNERS to ensure appropriate review of changes:
- Global owner: Project maintainer
- Service-specific owners: Maintainer with fallback
- Database adapters: Maintainer with future expert assignment
- Documentation: Maintainer with future docs team
- Infrastructure: Maintainer with future DevOps team
As the community grows, ownership will be distributed to specialized teams:
- Core services: Core team
- Security: Security team
- Database adapters: Database team with database-specific experts
- API: API team
- Documentation: Documentation team
- Infrastructure: DevOps team
As a single maintainer, I aim to review pull requests within:
- Critical issues: 24 hours
- Regular features: 3-5 days
- Documentation: 1 week
- Be patient: Single maintainer means limited bandwidth
- Self-review: Use the PR template checklist before submitting
- Automated checks: Ensure all CI/CD checks pass
- Clear descriptions: Provide detailed explanations of changes
- Follow templates: Complete all required sections
If your PR has been waiting too long:
- Ping the maintainer with a friendly reminder
- Check if all checks are passing
- Ensure the PR template is complete
- Consider if the change is truly urgent
- Branch protection: Prevents direct pushes to main
- Required reviews: Ensures code review before merging
- Status checks: Validates code quality and tests
- Emergency procedures: Allows urgent security fixes
- Signed commits: Will be required for all commits
- CodeQL analysis: Automated security scanning
- Dependency scanning: Vulnerability detection
- Security-focused reviews: Specialized security review process
- Automated testing: Unit and integration tests
- Code linting: Style and quality checks
- Build verification: Ensures code compiles
- Template completion: Ensures complete information
- Performance testing: Automated performance benchmarks
- Coverage requirements: Minimum test coverage thresholds
- Documentation checks: Automated documentation validation
- API compatibility: Automated API compatibility testing
We follow the Effective Go guidelines and use gofmt for formatting.
-
Run the linter before committing:
make lint
-
Format your code:
go fmt ./...
-
Run static analysis:
go vet ./...
- Package structure - Follow Go conventions for package organization
- Error handling - Always check and handle errors appropriately
- Logging - Use structured logging with appropriate log levels
- Comments - Document exported functions and complex logic
- Naming - Use clear, descriptive names for variables, functions, and packages
// Good: Clear function name with documentation
// CreateUser creates a new user in the specified tenant
func (s *UserService) CreateUser(ctx context.Context, tenantID string, user *User) (*User, error) {
if user == nil {
return nil, errors.New("user cannot be nil")
}
// Validate user data
if err := user.Validate(); err != nil {
return nil, fmt.Errorf("invalid user data: %w", err)
}
// Implementation...
return user, nil
}When modifying API definitions:
- Backward compatibility - Maintain backward compatibility when possible
- Field numbering - Never reuse field numbers
- Documentation - Add clear comments for all fields and messages
- Validation - Include validation rules where appropriate
# Run all tests
make test
# Run tests for a specific package
go test ./services/core/...
# Run tests with coverage
go test -cover ./...
# Run tests with verbose output
go test -v ./...- Test coverage - Aim for at least 80% test coverage
- Test naming - Use descriptive test names that explain the scenario
- Test organization - Group related tests using subtests
- Mocking - Use interfaces for testability
func TestUserService_CreateUser(t *testing.T) {
tests := []struct {
name string
user *User
wantErr bool
errString string
}{
{
name: "valid user",
user: &User{Email: "test@example.com", Name: "Test User"},
wantErr: false,
},
{
name: "nil user",
user: nil,
wantErr: true,
errString: "user cannot be nil",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
service := NewUserService()
_, err := service.CreateUser(context.Background(), "tenant1", tt.user)
if tt.wantErr {
assert.Error(t, err)
if tt.errString != "" {
assert.Contains(t, err.Error(), tt.errString)
}
} else {
assert.NoError(t, err)
}
})
}
}- Package comments - Document the purpose of each package
- Function comments - Document exported functions
- Type comments - Document exported types and structs
- Example usage - Provide examples for complex APIs
When adding new API endpoints:
- Update Protocol Buffer definitions with clear comments
- Add API documentation in the service's README
- Include examples of request/response formats
- Document error codes and their meanings
When adding new features:
- Update service README with new functionality
- Add usage examples for new commands or APIs
- Update architecture diagrams if needed
- Document configuration changes
We follow the Conventional Commits specification:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types:
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, etc.)refactor- Code refactoringtest- Adding or updating testschore- Maintenance tasks
Examples:
feat(anchor): add MySQL database adapter
fix(security): validate JWT token expiration
docs(api): update authentication endpoint documentation
test(core): add unit tests for user service
- Create a pull request from your feature branch to
main - Use a descriptive title that summarizes the change
- Fill out the PR template completely
- Link related issues using keywords (e.g., "Fixes #123")
- Request reviews from maintainers
## Description
Brief description of the changes made.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
## Checklist
- [ ] Code follows the style guidelines
- [ ] Self-review of code completed
- [ ] Code is commented, particularly in hard-to-understand areas
- [ ] Corresponding changes to documentation made
- [ ] No new warnings generated
- [ ] Tests added that prove fix is effective or feature works
## Related Issues
Closes #(issue number)- Be respectful and constructive in feedback
- Focus on the code and its impact
- Ask questions when something is unclear
- Suggest improvements when appropriate
- Approve only when satisfied with the changes
- Code follows project standards
- Tests are included and pass
- Documentation is updated
- No security issues introduced
- Performance impact considered
- Backward compatibility maintained (if applicable)
- Respond to all comments - acknowledge feedback
- Make requested changes - update code as needed
- Push updates - commit and push changes to your branch
- Request re-review - when ready for another review
We follow Semantic Versioning (SemVer):
- MAJOR - Breaking changes
- MINOR - New features (backward compatible)
- PATCH - Bug fixes (backward compatible)
- Create release branch from
main - Update version in relevant files
- Update changelog with all changes
- Run full test suite and integration tests
- Create release tag and push to GitHub
- Update documentation for the new release
- Be respectful and inclusive in all communications
- Use clear language and avoid jargon when possible
- Ask questions if something is unclear
- Share knowledge and help other contributors
- Check existing issues before creating new ones
- Search documentation for answers
- Ask in discussions for general questions
- Create detailed issues for bugs or feature requests
Contributors will be recognized in:
- Contributors list on GitHub
- Release notes for significant contributions
- Project documentation for major features
If you have questions or need help with contributing:
- GitHub Issues - For bugs and feature requests
- GitHub Discussions - For questions and general discussion
- Documentation - Check the project wiki and README
- Community Chat - Join our Discord/Slack for real-time help
Thank you for contributing to reDB Node! Your contributions help make this project better for everyone.