Bricks
Bricks is a framework of reusable components for Go, providing ready-to-use building blocks with native Uber FX support.
Installation
go get github.com/cristiano-pacheco/bricks@latest
Available Modules
Config
Configuration management with YAML files, environment variable overrides, and Uber FX support.
- Location:
pkg/config
- Import:
github.com/cristiano-pacheco/bricks/pkg/config
- Documentation: pkg/config/README.md
Database
PostgreSQL database connection module with GORM and Uber FX integration.
- Location:
pkg/database
- Import:
github.com/cristiano-pacheco/bricks/pkg/database
- Documentation: pkg/database/README.md
Errors
Structured error handling with HTTP status codes.
- Location:
pkg/errs
- Import:
github.com/cristiano-pacheco/bricks/pkg/errs
HTTP Request
High-performance JSON request parser with built-in security features for Go HTTP handlers.
HTTP Response
Optimized JSON response helpers for Go HTTP handlers with high performance and minimal allocations.
HTTP Server - Chi
Robust HTTP server implementation using Chi router with CORS and Uber FX support.
i18n
Internationalization package with locale loading, translation lookups, template interpolation, and error translation with Uber FX integration.
- Location:
pkg/i18n
- Import:
github.com/cristiano-pacheco/bricks/pkg/i18n
- Documentation: pkg/i18n/README.md
Integration Test Kit
Integration test infrastructure for Docker containers (PostgreSQL and Redis) with automatic cleanup.
- Location:
pkg/itestkit
- Import:
github.com/cristiano-pacheco/bricks/pkg/itestkit
- Documentation: pkg/itestkit/README.md
Logger
Structured logging with slog and Uber FX integration.
- Location:
pkg/logger
- Import:
github.com/cristiano-pacheco/bricks/pkg/logger
- Documentation: pkg/logger/README.md
Metrics
Prometheus-based metrics collection for use case execution tracking with Uber FX integration.
- Location:
pkg/metrics
- Import:
github.com/cristiano-pacheco/bricks/pkg/metrics
- Documentation: pkg/metrics/README.md
Migration
Database migration package with co-located, per-module SQL migration support using embedded filesystems and golang-migrate, with Uber FX integration.
- Location:
pkg/migration
- Import:
github.com/cristiano-pacheco/bricks/pkg/migration
- Documentation: pkg/migration/README.md
OpenTelemetry Trace
Simple and powerful OpenTelemetry tracing integration for Go applications.
- Location:
pkg/otel/trace
- Import:
github.com/cristiano-pacheco/bricks/pkg/otel/trace
- Documentation: pkg/otel/trace/README.md
Paginator
Pagination utilities for handling pagination parameters in HTTP requests with validation and metadata generation.
- Location:
pkg/paginator
- Import:
github.com/cristiano-pacheco/bricks/pkg/paginator
- Documentation: pkg/paginator/README.md
Redis
Redis client with connection pooling and Uber FX support.
- Location:
pkg/redis
- Import:
github.com/cristiano-pacheco/bricks/pkg/redis
- Documentation: pkg/redis/README.md
Use Case Decorator
Decorator pattern for use cases providing automatic logging, metrics, tracing, and error translation with Uber FX integration.
- Location:
pkg/ucdecorator
- Import:
github.com/cristiano-pacheco/bricks/pkg/ucdecorator
- Documentation: pkg/ucdecorator/README.md
Validator
Struct validation with go-playground/validator and Uber FX integration.
- Location:
pkg/validator
- Import:
github.com/cristiano-pacheco/bricks/pkg/validator
- Documentation: pkg/validator/README.md
License
MIT