π° Finsplitter
Financial expense splitting application built with Go

π Quick Start
Using Docker (Recommended)
Pull the image from GitHub Container Registry:
# Specific version
docker pull ghcr.io/muriiloandrade/finsplitter:v0.1.0
Run with docker-compose:
# Start infrastructure and application
make start-dev
# Start in debug mode (with Delve debugger)
make start-debug
# Stop everything
make stop-dev
π³ Available Images
| Tag Pattern |
Description |
Platforms |
Build Trigger |
v*.*.* |
Specific version releases |
linux/amd64, linux/arm64 |
Release publication |
pr-* |
Pull request builds |
linux/amd64 |
Pull requests |
π οΈ Development
Prerequisites
- Go 1.25+
- Docker & Docker Compose
- PostgreSQL 18+ (via Docker)
Local Setup
# Clone repository
git clone https://github.com/muriiloandrade/finsplitter.git
cd finsplitter
# Copy and configure environment variables
cp .env.example .env
# Edit .env with your settings
# Install development tools (lefthook and dlv)
make tools
# Start development environment
make start-dev
Available Make Commands
π¨ Development
make start-infra # Start database only
make start-dev # Start full development environment
make start-debug # Start with debugging enabled (Delve)
make stop-dev # Stop development environment
make stop-infra # Stop infrastructure only
π Observability
make start-monitoring # Start Grafana stack (Tempo, Loki, Prometheus, OTel Collector)
make stop-monitoring # Stop observability stack
Access Points:
π§ͺ Code Quality & Testing
make code-check # Run linters and formatters
make format # Format code only
make lint # Lint code only
make test # Run unit tests
make docker-scout # Security scan production image
ποΈ Code Generation
make generate # Generate code (SQLC + mocks)
make generate-sqlc # Generate SQLC code only
make generate-mocks # Generate mock files only
ποΈ Database
make new-migration name=<name> # Create new migration
make migrate-up [n=<steps>] # Apply migrations (default: all)
make migrate-down [n=<steps>] # Rollback migrations (default: all)
π³ Build & Deploy
make build # Build production Docker image
make clean # Remove production Docker image
make run-network-host # Run with host network
make run-network-compose # Run with compose network
ποΈ Architecture
This project follows Clean Architecture principles with Hexagonal/Ports-and-Adapters pattern:
internal/domain/entity: Core business entities (CardBrand, Person, Card)
internal/app/ports: Repository interfaces defining data contracts
internal/app/usecases: Business logic orchestration (e.g., card-brand/create_card_brand.go)
internal/gateways/postgres: Database implementation using pgx/v5 and SQLC
internal/gateways/http/v1: HTTP handlers using Huma v2 framework
Key Features
- π Transaction Management: Context-aware with
domain.Transactioner
- π§ SQLC Integration: Type-safe database access from SQL queries
- π§ͺ Comprehensive Testing: Testify/mock with table-driven tests
- π¦ Dependency Injection: Manual DI with clear boundaries
- π OpenAPI: Auto-generated docs with Huma v2
- π Observability: OpenTelemetry tracing, metrics, and logs with Jaeger
π§ Configuration
Environment variables example provided as .env.example.
OpenTelemetry Configuration
Finsplitter supports OpenTelemetry for distributed tracing, metrics, and logs:
| Variable |
Description |
Default |
OTEL_ENABLED |
Enable OpenTelemetry instrumentation |
false |
OTEL_SERVICE_NAME |
Service name for telemetry |
Uses APP_NAME |
OTEL_EXPORTER_OTLP_ENDPOINT |
OTLP HTTP endpoint |
http://localhost:4318 |
OTEL_INSECURE |
Use insecure connection |
true |
OTEL_ENABLE_TRACES |
Enable trace collection |
true |
OTEL_ENABLE_METRICS |
Enable metrics collection |
true |
OTEL_ENABLE_LOGS |
Enable log export |
true |
OTEL_SAMPLER_RATIO |
Trace sampling ratio (0.0-1.0) |
1.0 |
Automatic Instrumentation:
- β
HTTP requests (via
otelchi middleware)
- β
PostgreSQL queries (via
otelpgx tracer)
- β
Application logs (via
otelslog bridge)
π API Documentation
Once the application is running, access:
- OpenAPI Spec:
http://localhost:3033/openapi.{json,yaml}
- Interactive Docs:
http://localhost:3033/docs
- Health Checks:
- Liveness:
http://localhost:3033/health/liveness
- Readiness:
http://localhost:3033/health/readiness
Current Endpoints
GET /card-brands - List card brands
POST /card-brands - Create card brand
GET /card-brands/{id} - Get card brand by ID
PATCH /card-brands/{id} - Update card brand
DELETE /card-brands/{id} - Delete card brand
π CI/CD Pipeline
Automated Workflows
| Workflow |
Trigger |
Purpose |
| CI |
Push to main, PRs |
Quality checks, testing, Docker build |
| Release |
Release published |
Multi-arch production builds, security scans |
| Security |
Push, PRs |
Vulnerability scanning, SARIF reports |
| Quality |
Via CI |
Code formatting, linting (golangci-lint) |
| Test |
Via CI |
Unit tests with coverage |
Release Process
- Development: Work in feature branches, create PR
- Auto-labeling: PRs automatically labeled using conventional commits
- CI Pipeline: Quality checks + Docker build on PR merge
- Release Draft: Auto-generated using Release Drafter
- Production Release: Publish release β triggers multi-arch builds
Container Security
All images include:
- β
Multi-arch support (amd64, arm64)
- β
Distroless base (minimal attack surface)
- β
SBOM generation (Software Bill of Materials)
- β
Provenance attestation (Build provenance)
- β
Trivy security scanning (Vulnerability reports)
- β
Non-root execution (Security hardening)
π οΈ Development Workflow
Adding New Entities
To add a new entity (e.g., "Transaction"):
- Migration:
make new-migration name=create_table_transaction
- SQL Queries: Write in
internal/gateways/postgres/sqlc/queries/transaction.sql
- Generate Code:
make generate-sqlc
- Domain Entity:
internal/domain/entity/transaction.go
- Repository Interface:
internal/app/ports/transaction_repo.go
- Repository Implementation:
internal/gateways/postgres/transaction.go
- Use Cases:
internal/app/usecases/transaction/
- HTTP Handlers:
internal/gateways/http/v1/transaction/
- Wire Dependencies:
cmd/api/main.go
- Generate Mocks & Tests:
make generate-mocks
Pre-commit Hooks
Lefthook automatically runs quality checks:
- Code formatting and linting via
make code-check
- Configured in
lefthook.yml
π€ Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feat/amazing-feature)
- Commit using Conventional Commits:
feat: for new features
fix: for bug fixes
chore: for maintenance
- Push to the branch (
git push origin feat/amazing-feature)
- Open a Pull Request (auto-labeled by conventional commit type)
π License
This project is licensed under the MIT License - see the LICENSE file for details.