flow-system is the foundational library for all Flow microservices. it provides standardized configuration management, database connectivity, response structures, and common utilities to ensure consistency across the distributed architecture.
To install the package in your Go project:
go get github.com/factory24/flow-systemProvides a BaseConfig interface and implementation to handle environment variables using godotenv. It includes helper methods for:
- Environment detection (Production, Development, Testing)
- Database configuration retrieval
- Sentry and Keycloak settings
- Logging levels and standardized
sloginstances
Usage:
import "github.com/factory24/flow-system/pkg/config"
cfg := config.NewBaseConfig()
cfg.LoadEnv()
port := cfg.GetAppPort()A wrapper around GORM that supports both SQLite and PostgreSQL. It includes automatic connection retries with exponential backoff and automated migrations.
Usage:
import "github.com/factory24/flow-system/pkg/database"
db := database.NewGormDatabase(cfg, models)
db.Connect()
engine := db.GetEngine()Standardizes JSON responses for all microservices.
ApiResponse[T]: Standard success response.ErrorResponse: Standard error response.Event[T]: Generic structure for events (Pulsar/ServiceBus).NewCSVExport: Helper for streaming CSV exports via Echo.
Standardized Echo middleware, including logging and recovery, tailored for the Flow ecosystem.
Common data structures and helper functions (e.g., string manipulation, validation) used across multiple services.
- Framework: Use Echo v4 for all web services.
- Logging: Standardized via
slogandecho/middleware/logger. - Validation: Ensure
go build ./...succeeds before pushing changes.