Event-driven workflow orchestration engine for coordinating multi-step business processes with automatic retries, state persistence, and rollback logic. Built with Go.
Relay helps you build reliable workflows that survive failures. Think of it as the conductor that makes sure all parts of a complex operation happen in the right order, with the right data, even when things break.
Every company has complex processes:
- Fintech: KYC verification → payment processing → settlement
- E-commerce: Order → inventory check → payment → shipping → notifications
- Logistics: Pickup → driver assignment → route optimization → delivery
Without Relay, you're writing:
- Retry logic everywhere
- Manual failure handling
- State tracking across services
- Race condition debugging
With Relay, you get:
- ✅ Durable execution (workflows survive crashes)
- ✅ Automatic retries (network failed? Try again)
- ✅ State persistence (remembers exactly where it stopped)
- ✅ Rollback on failure (auto-undo completed steps)
- ✅ Human approvals (pause for manual review)
- ✅ Event sourcing (complete audit trail)
Define a workflow in YAML:
name: loan_approval
steps:
- id: check_credit
service: credit_api
endpoint: /check
retry: 3
timeout: 30s
- id: verify_employment
service: employment_api
endpoint: /verify
depends_on: check_credit
- id: manual_review
type: human_approval
condition: credit_score < 650
timeout: 24h
- id: disburse_funds
service: payment_api
endpoint: /disburse
depends_on: [verify_employment, manual_review]
compensate: refund_payment
compensations:
- id: refund_payment
service: payment_api
endpoint: /refundWhat Relay does automatically:
- Retries network failures (3 attempts with backoff)
- Waits for dependencies (Step B waits for Step A)
- Pauses for human approval
- Rolls back on failure (refunds payment if shipping fails)
- Tracks every state change
- Language: Go 1.23
- Web Framework: Gin
- Database: PostgreSQL (workflow state)
- Queue: Redis (async execution)
- Scheduling: Cron (time-based triggers)
- Go 1.23+
- Docker & Docker Compose
- PostgreSQL 15+
# Clone the repository
git clone https://github.com/vicodevv/relay.git
cd relay
# Install dependencies
go mod download
# Setup environment
cp .env.example .env
# Start PostgreSQL and Redis
docker-compose up -d
# Run the server
go run cmd/server/main.goThe API runs at http://localhost:8080
# Health check
curl http://localhost:8080/api/v1/health
# Create workflow definition
curl -X POST http://localhost:8080/api/v1/workflows/definitions \
-H "Content-Type: application/json" \
-d '{
"name": "loan_approval",
"steps": [
{
"id": "check_credit",
"service": "credit_api",
"endpoint": "/check",
"retry": 3
}
]
}'
# Start a workflow
curl -X POST http://localhost:8080/api/v1/workflows \
-H "Content-Type: application/json" \
-d '{
"definition_name": "loan_approval",
"input": {"loan_id": "L123", "amount": 50000}
}'relay/ ├── cmd/ │ ├── server/main.go # HTTP server │ ├── worker/main.go # Workflow worker (coming soon) │ └── cli/main.go # CLI tool (coming soon) ├── internal/ │ ├── engine/ # Workflow execution engine (coming soon) │ ├── storage/ # PostgreSQL repository │ ├── queue/ # Redis queue (coming soon) │ ├── http/ # API handlers │ └── scheduler/ # Cron triggers (coming soon) ├── pkg/ │ └── workflow/ # Workflow definitions ├── workflows/ # Example YAML files ├── migrations/ # SQL schemas └── docker/
A YAML file that describes the steps in a process.
A running execution of a workflow definition.
A single unit of work (API call, database query, etc.).
Workflows transition through states: PENDING → RUNNING → COMPLETED (or FAILED).
After each step, state is saved to PostgreSQL. On server restart, incomplete workflows resume automatically.
Instead of storing current state only, Relay stores ALL events (workflow_started, step_completed, etc.) for complete audit trail.
When a step fails, run compensations in REVERSE order to undo completed work.
Workflows can pause for manual approval, then resume when approved.
POST /api/v1/workflows/definitions- Create workflow definition
POST /api/v1/workflows- Start a workflowGET /api/v1/workflows/:id- Get workflow statusGET /api/v1/workflows- List all workflowsGET /api/v1/workflows/:id/events- Get workflow event history
GET /api/v1/health- Health check
- Workflow definitions
- Workflow instances
- Event sourcing
- REST API
- Step executor
- Retry handler
- State machine
- HTTP client for service calls
- Human approvals
- Compensation/rollback
- Parallel execution
- Cron scheduling
- Visual dashboard
- Fintech: Payment processing, KYC verification, loan approvals
- E-commerce: Order fulfillment, inventory management, refunds
- Logistics: Delivery coordination, driver assignment, route optimization
- SaaS: User onboarding, subscription management, billing
vs Temporal:
- Simpler (YAML vs complex SDK)
- Lighter (single binary vs cluster)
- African-friendly (works with flaky networks)
vs Airflow:
- Real-time (not just batch/scheduled)
- Built for APIs (not just data pipelines)
- Easier to deploy
# Run server
go run cmd/server/main.go
# Run tests (coming soon)
go test ./...
# Build binary
go build -o relay cmd/server/main.goAPP_PORT=8080
DB_HOST=localhost
DB_PORT=5433
DB_USER=relay
DB_PASSWORD=relay123
DB_NAME=relay_db
REDIS_HOST=localhost
REDIS_PORT=6380Contributions welcome! Open issues or PRs.
MIT License