This project was developed following Udemy's "Backend Master Class [Golang + Postgres + Kubernetes + gRPC]" class.
The project is a simple bank system that allows you to create accounts, deposit and withdraw money, and transfer money between accounts.
Notes taken during the course are in the notes file.
- Go
- Gin
- Viper
- Statik
- PostgreSQL
- Lib pq
- Lib pgx
- SQLC
- Testify
- mockgen/gomock
- gRPC
- Docker
- Kubernetes
- JWT
- PASETO
- AWS
- Swagger
- Zero Allocation JSON Logger
- Asynq
- Redis
git clone git@github.com:filipe1309/ud-bmc-simplebank.git
cd ud-bmc-simplebank
If you don't want to use docker, you can install the project dependencies and create the database with:
make install
This will run the commands:
make createdb
andmake migrateup
.
This will install the project dependencies and create the database.
The database will be available atlocalhost:5432
with:
- user:
root
- password:
secret
- database:
simple_bank
With docker:
make run
Without docker:
make server
This will run:
HTTP server atlocalhost:8080
gRPC server atlocalhost:9090
database atlocalhost:5432
redis atlocalhost:6379
defined in
main.go
API | Name | Rule |
---|---|---|
POST /users/login |
Login | A user can log in with email and password |
POST /tokens/renew-access-token |
Renew access token | A user can renew his/her access token with a valid refresh token |
POST /users |
Create a new user | A user can create a new user |
POST /accounts |
Create a new account | A logged user can only create an account for himself/herself |
GET /accounts/:id |
Get an account by id | A logged user can only get accounts that belong to himself/herself |
GET /accounts |
List accounts | A logged user can only list accounts that belong to himself/herself |
POST /transfers |
Create a new transfer | A logged user can only send money from his/her account |
Examples of the API requests are in the api file.
API | Name | Rule |
---|---|---|
POST /v1/login_user |
Login | A user can log in with email and password |
POST /v1/create_user |
Create a new user | A user can create a new user |
POST /v1/update_user |
Update a user | A logged user can only update his/her own user, username is required and other fields are optional |
Examples of the API requests are in the api_grpc_gateway file.
gRPC | Name | Rule |
---|---|---|
LoginUser |
Login | A user can log in with email and password |
CreateUser |
Create a new user | A user can create a new user |
UpdateUser |
Update a user | A logged user can only update his/her own user, username is required and other fields are optional |
Example with Evans REPL:
make evans
> call LoginUser
# {
# "username": "johndoe5",
# "password": "secret"
# }
> call CreateUser
# {
# "username": "johndoe5",
# "full_name": "John Doe Five",
# "email": "john.doe5@email.com",
# "password": "secret"
# }
> call UpdateUser
# {
# "username": "johndoe5", # required
# "full_name": "New John Doe Five",
# "email": "john.doe5@email.com",
# "password": "secret"
# }
# OR
# {
# "username": "johndoe5",
# "full_name": "New John Doe Five"
# }
make test
Done with
- ShubcoGen Template™
- Simple Bank Repo
- Backend Master Class [Golang + Postgres + Kubernetes + gRPC]
- Simple Bank DBDocs
- TablePlus
- Golang Migrate CLI Repo
- DBML
- Gorm
- SQLX
- SQLC
- Lib pq
- Testify
- PostgreSQL Wiki - Lock Monitoring
- Creating PostgreSQL service containers
- Gin
- Viper
- Go Package Validator
- JWT
- Golang JWT
- PASETO
- Golang PASETO
- VSCode REST Client
- Docker hub golang
- Docker hub postgres
- Wait-for script
- Docker compose
- AWS free tier
- Creating a container image for use on Amazon ECS
- Amazon ECR "Login" Action for GitHub Actions
- Connecting GitHub Actions To AWS Using OIDC
- Configuring OpenID Connect in Amazon Web Services
- Install or update to the latest version of the AWS CLI
- jq
- AWS get-login-password
- Kubernetes
- Kubernetes Install Tools kubectl
- How do I provide access to other IAM users and roles after cluster creation in Amazon EKS/?
- Grant IAM users access to Kubernetes with EKS access entries
- K9s
- Kubernetes Deployments
- ENI Max Pods
- Maximum IP addresses per network interface
- Kubernetes Services
- Kubernetes Ingress
- Kubernetes Ingress Controller
- Kubernetes Ingress Nginx
- Ingress-Nginx Controller
- A complete overview of SSL/TLS and its cryptographic system
- Kubernetes TLS
- cert-manager
- Let's Encrypt
- Kubectl tool installer
- vscode-dbml
- dbdocs.io
- gRPC
- Protocol Buffer Compiler Installation
- Language Guide (proto 3)
- vscode-proto3
- Evans: gRPC CLI
- Conventional Commits
- gRPC-Gateway
- Google APIs
- Customizing your gateway
- Swagger
- Swagger Editor
- SwaggerHub
- gRPC-Gateway - a_bit_of_everything.proto
- Swagger UI
- Statik
- Zero Allocation JSON Logger
- Asynq
- Redis
- Go - SMTP
- GO Email Lib
- MailTrap
- AWS SES
- PGX