This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
OpenQueue is a simple HTTP message queue written in Go. It accepts tasks via a Connect RPC API and executes HTTP requests with configurable retry logic.
# Development with hot reload
just dev # or: air
# Build
just build # or: go build -o ./tmp/main ./cmd/root.go
# Run server
./tmp/main server --port 8080 --config openqueue.yaml
# Run tests
go test ./...
# Run a single test
go test -run TestName ./pkg/path/...
# Update dependencies
just update
# Generate protobuf code (requires buf, protoc-gen-go, protoc-gen-connect-go)
buf generate
# Install tooling dependencies
just initcmd/root.go- Main CLI entry point using urfave/clicmd/server/- Server subcommand that loads config and starts HTTP server
pkg/server/ - HTTP server setup with chi router
server.go- Server lifecycle, graceful shutdown handlingroutes.go- Route registration, health endpoint, logging middleware
pkg/api/apiv1/ - Connect RPC API handlers implementing QueueService
create_task.go- Creates task in database and triggers async executionget_task.go- Retrieves task and its latest execution status
pkg/database/ - SQLite database layer using sqlx
- Stores tasks and task_execution records
- Uses
modernc.org/sqlite(pure Go, no CGO) - Database files stored in
./data/
pkg/task_runner/ - Task execution engine
- Executes HTTP requests with exponential backoff retry (cenkalti/backoff)
- Tracks execution status (pending/completed/failed)
pkg/config/ - YAML configuration loading using koanf
proto/api/v1/api.proto- Service definition for CreateTask and GetTask RPCsproto/gen/- Generated Go code from buf
Queue configuration via YAML file (default: openqueue.yaml):
queues:
- name: my_queue
db: my_queue # SQLite database name in ./data/
retry: 3 # Max retry attempts# Create a task
curl --header 'Content-Type: application/json' \
--data '{"queue_name": "my_queue", "task":{"url":"http://example.com", "method":"GET"}}' \
http://localhost:8080/api.v1.QueueService/CreateTask
# Get task status
curl --header 'Content-Type: application/json' \
--data '{"queue_name": "my_queue", "taskId":"<task-id>"}' \
http://localhost:8080/api.v1.QueueService/GetTask