Banking Overview
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
- Authentication
Account Operations
- Account Creation
- Deposit, Withdrawal and Transference between accounts
- Statement and Balance
Back Office Operations
- Daily, Monthly, Yearly and Total report (for Back Office)
- Email service integration
- Error and Logging service integration
- Continuous Integration
- 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) andBasicAuth(for backoffice) authenticationPhoenixfor theapiTimberfor error and logging serviceEctofor database wrapperBamboofor 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
- Install dependencies
$ mix deps.get
- Setup database (creation & migrations)
$ mix ecto.create
$ mix ecto.migrate
- Run application
$ mix phx.server
- Application are running on localhost:4000
Setup (Containerized with Docker)
Move into banking directory
Run docker-compose
$ docker-compose build
$ docker-compose up
- Application are running on localhost:4000
Tests
- Create database
$ MIX_ENV=test mix ecto.create
$ MIX_ENV=test mix ecto.migrate
- 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
Move into banking directory
Run
$ mix docs
- Html docs on
docfolder
Testing the routes
see API Page