How 47monad/apin works
Apin is a Go microservice-initializer toolkit: applications load their own configuration, choose infrastructure shells, and use App to run work and close tracked shells in reverse order. The graph preserves the documented database, messaging, server, logging, and metrics capabilities. Lifecycle and configuration behavior are supported by sampled source; several initializer links and capabilities rely on the README because their implementation files were not sampled.
Main entry points: common.go Closer contract · grpcinitr gRPC shells · app.go App lifecycle · httpinitr HTTP server shell
Components 20
Application lifecycle
- App lifecycle
app.go - Closer contract
common.go
Configuration
- Config loader
config/load.go
Service shells
- HTTP server shell
initrs/httpinitr - gRPC shells
initrs/grpcinitr - PostgreSQL shell
initrs/pginitr - MongoDB shell
initrs/mongoinitr - etcd shell
initrs/etcdinitr - RabbitMQ shell
initrs/rmqinitr
Observability
- Zap logger shell
initrs/zapinitr - Prometheus metrics
initrs/prominitr
Other components
- Service application
- Config and env files
- Application runnables
- PostgreSQL service
- MongoDB service
- etcd service
- RabbitMQ service
- HTTP clients
- gRPC clients
Connections 29
- Service application → Config loader: loads settings
- Config and env files → Config loader: provides values
- Config loader → Service application: returns config
- Service application → HTTP server shell: constructs shell
- Service application → gRPC shells: constructs shell
- Service application → PostgreSQL shell: constructs shell
- Service application → MongoDB shell: constructs shell
- Service application → etcd shell: constructs shell
- Service application → RabbitMQ shell: constructs shell
- Service application → Zap logger shell: constructs shell
- Service application → Prometheus metrics: constructs shell
- Service application → App lifecycle: creates and tracks
- Service application → App lifecycle: starts
- App lifecycle → Application runnables: runs concurrently
- App lifecycle → Closer contract: closes tracked shells
- HTTP server shell → Closer contract: implements
- gRPC shells → Closer contract: implements
- PostgreSQL shell → Closer contract: implements
- MongoDB shell → Closer contract: implements
- etcd shell → Closer contract: implements
- RabbitMQ shell → Closer contract: implements
- Zap logger shell → Closer contract: implements
- HTTP server shell → HTTP clients: serves
- gRPC shells → gRPC clients: serves
- gRPC shells → Prometheus metrics: instrumented by
- PostgreSQL shell → PostgreSQL service: connects to
- MongoDB shell → MongoDB service: connects to
- etcd shell → etcd service: connects to
- RabbitMQ shell → RabbitMQ service: connects to