Skip to content

sa001gar/gopherqueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GopherQueue

Go Reference Go Report Card License: MIT npm

πŸš€ Enterprise-grade, local-first background job engine for Go

Zero external dependencies β€’ BoltDB persistence β€’ Python & TypeScript SDKs

Quick Start β€’ SDKs β€’ Documentation β€’ Contributing


✨ Features

Feature Description
πŸ’Ύ Durable Storage BoltDB-backed persistence β€” jobs survive crashes and restarts
⚑ Priority Queues Critical, High, Normal, Low, and Bulk priority levels
πŸ”„ Smart Retries Exponential, linear, or constant backoff strategies
πŸ“Š Observability Prometheus metrics, structured logging, health checks
πŸ›‘οΈ Fault Tolerant Panic recovery, checkpointing, graceful shutdown
πŸ” Security Ready API key auth, role-based authorization
πŸ”— Job Dependencies Chain jobs with wait conditions
πŸ†” Idempotency Built-in deduplication via idempotency keys

πŸš€ Quick Start

Install

go install github.com/sa001gar/gopherqueue/cmd/gq@latest

Start Server

gq serve                                              # Default: 10 workers, port 8080
gq serve --http :8080 --workers 20 --data-dir ./data  # Custom config

🐳 Docker

docker run -d --name gopherqueue -p 8080:8080 -v gq_data:/data sa001gar/gopherqueue:latest

Submit a Job

# CLI
gq submit --type email --payload '{"to": "user@example.com"}'

# HTTP API
curl -X POST http://localhost:8080/api/v1/jobs \
  -H "Content-Type: application/json" \
  -d '{"type": "email", "payload": {"to": "user@example.com"}, "priority": 1}'

πŸ“¦ Multi-Language SDKs

Use GopherQueue from any language with our official SDKs.

🐍 Python

pip install gopherqueue
from gopherqueue import GopherQueueSync

queue = GopherQueueSync("http://localhost:8080")
job = queue.submit("email", {"to": "user@example.com"})
print(f"Job {job.id} queued!")

πŸ“œ TypeScript / JavaScript

npm install gopherqueue
import { GopherQueue } from "gopherqueue";

const queue = new GopherQueue("http://localhost:8080");
const job = await queue.submit("email", { to: "user@example.com" });
console.log(`Job ${job.id} queued!`);

πŸ”„ Job Lifecycle

                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                    β”‚  completed  β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                          β–²
                                          β”‚ success
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”
β”‚ pending │───▢│ scheduled │───▢│   running   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚ failure
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β–Ό                                     β–Ό
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚  retrying  β”‚                         β”‚  failed  β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
                                                          β”‚
                                                          β–Ό
                                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                                    β”‚ dead_letter β”‚
                                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
State Description
pending Created, waiting to be scheduled
scheduled In priority queue, ready for pickup
running Worker actively processing
completed Finished successfully
retrying Failed, waiting for retry
failed Exceeded max attempts
dead_letter Permanently failed, needs manual intervention

βš™οΈ Configuration

Flag Default Description
--http :8080 HTTP server address
--workers 10 Concurrent worker count
--data-dir ./data BoltDB storage directory
--shutdown-timeout 30s Graceful shutdown timeout

Priority Levels

Priority Value Use Case
Critical 0 System alerts, payments
High 1 User-initiated actions
Normal 2 Standard background work
Low 3 Batch processing
Bulk 4 Data migrations

πŸ“š Documentation

Guide Description
πŸ“– SDK Guide Complete SDK reference with framework examples
πŸš€ Deployment Self-hosting, Docker, Kubernetes
πŸ”Œ API Spec REST API documentation
πŸ—οΈ Architecture System design & internals
πŸ” Security Auth, authorization, best practices
πŸ“Š Observability Metrics, logging, monitoring

Framework Guides

Framework Link
🐍 Django Complete Integration Guide
βš›οΈ Next.js API Routes Example
🌢️ Flask / FastAPI Python Web Frameworks

πŸ—οΈ Project Structure

gopherqueue/
β”œβ”€β”€ api/           # HTTP API handlers
β”œβ”€β”€ cli/           # Command-line interface
β”œβ”€β”€ cmd/gq/        # Main entry point
β”œβ”€β”€ core/          # Core types & options
β”œβ”€β”€ docs/          # Documentation
β”œβ”€β”€ observability/ # Metrics & health
β”œβ”€β”€ persistence/   # Storage (BoltDB)
β”œβ”€β”€ scheduler/     # Priority queue
β”œβ”€β”€ sdks/          # Python & TypeScript SDKs
β”œβ”€β”€ security/      # Auth & authorization
└── worker/        # Job execution

🀝 Contributing

Contributions welcome! Please read our Contributing Guide.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

MIT License β€” see LICENSE.


Built with ❀️ for developers who value simplicity

⬆ Back to top

About

A local-first, enterprise-grade background job engine written in Go. Built for reliability and performance with BoltDB-backed persistence, zero external runtime dependencies, and native SDKs for Python and TypeScript to orchestrate jobs from any stack.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors