Thank you for your interest in contributing to SatGate! This document provides guidelines and instructions for contributing.
By participating in this project, you agree to abide by our Code of Conduct. Please be respectful and constructive in all interactions.
- Bug Reports: Use the bug report template
- Feature Requests: Use the feature request template
- Security Issues: Email security@satgate.io (do not open public issues)
- Fork the repository and create your branch from
main - Write tests for any new functionality
- Follow the code style (run
go fmtandgo vet) - Update documentation if needed
- Submit a PR with a clear description
# Clone your fork
git clone https://github.com/YOUR_USERNAME/satgate.git
cd satgate
# Add upstream remote
git remote add upstream https://github.com/satgate-io/satgate.git
# Install dependencies
go mod download
# Run tests
go test ./...
# Run linter
go vet ./...
golangci-lint run
# Build
go build -o satgate ./cmd/satgate# Start with example config
./satgate --config examples/gateway.yaml
# Test health endpoint
curl http://localhost:8080/health- Follow Effective Go guidelines
- Use
go fmtfor formatting - Use
go vetandgolangci-lintfor linting - Write tests for all new code
- Keep functions focused and small
Follow Conventional Commits:
feat: add new capability caveat type
fix: resolve macaroon verification edge case
docs: update quickstart guide
test: add integration tests for L402
refactor: simplify proxy middleware
- Title: Use conventional commit format
- Description: Explain what and why, not just how
- Tests: Include tests for new functionality
- Docs: Update relevant documentation
- Size: Keep PRs focused and reviewable (<500 lines ideal)
satgate/
├── cmd/satgate/ # Main entrypoint
├── internal/
│ ├── proxy/ # Core HTTP proxy
│ ├── config/ # Configuration loading
│ ├── macaroon/ # Capability token handling
│ ├── governance/ # Ban lists, revocation
│ └── lightning/ # L402 payment providers
├── sdk/ # Client SDKs
├── docs/ # Documentation
└── examples/ # Example configurations
// Policy enforcement
type PolicyHandler interface {
Handle(w http.ResponseWriter, r *http.Request, route *Route)
}
// Lightning provider
type LightningProvider interface {
CreateInvoice(ctx context.Context, sats int64, memo string) (*Invoice, error)
VerifyPayment(ctx context.Context, preimage string) (bool, error)
}# All tests
go test ./...
# With coverage
go test -cover ./...
# Specific package
go test ./internal/proxy/...
# Integration tests (requires Docker)
go test -tags=integration ./...func TestMacaroonVerification(t *testing.T) {
// Arrange
svc := macaroon.New(testRootKey)
mac, _ := svc.Mint(macaroon.MintOptions{
Scope: "api:read",
})
// Act
verified, err := svc.Verify(mac)
// Assert
require.NoError(t, err)
assert.True(t, verified.HasScope("api:read"))
}- Update README.md for user-facing changes
- Update docs/ for detailed documentation
- Add godoc comments for exported functions
- Include examples in documentation
Releases are managed by maintainers:
- Update CHANGELOG.md
- Tag release:
git tag v1.2.3 - Push tag:
git push origin v1.2.3 - GitHub Actions builds and publishes
- Questions: Open a Discussion
- Bugs: Open an Issue
- Chat: Join our Discord
Contributors are recognized in:
- CONTRIBUTORS.md
- Release notes
- Project README
Thank you for contributing to SatGate! 🎉