Prabogo Documentation
Welcome to the Prabogo documentation. This guide will help you understand the framework and how to use it effectively in your projects.
Getting Started
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.
Requirements
- Go version >= 1.24.0
- Docker and Docker Compose (optional, for running external services)
fzf(optional, for enhanced interactive command selection)
Installation
# Install the installer tool
go install github.com/prabogo/prabogo-install@latest
# Create a new project
prabogo-install my-project-name
# Setup the project
cd my-project-name
cp .env.example .env
go mod tidy
docker-compose up -d
Running the Application
You have several options to run your Prabogo application:
# Using the interactive command selector
make run
# Running in HTTP server mode
make http
# Running in message consumer mode
make message SUB=upsert_client
# Executing a specific command
make command CMD=publish_upsert_client VAL=name
# Running directly without Makefile
go run cmd/main.go http
Architecture
Prabogo uses Hexagonal Architecture (also known as Ports and Adapters pattern) to keep the business logic separate from external dependencies like databases, UI frameworks, and messaging systems.
Key Components
- Port: Interface defining how the application communicates with the outside world.
- Adapter: Component implementing a port to connect external systems or technologies to the core.
- Domain: Core business logic and rules, independent of external systems or frameworks.
- Application: Layer that coordinates activities and orchestrates domain logic.
This architecture allows you to:
- Replace infrastructure components with minimal changes
- Test business logic in isolation
- Develop features without being constrained by external dependencies
- Maintain a clean separation of concerns
Makefile Commands
Prabogo provides 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 run
Code Generation Commands
-
make model VAL=nameCreates a model/entity with necessary structures
-
make migration-postgres VAL=nameCreates a PostgreSQL migration file
-
make inbound-http-fiber VAL=nameCreates HTTP handlers using Fiber framework
-
make inbound-message-rabbitmq VAL=nameCreates RabbitMQ message consumers
-
make inbound-command VAL=nameCreates command line interface handlers
-
make inbound-workflow-temporal VAL=nameCreates Temporal workflow worker
-
make outbound-database-postgres VAL=nameCreates PostgreSQL database adapter
-
make outbound-http VAL=nameCreates HTTP adapter
-
make outbound-message-rabbitmq VAL=nameCreates RabbitMQ message publisher adapter
-
make outbound-cache-redis VAL=nameCreates Redis cache adapter
-
make outbound-workflow-temporal VAL=nameCreates Temporal workflow starter adapter
-
make generate-mocksGenerates mock implementations from all go:generate directives in registry files
Runtime Commands
-
make buildBuilds the Docker image for the application
-
make httpRuns the application in HTTP server mode inside Docker
-
make message SUB=upsert_clientRuns the application in message consumer mode inside Docker
-
make command CMD=publish_upsert_client VAL=nameExecutes a specific command in the application
-
make workflow WFL=upsert_clientRuns the application in workflow worker mode inside Docker
Development Workflow
A typical development workflow in a Prabogo project follows these steps:
-
Create Models
Define your domain models that represent your business entities:
make model VAL=product -
Create Database Migrations
Define database schema for your models:
make migration-postgres VAL=product -
Implement Domain Logic
Add your business logic in the domain layer, focusing on the core functionality without external dependencies.
-
Create Inbound Adapters
Create adapters for handling incoming requests:
# For HTTP endpoints make inbound-http-fiber VAL=product # For message consumers make inbound-message-rabbitmq VAL=product # For CLI commands make inbound-command VAL=product # For Temporal workflows make inbound-workflow-temporal VAL=product -
Create Outbound Adapters
Create adapters for external dependencies:
# For database access make outbound-database-postgres VAL=product # For HTTP clients make outbound-http VAL=product_api # For cache make outbound-cache-redis VAL=product # For Temporal workflows make outbound-workflow-temporal VAL=product -
Write Tests
Write tests for your domain logic and generate mocks for your ports:
make generate-mocks -
Run the Application
Start your application in the appropriate mode:
# Start your application in the appropriate mode: make http # Or run in workflow worker mode make workflow WFL=product_workflow
Code Generation
Prabogo provides powerful code generation capabilities to streamline development. When you use the Makefile commands to generate code, Prabogo creates:
- Appropriate interfaces (ports) in the port directory
- Implementation files in the adapter directory
- Necessary registrations in registry files
- Tests and mocks as needed
This ensures consistency across your codebase and reduces the boilerplate code you need to write.
Testing
Prabogo promotes writing unit tests for your domain logic. The hexagonal architecture makes it easy to test your business logic in isolation by mocking external dependencies.
Running Tests
# Run unit tests
go test -cover ./internal/domain/...
# Generate coverage report
go test -coverprofile=coverage.profile -cover ./internal/domain/...
go tool cover -html coverage.profile -o coverage.html
# Check for intermittent test failures
retry -d 0 -t 100 -u fail -- go test -coverprofile=coverage.profile -cover ./internal/domain/... -count=1
Deployment
Prabogo projects come with Docker support out of the box, making deployment straightforward:
Building a Docker Image
make build
Deployment Options
You can deploy your Prabogo application in various ways:
- Docker Compose: Ideal for development and simple deployments
- Kubernetes: For container orchestration in production
- Cloud Platforms: Deploy to AWS, GCP, or Azure with their respective container services
AI Agents for Development
Prabogo includes three specialized AI agents designed to streamline your development workflow by breaking down complex tasks into manageable steps while following hexagonal architecture principles.
🔍 Clarifier Agent
Purpose: Understands and defines problems clearly before any solution is discussed.
Usage: Reference @.github/agents/prabogo_clarifier.agent.md when you need to:
- Clarify vague requirements
- Define problem scope and boundaries
- Identify which Prabogo components are involved
- Establish measurable success criteria
📋 Task Designer Agent
Purpose: Breaks down clarified problems into executable, reviewable tasks following Prabogo's architecture.
Usage: Reference @.github/agents/prabogo_task_designer.agent.md when you need to:
- Create task breakdowns from problem definitions
- Plan development work with proper dependencies
- Design tasks that respect hexagonal architecture boundaries
- Reference appropriate Makefile targets for code generation
⚡ Executor Agent
Purpose: Executes tasks precisely as designed without changing scope or adding features.
Usage: Reference @.github/agents/prabogo_executor.agent.md when you need to:
- Implement tasks exactly as specified
- Follow Definition of Done criteria strictly
- Execute one task at a time with proper completion validation
- Maintain focus on requirements without scope creep
Quick Start with Agents
Follow this three-step workflow to ensure clear requirements, proper planning, and precise execution while maintaining Prabogo's architectural integrity:
# 1. Start with Clarifier
@prabogo_clarifier.agent.md "I want to add user authentication"
# 2. Design Tasks (use clarifier output)
@prabogo_task_designer.agent.md
# 3. Execute Tasks (use task designer output)
@prabogo_executor.agent.md
Best Practices
Project Structure
Follow the provided directory structure to maintain a clean organization:
cmd/: Application entry pointsinternal/: Application code not meant to be imported by other projectsdomain/: Core business logic and rulesport/: Interfaces defining how the application communicatesadapter/: Implementations of the ports connecting to external systemsmodel/: Data structures and entitiesmigration/: Database migration scripts
utils/: Utility functions and helperstests/: Test helpers and mocks
Domain-Driven Design
Prabogo works well with DDD principles:
- Keep business logic in the domain layer
- Use domain models to represent business entities
- Define clear boundaries between different domains
- Use domain events for communication between domains
Testing
- Write unit tests for all domain logic
- Use mocks for external dependencies
- Aim for high test coverage of domain code
- Consider integration tests for adapter implementations