A payments backend built as Go microservices: a double-entry ledger, transfers run as sagas, gRPC and NATS JetStream between services, and deployment to Kubernetes. Each episode has its own branch.
docs: README with the episode branches, and the MIT license
git clone https://github.com/dev-marker/payments.git
cd payments
git checkout ep05 # the code at the end of episode 5, where episode 6 begins
main holds the latest episode plus this README.
The Go module is named github.com/fiston-user/payments, as typed in the videos. It's only a name: everything builds and runs from this clone as is.
Six Go services in one module, with one PostgreSQL database per service, talking over HTTP, gRPC and NATS JetStream:
Infrastructure (Docker Compose): PostgreSQL 17, Redis, NATS JetStream, Mailpit, Jaeger, Prometheus and Grafana.
Some rules the code never breaks:
int64 count of minor units (cents), never a float.You need Go 1.26, Docker, and make. The golang-migrate, sqlc and buf CLIs are only needed to create migrations or regenerate code.
make keys # throwaway signing keys for local development, in secrets/
docker compose --profile app up -d --build --wait # infrastructure, migrations and all six services
Then open the .http files in api/ with the VS Code REST Client extension and send the requests, starting with api/gateway.http.
To run a single service from source while you work on it, start the infrastructure with docker compose up -d, then make run-wallet (or run-auth, run-transfer, run-notification, run-gateway, run-webhook).
make test # unit tests only, fast
make test-integration # against real PostgreSQL, Redis and NATS in throwaway containers (needs Docker)
make test-race # the same with the race detector
make loadtest # a k6 load test of transfers through the gateway (the app profile must be running)
MIT. This is teaching code: read it, run it, build on it. Treat it as a starting point rather than a drop-in system for moving real money.