Simple Bank is a simple REST API that allows users to perform transferences with each other.
- Golang
- Docker
- PostgreSQL
- Github actions
{
"name": "Maria",
"secret": "12345678",
"cpf": "103.913.350-90"
}- Accounts endpoints does not require authentication
- New accounts starts with 1000 in its balance
- The account's balance is always integer
- The
cpffield should matchxxx.xxx.xxx-xx. Take a look at this website for generate random cpfs. - The
secretfield must have between 6 and 50 characters
// Request body
{
"cpf": "084.792.650-86",
"secret": "12345678"
}
// Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFeHBpcmVzQXQiOjE1MDAsIklkIjoiZGY2YWNlODktNGE0Yy00NGY5LTk3OGMtNTIxMTEzNDEwMDM1IiwiSXNzdWVkQXQiOjE2MjA1MTE0Mjl9.v1kzBo3GdIXO1vhTq9_icIgfdgE7981KZ5CaQlw3Bvs"
}// Request body
{
"account_destination_id": "eb7b34eb-643b-4e2b-9e81-7641b3e45327",
"amount": 100
}
// Response body
{
"id": "6e5d9213-2c86-4cb8-bfc7-ddafd9237d34",
"account_destination_id": "eb7b34eb-643b-4e2b-9e81-7641b3e45327",
"account_origin_id": "df6ace89-4a4c-44f9-978c-521113410035",
"amount": 100,
"created_at": "2021-05-08T22:06:18.439343Z"
}- Bearer token is required to perform requests
- The
account_origin_idcomes from the authenticated user, and can't be equal theaccount_destination_id(make a transference to yourself does not make sense) - The authenticated user must have sufficient funds to perform a transference
- Copy the
.env.examplefile content into a new file called.env - After using
make dev-localormake dev-docker, the API will be available inhttp://localhost:3000/api/v1
make dev-local make dev-docker make test make test-coverage