Skip to content

mbenatti/banking

Repository files navigation

Banking Overview

CircleCI

Banking is a project that was built to test my skills, and a opportunity to use and test the latest dependencies(or packages) on Elixir ecosystem.

The project consists of a Banking Account service, accept the creation of accounts, deposit, withdrawal among other features as described on Features section.

The project was created under a Elixir Umbrella application, using Postgres to store the balance events, accounts and transactions, with Phoenix providing the Rest API structure and Docker as a container that can be used on development.

Features

  1. Authentication
  2. Account Operations
    • Account Creation
    • Deposit, Withdrawal and Transference between accounts
    • Statement and Balance
  3. Back Office Operations
    • Daily, Monthly, Yearly and Total report (for Back Office)
  4. Email service integration
  5. Error and Logging service integration
  6. Continuous Integration
  7. Docker image for development

Requirements

  • Erlang/OTP 21 [erts-10.3]+
  • Elixir 1.8.1+ (compiled with OTP 21)
  • PostgreSQL 10.7+

(not tested on OTP 20 or others versions of elixir, but should work fine using the latest versions)

Main Dependencies

  • Guardian (for accounts) and BasicAuth (for backoffice) authentication
  • Phoenix for the api
  • Timber for error and logging service
  • Ecto for database wrapper
  • Bamboo for email service
  • Circle CI for continuous integration

Project Structure

The project was created using umbrella and consist into 5 apps with distinct's functions

  • Model

    Contains the database operations like read and write, the schema definitions, database migrations, changeset with validations and logic for change of the balance

  • Accounts

    Logic segregation of bank account and their operations, serves as a bridge between the API and Model

  • Backoffice

    Logic segregation of Back office and their operations, serves as a bridge between the API and Model

  • Email

    Email Service Integration and email implementation

  • API

    The Rest API, it calls functions from Accounts and Backoffice apps and not deal directly with Model or Email

Online docs

  • Documentations can be found at Docs

Unit Tests

The test's are made using Ex_Unit, also using useful libraries like Faker and ExMachina

Development tips / Setup

  1. Install dependencies
$ mix deps.get
  1. Setup database (creation & migrations)
$ mix ecto.create
$ mix ecto.migrate
  1. Run application
$ mix phx.server
  1. Application are running on localhost:4000

Setup (Containerized with Docker)

  1. Move into banking directory

  2. Run docker-compose

$ docker-compose build
$ docker-compose up
  1. Application are running on localhost:4000

Tests

  1. Create database
$ MIX_ENV=test mix ecto.create
$ MIX_ENV=test mix ecto.migrate
  1. Execute the test
$ mix test

Static analysis tool

Dialyzer Dialyzer is a static analysis tool that identifies software discrepancies Dialyxir

$ mix dialyzer

Static code analysis

Credo Credo is a static code analysis tool for the Elixir language with a focus on teaching and code consistency.

$ mix credo

Generating Docs Locally

  1. Move into banking directory

  2. Run

$ mix docs
  1. Html docs on doc folder

Testing the routes

see API Page

About

Simple, yet featured Banking Service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published