Minimal banking API in Go with PostgreSQL, SQLC, and in-code Goose migrations. Production-friendly container image and CI/CD with linting and security scans.
- Health and readiness:
GET /health,GET /ready(ready after migrations) - Accounts API:
POST /accountscreate account (owner,currency=USD|EUR)GET /accounts/:idfetch account by idGET /accounts?page_id=&page_size=paginated list
- Transactional money transfer implemented in store layer (
TransferTx)—not exposed via HTTP yet - Typed data access generated with SQLC (
accounts,entries,transfers)
- Go
1.24+(toolchain pinned viamise.toml) - PostgreSQL (local or via Docker)
- Copy
.env.exampleto.envand set variables:DB_IMAGE,DB_VERSION,DB_PORT,DB_USER,DB_PASS,DB_NAMEDB_HOST(e.g.,localhostordbwhen using compose)SERVER_PORT(e.g.,8080)MIGRATIONS_FOLDER(defaultdb/migrations)
- Local server (migrations run automatically):
make server
- Optional: start Postgres + pgAdmin via Docker Compose (requires
.env):make compose-up
POST /accountscurl -X POST http://localhost:$SERVER_PORT/accounts \ -H 'Content-Type: application/json' \ -d '{"owner":"alice","currency":"USD"}'
GET /accounts/:idcurl http://localhost:$SERVER_PORT/accounts/1GET /accounts?page_id=1&page_size=5curl 'http://localhost:$SERVER_PORT/accounts?page_id=1&page_size=5'GET /healthandGET /ready
- Generate SQLC code:
make sqlc-generate - Create migration:
make db-migration name=<migration_name> - Apply migrations (CLI):
make db-migrate-up/make db-migrate-down - Lint:
make lint-check(fix withmake lint-fix) - Tests:
make test-run
api/Gin HTTP server and handlersdb/sqlc/SQLC-generated queries, models, and transactional store (TransferTx)db/migrations/in-code Goose migrationsutil/configuration, migrations runner, random test data, testcontainers helpers
- Readiness gating via
SetReady()after migrations - Distroless, non-root runtime image
- Static analysis:
golangci-lint(errcheck,goimports,govet,staticcheck) - Security:
gosecfor code,trivyfor images - Tests use
testcontainers(requires proper DB env variables)
MIT — see LICENSE
- Email:
aronreis2@gmail.com - Issues: https://github.com/aronreisx/bubblebank/issues
Note: Transfers and entries are implemented in the store layer but have no HTTP endpoints yet.