Skip to content

ali1ariel/dreams_bank_api

Repository files navigation

Dreams Bank API

Coverage Status Elixir CI Elixir Version Erlang Version Hex.pm

A distributed banking system API built with Elixir and Phoenix Framework, designed with a strong focus on reliability and scalability through clustering capabilities.

Overview

This project implements a robust banking system that leverages Elixir's distributed computing capabilities. The architecture is built around fault tolerance and horizontal scalability, allowing multiple nodes to work together seamlessly.

Key Features

Distributed Architecture

  • Multi-node clustering using libcluster
  • Automatic load balancing across nodes
  • Fault-tolerant operations
  • Node-aware transaction handling

Banking Operations

  • Account management (creation, updates, deletion)
  • Secure money transfers between accounts
  • Deposits and withdrawals with consistency guarantees
  • Real-time balance tracking

Development Approach

This project follows Test-Driven Development (TDD) principles strictly, with comprehensive test coverage for:

  • Unit tests for all business logic
  • Integration tests for API endpoints
  • Property-based tests for critical operations
  • Clustered operations testing

Current test coverage: +90% (tracked by Coveralls)

Coverage Status

Technical Requirements

  • Elixir 1.17.3
  • Erlang/OTP 27.1
  • PostgreSQL 14

Getting Started

Local Development Setup

  1. Install dependencies:
mix deps.get
  1. Setup database:
mix setup
  1. Run tests to ensure everything is working:
mix test

Running in Cluster Mode

To start multiple nodes in development:

# Terminal 1 - Start first node
PORT=4001 iex --name node1@127.0.0.1 -S mix phx.server

# Terminal 2 - Start second node
PORT=4002 iex --name node2@127.0.0.1 -S mix phx.server

# Terminal 3 - Start third node
PORT=4003 iex --name node3@127.0.0.1 -S mix phx.server

The nodes will automatically discover each other and form a cluster.

Testing

The project emphasizes thorough testing:

# Run all tests
mix test

# Run with coverage report
mix coveralls.html

# Run Credo for code analysis
mix credo --strict

# Run full check (format, credo)
mix check

To DO:

  • API Documentation

About

A simple bank api to handles with clustering

Resources

Stars

Watchers

Forks

Contributors

Languages