Skip to content

Mark-Partola/go-wallet

Repository files navigation

Wallet Service Example

Setup

cp config.env.example config.env
make run
make migrate-up

API tests

make test

Notes on design

  • Command and Query handlers should be separated
  • There is no business logic in the handlers
  • Input DTO's validation using go-playground/validator and have format convenient for client side form validation
  • Output DTO's should be mapped explicitly in the http layer
  • All unknown errors should be handled as 500
  • All responses should be wrapped to response.Response with extended meta information like errors, traceId, etc
  • Config handling using github.com/ilyakaznacheev/cleanenv, but it could be better (there is no good way to make vars from env more priority)
  • DB migrations using https://github.com/golang-migrate/migrate
  • All logs during the request have traceId

Out of scope:

  • Idempotency keys for commands
  • Balance cannot be negative
  • Auth using JWT
  • Performance and utilization using prometheus or victoria metrics
  • OpenAPI spec
  • Precommit hooks using lefthook
  • GitHub actions pipeline
  • Unit tests and DTO validation errors tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors