Aryma-f4/mana-mbg-wok
Prabogo is a Go framework designed to simplify project development by providing an interactive command interface and built-in instructions for AI assistance.
Prabogo
Prabogo is a Go framework designed to simplify project development by providing an interactive command interface and built-in instructions for AI assistance. This framework streamlines common engineering tasks, making it easier for software engineers to scaffold, generate, and manage project components efficiently. With Prabogo, developers benefit from automation and intelligent guidance, accelerating the software development process.
Design Docs
Requirement
- go version >= go1.23.0
Before running the app, copy the example environment file:
cp .env.example .envStart External Services with Docker Compose
docker-compose up -dStop External Services with Docker Compose
docker-compose downRun App in Development Mode
To run the application directly (without Makefile or Docker), ensure all required environment variables are set. You can use a .env file or export them manually.
Start the app with:
go run cmd/main.go <option>Replace <option> with any command-line arguments your application supports. For example:
go run cmd/main.go httpMake sure external dependencies (such as PostgreSQL, RabbitMQ, and Redis) are running, either via Docker Compose or another method.
Makefile Commands
The project includes a comprehensive Makefile with various helpful commands for code generation and development tasks.
Interactive Command Runner
You can use the interactive target selector to choose and run Makefile targets:
make runThis will display an interactive menu to select a Makefile target and will prompt for any required parameters. The selector works in two modes:
- If
fzfis installed: Uses a fuzzy-search interactive selector (recommended for best experience) - If
fzfis not available: Falls back to a basic numbered menu selection
To install fzf (optional):
- macOS:
brew install fzf - Linux:
apt install fzf(Ubuntu/Debian) ordnf install fzf(Fedora) - Windows: With chocolatey:
choco install fzfor with WSL, follow Linux instructions
Common Makefile Targets
Code Generation Targets
-
model: Creates a model/entity with necessary structures (requires VAL parameter)make model VAL=name
-
migration-postgres: Creates a PostgreSQL migration file (requires VAL parameter)make migration-postgres VAL=name
-
inbound-http-fiber: Creates HTTP handlers using Fiber framework (requires VAL parameter)make inbound-http-fiber VAL=name
-
inbound-message-rabbitmq: Creates RabbitMQ message consumers (requires VAL parameter)make inbound-message-rabbitmq VAL=name
-
inbound-command: Creates command line interface handlers (requires VAL parameter)make inbound-command VAL=name
-
outbound-database-postgres: Creates PostgreSQL database adapter (requires VAL parameter)make outbound-database-postgres VAL=name
-
outbound-http: Creates HTTP adapter (requires VAL parameter)make outbound-http VAL=name
-
outbound-message-rabbitmq: Creates RabbitMQ message adapter (requires VAL parameter)make outbound-message-rabbitmq VAL=name
-
outbound-cache-redis: Creates Redis cache adapter (requires VAL parameter)make outbound-cache-redis VAL=name
-
generate-mocks: Generates mock implementations from all go:generate directives in registry filesmake generate-mocks
Runtime Targets
-
build: Builds the Docker image for the applicationmake build # Force rebuild regardless of existing image: make build BUILD=true -
http: Runs the application in HTTP server mode inside Dockermake http # Force rebuild before running: make http BUILD=true -
message: Runs the application in message consumer mode inside Docker (requires SUB parameter)make message SUB=upsert_client # Force rebuild before running: make message SUB=upsert_client BUILD=true -
command: Executes a specific command in the application (requires CMD and VAL parameters)make command CMD=publish_upsert_client VAL=name # Force rebuild before running: make command CMD=publish_upsert_client VAL=name BUILD=true
Running test suite
Unit tests
go test -cover ./internal/domain/...To generate coverage report:
go test -coverprofile=coverage.profile -cover ./internal/domain/...
go tool cover -html coverage.profile -o coverage.htmlCoverage report will be available at coverage.html
To check intermittent test failure due to mock. when in doubt, use -t 1000
retry -d 0 -t 100 -u fail -- go test -coverprofile=coverage.profile -cover ./internal/domain/... -count=1License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Moch Dieqy Dzulqaidar
