SimpleBank

Architecture

image

For local development

Requirements

  • gRPC: create gRPC api
  • gRPC-Gateway: serve HTTP request along with gRPC request.
  • Protobuf: define gRPC api contract
  • Docker: run database
  • GoMock: create test db
  • Paseto: generate paseto token
  • dbdocs: create documentation for database base on database.dbml file.
  • swagger: create documentation for api.

Documentation

Database

  • Run in terminal:
make dbdocs
  • Follow the guide and click the link showed on terminal.

Database

  • Run in terminal:
make server
  • The default link to documentation is localhost:8080/swagger/index.html

Makefile

  • Run database container:
make postgres
  • Run migration up:
make migrate-up
  • Run migration down:
make migrate-down
  • Generate Go code from .sql file located in ./db/query/.sql
make sqlc
  • Generate database documentation
make dbdocs
  • Generate mock db
make mock
  • Generate go code and documentation for api from .proto file located in ./proto/.proto
make proto