GO - Simple bank
This service implements these main features:
- Create and manage users and its bank accounts.
- Record all balance changes to each of the accounts.
- Perform money transactions between the accounts.
Infrastructure:
- Database migrations:
golang-migrate - Generate CRUD code from SQL:
sqlc - Database:
postgreSQL - Mock database for testing:
gomock - Database documentation:
dbdocs - Generate SQL schema:
dbml2sql - Queue:
Redis - Web framework:
Gin - RPC framework:
gRPC - API gateway supports both HTTP and gRPC request:
grpc-gateway - API documentation:
Swagger - CI/CD:
github-action - Containerize:
docker,docker-compose - Deployment:
Kubernetes - AWS services:
IAM - ECR - RDS - Secrets Manager - EKS - Route53 - TLS:
Let's Encrypt
-
brew install golang-migrate
-
npm install -g dbdocs dbdocs login
-
npm install -g @dbml/cli dbml2sql --version
-
brew install sqlc
-
go install github.com/golang/mock/mockgen@v1.6.0
-
Create the bank-network
make network
-
Start postgres container:
make postgres
-
Create database:
make createdb
-
Run db migration up all versions:
make migrateup
-
Run db migration up 1 version:
make migrateup1
-
Run db migration down all versions:
make migratedown
-
Run db migration down 1 version:
make migratedown1
-
Generate DB documentation:
make db_docs
-
Access the DB documentation at this address. Password:
hoangtk
-
Generate schema SQL file with DBML:
make db_schema
-
Generate SQL CRUD with sqlc:
make sqlc
-
Generate DB mock with gomock:
make mock
-
Create a new db migration:
make new_migration name=<migration_name>
-
Run server:
make server
-
Run test:
make test -
Access database:
make db
-
Run containers:
make up
-
Remove containers:
make down
-
Install nginx ingress controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.48.1/deploy/static/provider/aws/deploy.yaml
-
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.4.0/cert-manager.yaml