Thank you for your interest in contributing to goapps-backend! This document contains guidelines for contributing to the backend microservices repository.
- Getting Started
- Development Environment
- Contribution Workflow
- Pull Request Guidelines
- Code Review Process
- Testing Requirements
- Documentation Standards
- Commit Message Conventions
- Adding a New Service
- Getting Help
Before contributing, make sure you have:
- Go 1.24+ - Download
- Docker & Docker Compose - For local development
- Buf CLI - Protocol buffer management
- golangci-lint v2.3.0 - Code linting
- golang-migrate - Database migrations
- grpcurl - gRPC testing
- VSCode - Recommended editor with Go extension
# Install Go (if not installed)
# See: https://go.dev/doc/install
# Install Buf CLI
go install github.com/bufbuild/buf/cmd/buf@latest
# Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.3.0
# Install golang-migrate
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
# Install grpcurl
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest# Clone with SSH
git clone git@github.com:mutugading/goapps-backend.git
cd goapps-backend
# Or with HTTPS
git clone https://github.com/mutugading/goapps-backend.git
cd goapps-backendRecommended extensions for Go development:
{
"recommendations": [
"golang.go",
"zxh404.vscode-proto3",
"ms-azuretools.vscode-docker",
"streetsidesoftware.code-spell-checker"
]
}cd services/finance
# Start PostgreSQL and Redis
docker compose -f deployments/docker-compose.yaml up -d postgres redis
# Verify services are running
docker compose -f deployments/docker-compose.yaml psexport DATABASE_URL="postgres://finance:finance123@localhost:5434/finance_db?sslmode=disable"
make finance-migrate# From repository root
make finance-run
# Or from service directory
cd services/finance
go run cmd/server/main.go# Check health
curl http://localhost:8080/healthz
# List gRPC services
grpcurl -plaintext localhost:50051 list
# Test gRPC method
grpcurl -plaintext -d '{"code": "KG", "name": "Kilogram"}' \
localhost:50051 finance.v1.UOMService/CreateUOMFor major changes, create an issue first using available templates:
| Template | Usage |
|---|---|
| 🐛 Bug Report | Report bugs |
| ✨ Feature Request | Request features |
| 🚀 New Service | Request new microservice |
# Update main branch
git checkout main
git pull origin main
# Create feature branch
git checkout -b <type>/<service>/<description>
# Examples:
git checkout -b feat/finance/add-uom-export
git checkout -b fix/finance/validate-uom-code
git checkout -b refactor/finance/simplify-repositoryFollow these steps while developing:
# 1. Write code following RULES.md
# 2. Run tests frequently
go test -v -race -short ./...
# 3. Run linter
golangci-lint run ./...
# 4. Fix lint issues
golangci-lint run --fix ./...# Stage changes
git add .
# Commit with conventional message
git commit -m "feat(uom): add bulk import from Excel"
# Push branch
git push origin <branch-name>Create PR via GitHub UI or CLI:
gh pr create --title "feat(uom): add bulk import from Excel" \
--body "## Description
Add ability to import UOMs from Excel file.
## Changes
- Add ImportUOMs RPC method
- Add Excel parsing logic
- Add validation for import data
## Testing
- [x] Unit tests added
- [x] Integration tests added"This repository uses an automatic Pull Request Template.
| Requirement | Description |
|---|---|
| CI Passing | All checks must be green (lint, test, build) |
| Review Approval | Minimum 1 approval from maintainer |
| No Conflicts | Branch must be up-to-date with main |
| Tests Added | New code must have tests |
| Docs Updated | Documentation updated if needed |
| Label | Description |
|---|---|
type: feature |
New feature |
type: bug |
Bug fix |
type: refactor |
Code refactoring |
type: docs |
Documentation |
service: finance |
Finance service |
priority: critical |
Very urgent |
breaking-change |
Contains breaking changes |
For Reviewers:
- Follows Clean Architecture principles
- No circular imports
- Proper error handling
- Structured logging used
- Context passed appropriately
- Unit tests added/updated
- Test coverage adequate
- Edge cases covered
- Mock dependencies properly
- No N+1 queries
- Resources properly closed
- Appropriate caching
- Context timeouts used
- Input validation present
- No hardcoded secrets
- SQL injection prevented
- Sensitive data not logged
| PR Type | SLA | Reviewers |
|---|---|---|
| Hotfix | 2 hours | Any available |
| Bug fix | 24 hours | 1 maintainer |
| Feature | 48 hours | 1-2 maintainers |
| Large refactor | 1 week | 2+ maintainers |
# ✅ Good - Constructive with example
"Consider extracting this validation logic into a separate function
for reusability. Example:
```go
func validateUOMCode(code string) error {
// validation logic
}
```"
# ❌ Not helpful
"This is wrong."| Type | Location | Command |
|---|---|---|
| Unit | internal/*/ |
go test -short ./internal/... |
| Integration | internal/infrastructure/ |
go test ./internal/infrastructure/... |
| E2E | tests/e2e/ |
go test ./tests/e2e/... |
# Unit tests only
go test -v -race -short ./...
# All tests
go test -v -race ./...
# With coverage
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Specific package
go test -v ./internal/domain/uom/...| Layer | Minimum | Target |
|---|---|---|
| Domain | 90% | 95% |
| Application | 80% | 90% |
| Infrastructure | 70% | 80% |
| Delivery | 60% | 70% |
- ✅ Adding new API endpoints
- ✅ Changing existing behavior
- ✅ Adding new configuration options
- ✅ Breaking changes
- ✅ New dependencies
// ✅ Good - Explains WHY
// UseCache is disabled in development to ensure fresh data during testing
UseCache: cfg.App.Env != "development",
// ❌ Bad - States the obvious
// Set UseCache to true
UseCache: true,Document proto files with comments:
// UOMService manages Units of Measure.
service UOMService {
// CreateUOM creates a new unit of measure.
// Returns ALREADY_EXISTS if a UOM with the same code exists.
rpc CreateUOM(CreateUOMRequest) returns (CreateUOMResponse);
}<type>(<scope>): <description>
[optional body]
[optional footer]
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
style |
Formatting, no code change |
refactor |
Code change without new feature or bug fix |
perf |
Performance improvement |
test |
Adding or updating tests |
chore |
Build, deps, config changes |
ci |
CI configuration changes |
# Feature
feat(uom): add bulk import from Excel
- Add ImportUOMs RPC method
- Add Excel parsing with excelize
- Add validation for import data
Closes #123
# Bug fix
fix(uom): handle duplicate code error correctly
The duplicate code error was not being properly mapped to
gRPC ALREADY_EXISTS status code.
Fixes #456
# Breaking change
feat(uom)!: change ID type from string to UUID
BREAKING CHANGE: UOM IDs are now UUIDs instead of strings.
Clients need to update their code to handle UUID format.SERVICE_NAME="newservice"
mkdir -p services/${SERVICE_NAME}/{cmd/server,internal/{domain,application,infrastructure,delivery},pkg,migrations/postgres,tests/{e2e,loadtest},docs,deployments/kubernetes}cd services/${SERVICE_NAME}
go mod init github.com/mutugading/goapps-backend/services/${SERVICE_NAME}Add proto files to goapps-shared-proto:
// newservice/v1/service.proto
syntax = "proto3";
package newservice.v1;
service NewService {
rpc GetItem(GetItemRequest) returns (GetItemResponse);
}cd ../goapps-shared-proto
./scripts/gen-go.shFollow the structure from existing services (e.g., finance).
Create .github/workflows/${SERVICE_NAME}.yml based on finance-service.yml.
Update goapps-infra with Kubernetes manifests and ArgoCD application.
| Channel | Purpose | Response Time |
|---|---|---|
| GitHub Issues | Bug reports, features | 24-48 hours |
| GitHub Discussions | Questions, ideas | 48-72 hours |
| Slack #goapps-backend | Quick questions | Real-time |
- ✅ Search existing issues
- ✅ Read documentation (README, RULES)
- ✅ Check Go documentation
- ✅ Try debugging yourself first
### Environment
- Go version: 1.24.x
- OS: Ubuntu 24.04
- Service: finance
### What I'm trying to do
Clear description of the goal.
### What I've tried
1. Step 1
2. Step 2
3. Step 3
### What happened
Error message or unexpected behavior.
### Expected behavior
What should have happened.
### Code/Logs
\`\`\`go
// Relevant code
\`\`\`
\`\`\`
Relevant logs
\`\`\`- 🤝 Be respectful and inclusive
- 💡 Give constructive feedback
- 📝 Document your changes
- 🔒 Never commit secrets
- ✅ Test before pushing
- 🙋 Ask if unsure
| Name | Role | GitHub |
|---|---|---|
| TBD | Lead Maintainer | @username |
| TBD | Maintainer | @username |
Thank you for contributing to goapps-backend! 🚀