https://github.com/samber/do-template-worker
🛠️ Worker boilerplate showcasing github.com/samber/do
https://github.com/samber/do-template-worker
boilerplate container dependency-injection di dig do fix go graceful-shutdown injector invoke ioc provide template wire worker
Last synced: 22 days ago
JSON representation
🛠️ Worker boilerplate showcasing github.com/samber/do
- Host: GitHub
- URL: https://github.com/samber/do-template-worker
- Owner: samber
- License: mit
- Created: 2025-09-25T12:36:17.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-09-25T13:06:52.000Z (5 months ago)
- Last Synced: 2025-10-11T02:38:26.410Z (4 months ago)
- Topics: boilerplate, container, dependency-injection, di, dig, do, fix, go, graceful-shutdown, injector, invoke, ioc, provide, template, wire, worker
- Language: Go
- Homepage: https://github.com/samber/do
- Size: 22.5 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Worker boilerplate showcasing github.com/samber/do


[](https://goreportcard.com/report/github.com/samber/do)
[](./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:**
- [do-template-api](https://github.com/samber/do-template-api)
- [do-template-cli](https://github.com/samber/do-template-cli)
## 🚀 Install
Clone the repo and install dependencies:
```bash
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
```sh
# 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
- [GoDoc: https://godoc.org/github.com/samber/do/v2](https://godoc.org/github.com/samber/do/v2)
- [Documentation](https://do.samber.dev/docs/getting-started)
## 💫 Show your support
Give a ⭐️ if this project helped you!
[](https://github.com/sponsors/samber)
## 📝 License
Copyright © 2025 [Samuel Berthe](https://github.com/samber).
This project is [MIT](./LICENSE) licensed.