ud-bmc-simplebank

command module
v0.0.0-...-74d26e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 28 Imported by: 0

README ΒΆ

A Simple Bank

Go Gin PostgreSQL Docker Kubernetes Redis AWS Secrets Manager AWS EKS AWS ECR AWS IAM AWS EC2 AWS RDS AWS S3

πŸ’¬ About

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.

Database

Notes taken during the course are in the notes file.

πŸ’» Technologies

(back to top)

πŸ“œ Requirements

(back to top)

πŸ’Ώ Installation

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 and make migrateup.
This will install the project dependencies and create the database.
The database will be available at localhost:5432 with:

  • user: root
  • password: secret
  • database: simple_bank

(back to top)

πŸƒ Running

With docker:

make run

Without docker:

make server

This will run:
HTTP server at localhost:8080
gRPC server at localhost:9090
database at localhost:5432
redis at localhost:6379

(back to top)

πŸš€ Usage

defined in main.go

API - Gin
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.

Docs http://localhost:8080/swagger/

API - gRPC Gateway
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.

Docs http://localhost:8080/swagger/

gRPC
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"
# }

(back to top)

βœ… Tests

make test

(back to top)

πŸ“ License

MIT

(back to top)

πŸ§™β€β™‚οΈ About Me

(back to top)


Done withΒ Β β™₯️  by Filipe Leuch Bonfim πŸ––


πŸ‘ Acknowledgments

(back to top)

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
db
mock
Package mockdb is a generated GoMock package.
Package mockdb is a generated GoMock package.
doc
Package pb is a reverse proxy.
Package pb is a reverse proxy.
mock
Package mockwk is a generated GoMock package.
Package mockwk is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL