This project demonstrates a banking system built using the Actor Model with Akka.NET, demonstrating actor-based programming patterns in financial services.
The banking system implements a financial services platform with the following components:
- AccountActor: Manages individual account state, balance, and transaction history
- BankActor: Coordinates multiple accounts and manages account registry
- TransactionActor: Handles money transfers and maintains transaction records
- FraudDetectionActor: Monitors transactions for suspicious patterns
- AtmActor: Simulates ATM operations with authentication and cash management
- BankingSupervisorActor: Provides fault tolerance and system coordination
- Thread-safe balance operations without locks
- Account creation with automatic PIN generation
- Account freezing/unfreezing capabilities
- Transaction history tracking
- Atomic transfer operations between accounts
- Insufficient funds protection
- Transaction status tracking (pending, completed, failed)
- Real-time balance updates
- PIN-based authentication
- Cash withdrawal with daily limits
- Deposit processing
- Balance inquiries
- ATM cash management and monitoring
- Large Transaction Monitoring: Alerts for transactions over $10,000
- Frequency Analysis: Detects unusual transaction patterns
- Time-based Detection: Flags transactions during unusual hours
- Rapid Succession Detection: Identifies transactions within seconds
- Automatic Account Freezing: Freezes accounts for high-severity alerts
- Automatic actor restart on failures
- Hierarchical supervision strategies
- System-wide error recovery
- State preservation during restarts
ActorModelReference/
├── Banking/
│ ├── Models/
│ │ └── BankingModels.cs # Domain models and enums
│ ├── Messages/
│ │ └── BankingMessages.cs # Message contracts
│ ├── Actors/
│ │ ├── AccountActor.cs # Account state management
│ │ ├── BankActor.cs # Account coordination
│ │ ├── TransactionActor.cs # Transfer processing
│ │ ├── FraudDetectionActor.cs # Security monitoring
│ │ ├── AtmActor.cs # ATM operations
│ │ └── BankingSupervisorActor.cs # System supervision
│ └── Examples/
│ └── BankingExamples.cs # Demonstration scenarios
└── Program.cs # Main entry point
cd ActorModelReference
dotnet run
The application demonstrates five scenarios:
- Account creation for different account types
- Deposit and withdrawal operations
- Balance inquiries and account management
- Transfers between accounts
- Insufficient funds handling
- Transaction verification and logging
- Simulated ATM interactions with PIN authentication
- Cash withdrawal with limits and balance checks
- Deposit processing and balance updates
- Simulation of suspicious transaction patterns
- Real-time fraud alert generation
- Automatic account freezing for critical threats
- Account freezing and unfreezing
- Transaction blocking on frozen accounts
- Administrative operations and account recovery
Client → BankingSupervisor → TransactionActor → BankActor → AccountActor(From)
→ AccountActor(To)
→ FraudDetectionActor (monitoring)
ATM → BankingSupervisor → BankActor → AccountActor (authentication)
→ AccountActor (withdrawal)
← ATM Response ← BankingSupervisor ← BankActor ← AccountActor
The system monitors for several fraud indicators:
- Large Transactions: Transactions over $10,000 trigger alerts
- High Frequency: More than 10 transactions in 30 minutes
- Unusual Timing: Transactions outside 6 AM - 11 PM
- Rapid Succession: Transactions within 5 seconds of each other
Severity levels (Low, Medium, High, Critical) determine the response:
- High/Critical: Automatic account freezing
- Medium: Alert logging and monitoring
- Low: Statistical tracking
The system includes test scenarios:
- Normal Operations: Standard banking transactions
- Error Handling: Insufficient funds, invalid accounts
- Security: Authentication failures, fraud detection
- Recovery: System restart and state preservation
- Concurrency: Multiple simultaneous operations
- .NET 9.0
- Akka.NET 1.5.49
This banking system can be extended with:
- Persistence: Add Akka.Persistence for transaction durability
- Clustering: Deploy across multiple nodes with Akka.Cluster
- Streaming: Real-time analytics with Akka.Streams
- Web API: REST API layer with ASP.NET Core integration
- Event Sourcing: Complete audit trail with event-driven architecture