How esca6585dev/habarchy works
Habarchy is a self-hosted, multi-tenant notification gateway. Clients submit messages through public APIs; the backend validates and queues them, workers deliver through configured providers with retries and fallback, and status/webhook events report outcomes. The repository also includes tenant administration, contact and group management, imports, OTP, team chat, a web admin panel, and an Android SIM gateway. The graph combines sampled wiring with README-documented capabilities; unsampled details are represented only where documentation supports them.
Main entry points: main.go HTTP API · delivery/service.go Delivery and fallback · GatewayService.kt Gateway service · messages/service.go Message intake
Components 27
Backend API
- HTTP API
backend/cmd/api/main.go - Message intake
backend/internal/app/messages/service.go - PostgreSQL
backend/internal/adapters/postgres/postgres.go - Maintenance scheduler
backend/cmd/scheduler/main.go
Delivery Runtime
- Provider setup
backend/internal/app/providers/service.go - Job queue
backend/internal/queue/client.go - Delivery worker
backend/cmd/worker/main.go - Delivery and fallback
backend/internal/app/delivery/service.go - Channel adapters
backend/internal/adapters/providers - Webhooks
backend/internal/app/webhooks/service.go - Redis
backend/internal/adapters/redis/redis.go
Administration
- Projects and keys
backend/internal/app/projects/service.go - Admin auth
backend/internal/app/auth/service.go - Contacts and groups
backend/internal/app/contacts/service.go - Team chat
backend/internal/app/chat/service.go
SIM Gateway
- Gateway API client
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/Api.kt - Gateway service
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/GatewayService.kt - Gateway state
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/GatewayStore.kt - Inbound SMS control
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/InboundControl.kt - SIM SMS sender
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/SmsSender.kt - Gateway reports
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/Reporter.kt
Other components
- API clients
- Android phone and SIM
- External channels
- Message recipients
Connections 33
- API clients → HTTP API: sends requests
README.md - PHP SDK → HTTP API: calls public API
README.md - Web admin → HTTP API: uses backend
README.md - HTTP API → Message intake: routes sends
backend/cmd/api/main.go - HTTP API → Projects and keys: registers handlers
backend/cmd/api/main.go - HTTP API → Admin auth: registers handlers
backend/cmd/api/main.go - HTTP API → Contacts and groups: registers handlers
backend/cmd/api/main.go - Message intake → Contacts and groups: resolves recipients
backend/internal/app/messages/service.go - Message intake → PostgreSQL: persists messages
backend/internal/app/messages/service.go - Message intake → Job queue: enqueues sends
- Delivery worker → Delivery and fallback: handles tasks
backend/cmd/worker/main.go - Delivery worker → Job queue: consumes jobs
backend/cmd/worker/main.go - Delivery and fallback → Provider setup: selects adapters
backend/internal/app/delivery/service.go - Delivery and fallback → Contacts and groups: uses contacts
backend/internal/app/delivery/service.go - Delivery and fallback → PostgreSQL: records outcomes
backend/internal/app/delivery/service.go - Delivery and fallback → Redis: publishes events
backend/internal/app/delivery/service.go - Delivery and fallback → Webhooks: emits callbacks
backend/internal/app/delivery/service.go - Delivery and fallback → Channel adapters: sends messages
backend/internal/app/delivery/service.go - Channel adapters → External channels: delivers externally
README.md - Message recipients → External channels: receive notifications
- Maintenance scheduler → PostgreSQL: runs maintenance
backend/cmd/scheduler/main.go - Gateway service → Gateway API client: polls and reports
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/GatewayService.kt - Gateway service → Gateway state: reads state
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/GatewayService.kt - Gateway service → SIM SMS sender: sends SMS
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/GatewayService.kt - Gateway service → Inbound SMS control: checks forwarding
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/GatewayService.kt - Inbound SMS control → Gateway state: reads settings
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/InboundControl.kt - Inbound SMS control → Gateway reports: forwards inbound
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/InboundControl.kt - SIM SMS sender → Android phone and SIM: uses SIM radio
README.md - Gateway reports → Gateway API client: posts reports
gateway/android/app/src/main/kotlin/tm/habarchy/gateway/Reporter.kt - Gateway API client → HTTP API: calls gateway endpoints
README.md - HTTP API → Gateway service: queues SIM delivery
- HTTP API → Team chat: registers chat handlers
backend/cmd/api/main.go - Provider setup → PostgreSQL: stores configuration
backend/internal/app/providers/service.go