Skip to content

Contributing

Thank you for your interest in contributing to Rack Gateway! This guide covers everything you need to know to submit quality contributions.

  1. Fork the repository

    Fork docspring/rack-gateway on GitHub.

  2. Clone your fork

    Terminal window
    git clone https://github.com/YOUR_USERNAME/rack-gateway.git
    cd rack-gateway
  3. Set up development environment

    Follow the Local Setup guide.

  4. Create a branch

    Terminal window
    git checkout -b feature/your-feature-name
  1. Check existing issues - See if your feature/bug is already being worked on
  2. Open an issue - For significant changes, discuss the approach first
  3. Keep scope small - Focused PRs are easier to review
Terminal window
# Make your changes, then verify:
# 1. Run linting (with auto-fix)
task lint:fix
# 2. Run tests
task go:test
task web:test
# 3. Run full CI suite
task ci
  1. All tests pass - task ci must complete successfully
  2. Code is formatted - Run task lint:fix
  3. Commit messages are clear - Follow commit conventions below
  4. Documentation is updated - For new features or changes
  • Follow Effective Go guidelines
  • Use gofmt and goimports (handled by task lint:fix)
  • Maximum line length: 120 characters
  • Maximum function length: 100 lines
// Good: Clear, descriptive names
func CreateUserSession(user *User) (*Session, error)
func ValidateAPIToken(token string) (*Token, error)
// Bad: Unclear abbreviations
func CrtUsrSess(u *User) (*Session, error)
// Good: Wrap errors with context
if err := db.Query(query); err != nil {
return fmt.Errorf("failed to fetch user %s: %w", userID, err)
}
// Bad: Generic error messages
if err := db.Query(query); err != nil {
return err
}
// Good: Explain WHY, not WHAT
// UseRoundRobin distributes load across servers to prevent
// any single server from being overwhelmed during peak traffic.
func UseRoundRobin() LoadBalancer { ... }
// Bad: Restating the code
// GetUser gets a user
func GetUser(id string) *User { ... }
  • Use Biome for formatting and linting
  • Prefer functional components with hooks
  • Use TypeScript strict mode
// Good: Clear component organization
interface Props {
user: User;
onLogout: () => void;
}
export function UserMenu({ user, onLogout }: Props) {
const [isOpen, setIsOpen] = useState(false);
return (
<div className="user-menu">
{/* Component content */}
</div>
);
}
// Good: Use React Query for data fetching with error handling
const { data, error, isLoading } = useQuery({
queryKey: ['user', userId],
queryFn: () => fetchUser(userId),
});
if (error) {
return <ErrorMessage error={error} />;
}
File TypeMax Lines
Go code files500 lines
Go test files1000 lines
TypeScript/TSX code500 lines
TypeScript test files1000 lines

If a file approaches these limits, refactor into smaller modules.

type(scope): short description
Longer description if needed.
TypeDescription
featNew feature
fixBug fix
docsDocumentation only
styleFormatting, no code change
refactorCode restructuring
testAdding/updating tests
choreMaintenance tasks
Terminal window
feat(auth): add WebAuthn support for passwordless login
fix(proxy): handle timeout errors gracefully
docs(readme): update installation instructions
refactor(rbac): extract permission checking to separate module

Use the same format as commit messages:

feat(auth): add WebAuthn support

Include:

  1. Summary - What does this PR do?
  2. Motivation - Why is this change needed?
  3. Testing - How was this tested?
  4. Screenshots - For UI changes
## Summary
Brief description of what this PR does.
## Motivation
Why is this change needed?
## Changes
- Change 1
- Change 2
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] E2E tests pass
- [ ] Manual testing completed
## Screenshots (if applicable)
  1. Automated checks - CI must pass
  2. Code review - At least one maintainer approval
  3. Documentation - Updates if needed
  4. Merge - Squash and merge with clean commit message

Email security concerns to: security@docspring.com

  1. Input Validation

    • Validate all user input
    • Use parameterized queries (never string concatenation)
    • Sanitize output for XSS prevention
  2. Authentication

    • Never log sensitive data (tokens, passwords)
    • Use constant-time comparison for secrets
    • Implement rate limiting on auth endpoints
  3. Dependencies

    • Keep dependencies updated
    • Review security advisories
    • Run govulncheck and npm audit
  • New features must include tests
  • Bug fixes should include regression tests
  • Aim for meaningful coverage, not just line coverage
Change TypeRequired Tests
New API endpointUnit + Integration + E2E
Bug fixRegression test
UI componentUnit test + E2E (if user-facing)
RefactoringExisting tests must pass
  • New features
  • Changed behavior
  • New configuration options
  • API changes
ContentLocation
API docsOpenAPI spec in Go handlers
User guidesdocs/src/content/docs/
Code docsInline comments
Architecturedocs/src/content/docs/concepts/
  • GitHub Issues - Bug reports, feature requests
  • GitHub Discussions - Questions, ideas
  • Pull Requests - Code review, feedback

By contributing, you agree that your contributions will be licensed under the project’s license.

Contributors are recognized in:

  • GitHub contributors list
  • Release notes for significant contributions
  • Project documentation

Thank you for contributing to Rack Gateway!