How endurannsu/auth works
This repository is an HTTP authentication service. Clients send registration, login, token refresh/logout, password-reset, and access-token validation requests; handlers pass them to the service, which applies authentication rules and uses repository interfaces backed by PostgreSQL. The server assembly wires these layers and starts the HTTP listener. Password recovery is implemented as OTP generation and confirmation. The README gives no further capability details; relationships shown here are based on the sampled source, so unsampled integrations and finer routing behavior are not inferred.
Main entry points: server.go Server assembly · handler.go Auth handlers · service.go Auth and sessions · auth_service_repository.go PostgreSQL repositories
Components 13
HTTP entry
- HTTP routes
internal/adapter/in/http/router.go - Auth handlers
internal/adapter/in/http/handler.go - Request responses
internal/adapter/in/http/dto/auth.go
Authentication
- Auth and sessions
internal/service/service.go - Domain records
internal/domain/entity.go
Password recovery
- OTP recovery
internal/service/service.go
Persistence and runtime
- Repository contracts
internal/domain/repository.go - PostgreSQL repositories
internal/adapter/out/postgres/auth_service_repository.go - PostgreSQL
- Service configuration
internal/app/config.go - Server assembly
internal/app/server.go - Service startup
cmd/auth/main.go
Other components
- API client
Connections 18
- API client → HTTP routes: sends requests
internal/adapter/in/http/router.go - HTTP routes → Auth handlers: routes to
internal/adapter/in/http/router.go - Auth handlers → Request responses: binds and returns
internal/adapter/in/http/handler.go - Auth handlers → Auth and sessions: calls auth operations
internal/adapter/in/http/handler.go - Auth handlers → OTP recovery: calls reset operations
internal/adapter/in/http/handler.go - Auth and sessions → Repository contracts: uses interfaces
internal/service/service.go - OTP recovery → Repository contracts: uses interfaces
internal/service/service.go - Auth and sessions → Domain records: reads user records
internal/service/service.go - OTP recovery → Domain records: uses reset records
internal/service/service.go - PostgreSQL repositories → Repository contracts: implements
internal/adapter/out/postgres/auth_service_repository.go - PostgreSQL repositories → PostgreSQL: queries
internal/adapter/out/postgres/auth_service_repository.go - Service startup → Service configuration: loads configuration
cmd/auth/main.go - Service startup → Server assembly: builds and starts
cmd/auth/main.go - Server assembly → Service configuration: receives settings
internal/app/server.go - Server assembly → PostgreSQL repositories: constructs repositories
internal/app/server.go - Server assembly → Auth and sessions: constructs service
internal/app/server.go - Server assembly → Auth handlers: constructs handler
internal/app/server.go - Server assembly → HTTP routes: constructs router
internal/app/server.go