How zedzed34/agnos-backend works
A Go/Gin hospital backend supports staff registration and login, then hospital-scoped patient search with a Hospital A external-lookup fallback and local caching. The README documents the layers and endpoints; sampled source confirms the authentication, search, routing, persistence, and fallback paths shown. Repository implementations for hospital and staff are represented by their tree paths, but their internals were not sampled.
Main entry points: main.go API entrypoint · app.js Web interface · patient_service.go Patient search · patient_handler.go Patient handler
Components 16
Staff client
- Hospital staff
- Web interface
web/app.js
HTTP API
- API entrypoint
cmd/api/main.go - Auth handlers
internal/handler/auth_handler.go - Patient handler
internal/handler/patient_handler.go - JWT middleware
internal/middleware/auth_middleware.go - Runtime config
config/config.go
Domain services
- Authentication
internal/service/auth_service.go - Patient search
internal/service/patient_service.go - Domain models
internal/domain/patient.go
Persistence and integrations
- Hospital repository
internal/repository/hospital_repo.go - Staff repository
internal/repository/staff_repo.go - Patient repository
internal/repository/patient_repo.go - Hospital API client
internal/infrastructure/hospital_client.go - PostgreSQL
- Hospital A API
Connections 21
- Hospital staff → Web interface: uses
- Web interface → API entrypoint: requests pages
- Web interface → Auth handlers: registers / logs in
- Web interface → Patient handler: searches patients
- API entrypoint → Runtime config: loads settings
- API entrypoint → Auth handlers: routes auth
- API entrypoint → JWT middleware: protects search
- API entrypoint → Patient handler: routes search
- Auth handlers → Authentication: calls
- Authentication → Hospital repository: finds hospital
- Authentication → Staff repository: creates / finds staff
- Patient handler → JWT middleware: reads hospital claim
- Patient handler → Patient search: passes filters
- Patient search → Patient repository: searches locally
- Patient search → Hospital API client: fetches on fallback
- Patient search → Patient repository: caches result
- Hospital API client → Hospital A API: requests patient
- Hospital repository → PostgreSQL: reads hospitals
- Staff repository → PostgreSQL: reads / writes staff
- Patient repository → PostgreSQL: reads / upserts patients
- API entrypoint → PostgreSQL: migrates / seeds