GoBandit is a pet project, an experimentation engine that implements Thompson Sampling for intelligent A/B testing at scale. Built with Go, with a frontend written using HTMX, Templ and Tailwind, and PostgreSQL storage. It provides a clean, performant API for managing multiple concurrent experiments with sophisticated exploration/exploitation strategies.
Start PostgreSQL:
docker compose up -d postgresStart server:
go run main.goGo to http://localhost:8080
POST /tests
Create a new A/B test with multiple arms
GET /tests/{testID}/arm
Get next arm using Thompson Sampling
POST /tests/{testID}/arms/{armID}/result
Record result for an arm pull
GET /tests/{testID}
Get test statistics and configuration- Time Complexity: O(n) for arm selection where n is number of arms (typically small)
- Space Complexity: O(1) per request
- Database:
- Single query for arm selection
- Single-row updates for result recording
- Proper indexing for O(1) lookups
curl -X POST \
http://localhost:8080/tests \
-H 'Content-Type: application/json' \
-d '{
"name": "Random Test Name",
"description": "This is a randomly generated test",
"arms": [
{
"name": "Arm A",
"description": "This is the first arm"
},
{
"name": "Arm B",
"description": "This is the second arm"
}
]
}'
- TODO: Architecture (maybe too simple to diagram?)
- TODO: Blogpost
- TODO: documentation
- TODO: Performance benchmarks
- TODO: Example use cases
- Real-time dashboard?
- Redis caching layer for high-traffic scenarios
- Additional bandit algorithms (UCB1, ε-greedy)
- Prometheus metrics