Skip to content

danne931/akka-dotnet-bank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exploring business banking with F#.

Key Technologies

  1. Akka.NET: actor model, event sourcing, cluster sharded entities
  2. PostgreSQL
  3. React via F# Feliz
  4. RabbitMQ: Queued communication with external services
  5. SignalR: Provides feedback from actors running on the server to components in the React SPA
  6. Quartz.NET: Future/recurring actor message scheduling with PostgreSQL persistence
  7. Pulumi: IaC via TypeScript for managing Kubernetes resources locally or deployed to Azure Kubernetes Service

Use Cases

  1. Automatic Balance Management
    • Maintain a zero balance after each transaction
    • Maintain a daily target balance by allowing a partner account to absorb excess cash or replenish cash to the target account
    • Distribute balance among multiple accounts within an org on a per-transaction, daily, or twice-monthly schedule
  2. Lithic card issuer makes requests to our platform to authorize employee debit card purchases & communicate progression of the purchase lifecycle
  3. Approval Rules
    • Require admin approval for inviting employees, unlocking cards, fulfilling payments, etc.
    • Restrict submission of actions by type, daily accrued transaction amount, and transaction amount with upper and lower bounds (ex: amounts less than $1500 require 1 approvers; amounts between $1500 and $10,000 require 2 approvers)
    • Assign multiple approvers per rule (ex: Den Vau, Pop Pongkool, & Any Admin = 3 approvals required to submit an action associated with this rule)
  4. Payment requests between organizations on the platform or external entities
    • Optional recurring schedule (ex: due date every 3 months on the last Monday of the month until 4 payments made)
    • Optional invoice line-item breakdown
  5. Transfer money immediately or on a future date to other organizations on the platform or domestically (ex: ACH)
  6. Partner Bank
    • Create a legal entity for the business during onboarding
    • Process domestic transfers (ex: ACH)
    • Currently set up as a separate server processing TCP requests from the platform, mocking interactions between platform and partner bank
    • TODO: Integrate with an actual partner bank (column)
  7. Recurring maintenance fee for each billing cycle unless a qualified deposit found or a daily account balance threshold met.
  8. Manage daily/monthly employee purchase limits per employee card
  9. Monitor employee purchases and other activities on the platform
  10. Billing statements issued for each billing cycle
  11. Emails sent for payment requests, employee invites, purchase declined, etc.

Join me in this YouTube video where I explore coordinating long-running workflows in Akka.NET:

YouTube Video Thumbnail

Demonstration

Automatic Balance Management

auto-balance-management

Recurring Payments

payment-recurring

Analytics

analytics

Approvals

approvals

Transactions

transactions

Running with Kubernetes via minikube

  1. Dependencies: .NET 9, minikube, pulumi, Node.js 18
  2. sh build.sh -t RunK8sApp
  3. Browser opens automatically after all K8s resources start up
  4. Enable postgres port forwarding if you want to inspect postgres in a local client: sh postgres-port-forward-k8s.sh (Server=postgres;Database=akkabank;Uid=testuser;Pwd=testpass)
  5. View Akka cluster and actor info via Petabridge.Cmd:
    > minikube kubectl -- exec --stdin --tty account-cluster-0 -- /bin/bash
    > dotnet tool run pbm
    > cluster show
    > actor hierarchy
    

Running with Docker

  1. Dependencies: .NET 9, Node.js 18
  2. sh build.sh -t RunDockerApp
  3. Navigate to localhost:3000
  4. If you want to inspect postgres in a dashboard you can visit localhost:5008 (Server=postgres;Database=akkabank;Uid=postgres;Pwd=password)

Running without Docker or K8s

  1. Dependencies: .NET 9, Node.js 18, PostgreSQL & psql
  2. Create a database (Server=localhost;Database=akkabank;Uid=postgres;Pwd=password)
  3. Seed the database: psql -h 127.0.0.1 -p 5432 -U postgres akkabank < Database/Init/Bank.sql
  4. cd into ./Web, ./Account/Service, ./Scheduler/Service, & ./MockPartnerBank.Service & dotnet run in each
  5. cd into ./UI and npm run build or npm start

Deploying to Azure AKS

  1. Dependencies: .NET 9, Azure CLI, Pulumi, Node.js 18
  2. sh build.sh -t DeployAllStaging (You will be prompted to sign in to Pulumi & Azure CLI)
  3. One pulumi stack of Azure AKS resources and another Pulumi stack for K8s resources will be created. A Pulumi ESC staging environment will be created and app environment configuration will be set. Your local kubeconfig file will be modified to include details needed to connect to the AKS cluster. See kubectl get all --namespace akkabank & kubectl get all --namespace app-routing-system. App images are currently being pulled from my public docker hub repos. An IP will be exported to the console when Pulumi finishes creating resources.

Running tests

  1. sh build.sh -t Test