Simple Bank is a simple REST API that allows users to perform transferences with each other.

Overview

💰 Simple Bank 💰

Simple Bank is a simple REST API that allows users to perform transferences with each other.

🔧 Technologies

  • Golang
  • Docker
  • PostgreSQL
  • Github actions

📚 Libraries

🚩 Endpoints

/accounts

/api/v1/accounts - POST Creates a new account. Example of request body:

{
  "name": "Maria",
  "secret": "12345678",
  "cpf": "103.913.350-90"
}

/api/v1/accounts - GET Fetch all accounts

/api/v1/accounts/{account_id}/balance - GET Get the account's balance

Details

  • Accounts endpoints does not require authentication
  • New accounts starts with 1000 in its balance
  • The account's balance is always integer
  • The cpf field should match xxx.xxx.xxx-xx. Take a look at this website for generate random cpfs.
  • The secret field must have between 6 and 50 characters

/login

/api/v1/login - POST Creates a JWT token. Example:

// Request body
{
	"cpf": "084.792.650-86",
	"secret": "12345678"
}
// Response
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFeHBpcmVzQXQiOjE1MDAsIklkIjoiZGY2YWNlODktNGE0Yy00NGY5LTk3OGMtNTIxMTEzNDEwMDM1IiwiSXNzdWVkQXQiOjE2MjA1MTE0Mjl9.v1kzBo3GdIXO1vhTq9_icIgfdgE7981KZ5CaQlw3Bvs"
}

/transfers

/api/v1/transfers - POST Perform a transference between two accounts. Example:

// 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"
}

/api/v1/transfers - GET Get the transferences of the authenticated user

Details

  • Bearer token is required to perform requests
  • The account_origin_id comes from the authenticated user, and can't be equal the account_destination_id (make a transference to yourself does not make sense)
  • The authenticated user must have sufficient funds to perform a transference

🏁 How to run (needs Docker 🐳 )

  • Copy the .env.example file content into a new file called .env
  • After using make dev-local or make dev-docker, the API will be available in http://localhost:3000/api/v1

Running the application locally using Go and Docker

  make dev-local

Running with Docker (Go not required)

  make dev-docker

🚦 Testing

Run tests

  make test

See test coverage

  make test-coverage
You might also like...
Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and GraphQL.

Go GraphQL Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and Gr

A simple app that reads NBMiner status REST API data and sends it to InfluxDB

NBMiner Reporter A simple Go app that reads NBMiner status REST API data and sends it to InfluxDB. Usage Using the reporter is quite easy, specially i

Echo-mongo-api - Simple Golang REST application with Echo Framework & MongoDB

Echo-mongo-api - Simple Golang REST application with Echo Framework & MongoDB

Hammond is a self hosted vehicle management system to track fuel and other expenses related to all of your vehicles.
Hammond is a self hosted vehicle management system to track fuel and other expenses related to all of your vehicles.

Hammond is a self hosted vehicle management system to track fuel and other expenses related to all of your vehicles. It supports multiple users sharing multiple vehicles. It is the logical successor to Clarkson which has not been updated for quite some time now.

Automated penetration and auxiliary systems, providing XSS, XXE, DNS log, SSRF, RCE, web netcat and other Servers,gin-vue-admin
Automated penetration and auxiliary systems, providing XSS, XXE, DNS log, SSRF, RCE, web netcat and other Servers,gin-vue-admin

Simple DNS log Server,easy to ACME DNS challenge log easy send to elasticsearch https://github.com/hktalent/DNS_Server go4Hacker Automated penetration

REST API for RabbitMQ, Write with Google Go(lang).

RabbitMQ HTTP API REST HTTP API for RabbitMQ, it's not RabbitMQ Management Plugin. Status: Under active development. Required: * RabbitMQ (2.8+) * Go(

Sample Go REST API implementation with DDD using Clean Architecture.

This layer is a part developed for client-side (mobile, web, etc.) applications to access our domain. It will forward the requests from this layer to the application layer and expose the response it receives from the application layer.

This product about make link to be short link with golang rest api

This project using golang with go fiber, firebase, and dependency injection

Instagram Backend HTTP REST API using GO Lang and Mongo DB

Instagram Backend HTTP REST API using GO Lang and Mongo DB Project for Appointy Summer Internship . Project built within 25 hrs, with no prior knowled

Releases(0.0.1)
Owner
Matheus Mosca
Software Engineer, Gopher and Open Source enthusiast
Matheus Mosca
A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.

A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.

Nitin Narayanan 1 Oct 10, 2021
Go (Golang) API REST with Gin FrameworkGo (Golang) API REST with Gin Framework

go-rest-api-aml-service Go (Golang) API REST with Gin Framework 1. Project Description Build REST APIs to support AML service with the support of exte

Tony Aizize 1 Nov 21, 2021
Give developers an easy way to create and integrate bank processing into their own software products

Community · Blog moov-io/bankcron Moov's mission is to give developers an easy way to create and integrate bank processing into their own software pro

moov 3 Sep 27, 2022
Use of Advent of Code challenges to perform pyhton and learn Go language

Scripts in Python and Go language made to perform Advent of Code 2021 challenges

null 1 Jan 3, 2022
Rental-api - A RESTful-API that allows developers to connect to data about rental properties

Rentals-API is a RESTful-API that allows developers to connect to data about rental properties.

null 0 Jan 24, 2022
A social media API to handle users and their posts, written from scratch in Golang

Initial Set-Up To start the project on your own machine you'll need Golang instlled, along with mongoDB. Once you've insured these requirements are me

Ayush Neekhar 0 Oct 9, 2021
Users API Service

bookstore_users-api Users API Service Overview This application handles users. Project Structure This project was written in golang, designed to use M

Sayi Polia 0 Feb 12, 2022
Ecommerce-api - Rest api of e-commerce web application

E-commerce Rest API Swagger documentation to test api Domain diagram

Павел Шпаковский 13 Jan 2, 2023
Azanul Haque 7 Oct 1, 2021
Birthdays is a web service that stores the birthday date of users and calculates the remaining days until the user's birthday.

Birthdays is a web service that stores the birthday date of users and calculates the remaining days until the user's birthday. Features Metrics servic

Hugo Meneses 1 May 2, 2022