How martineoficial/ebanx-challenge-golang works
This repository implements a small in-memory account API. An HTTP client sends reset, balance, or event requests; the router dispatches them to handlers, which call account use cases and return plain-text or JSON responses. Deposit, withdrawal, and transfer are distinct domain operations; the service uses a repository contract, backed at startup by a concurrency-safe memory store. The README documents these capabilities and atomic updates; connections beyond the shown calls and wiring are omitted.
Main entry points: service.go Account use cases · handler.go HTTP handlers · main.go Server startup · router.go Route setup
Components 11
HTTP transport
- Server startup
cmd/api/main.go - Route setup
internal/http/router.go - HTTP handlers
internal/http/handler.go - Event dispatch
internal/http/handler.go - Event DTOs
internal/http/dto.go
Account domain
- Account use cases
internal/account/service.go - Account entity
internal/account/account.go - Domain errors
internal/account/errors.go - Repository contract
internal/account/repository.go
Account storage
- Memory repository
internal/storage/memory/repository.go
Other components
- HTTP client
Connections 14
- HTTP client → Route setup: sends requests
README.md - Server startup → Memory repository: creates
cmd/api/main.go - Server startup → Account use cases: injects repository
cmd/api/main.go - Server startup → Route setup: starts server with
cmd/api/main.go - Route setup → HTTP handlers: routes requests
internal/http/router.go - HTTP handlers → Account use cases: calls use cases
internal/http/handler.go - HTTP handlers → Event dispatch: dispatches events
internal/http/handler.go - HTTP handlers → Event DTOs: decodes and encodes
internal/http/handler.go - Event dispatch → Account use cases: calls event operations
internal/http/handler.go - Account use cases → Repository contract: uses contract
internal/account/service.go - Account use cases → Account entity: updates accounts
internal/account/service.go - Account use cases → Domain errors: returns domain errors
internal/account/service.go - Memory repository → Repository contract: implements
internal/storage/memory/repository.go - Account use cases → Memory repository: dispatches repository calls
README.md