Skip to content

samber/do-template-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Worker boilerplate showcasing github.com/samber/do

Go Version Build Status Go report License

โš™๏ธ A comprehensive worker template demonstrating the github.com/samber/do dependency injection library.

This project showcases the full power of the samber/do dependency injection library in the context of a message-driven worker application. It implements a complete pub/sub worker with PostgreSQL integration and RabbitMQ messaging, demonstrating how do enables clean, modular, and testable worker architectures.

Perfect as a starting point for message-driven Go projects or as a learning resource for understanding dependency injection in worker applications.

See also:

๐Ÿš€ Install

Clone the repo and install dependencies:

git clone --depth 1 --branch main https://github.com/samber/do-template-worker.git your-project-name
cd your-project-name

docker compose up -d
make deps
make deps-tools

๐Ÿ’ก Features

  • Type-safe dependency injection - Service registration and resolution using samber/do
  • Message-driven architecture - Complete pub/sub worker with RabbitMQ consumer and producer
  • Database integration - PostgreSQL with connection pooling and repository pattern
  • Modular architecture - Clean separation of concerns with dependency tree visualization
  • Configuration management - Environment-based configuration with dependency injection
  • Service lifecycle management - Health checks and graceful shutdown handling
  • Repository pattern - Data access layer with injected dependencies
  • Worker patterns - Business logic with proper dependency management
  • Application lifecycle - Health checks and graceful shutdown handling
  • Comprehensive error handling - Structured logging and error management
  • Production-ready - Ready to fork and customize for your next worker project
  • Extensive documentation - Inline comments explaining every do library feature

๐Ÿš€ Contributing

# install deps
make deps
make deps-tools

# compile
make build

# build with hot-reload
make watch-run

# test with hot-reload
make watch-test

๐Ÿค  do documentation

๐Ÿ’ซ Show your support

Give a โญ๏ธ if this project helped you!

GitHub Sponsors

๐Ÿ“ License

Copyright ยฉ 2025 Samuel Berthe.

This project is MIT licensed.