Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

banked

A simplified end-to-end implementation of an in-person banking system. It is implemented in Java and uses virtual threads for efficiency and scaling.

For the cli, the project uses Airline.

In addition to the high-level illustration above, each transaction is self-describing and contains the information you need to intuit what is happening. For example:

# This is a deposit.
#    Description-Amount-BranchCode-[AccountID]
DEP-€898.67-YWS-[019e1d0a-924b-72e7-9dff-30c775c4f3d5]

---

# This is an inter-account transfer. Similar to a deposit but contains the destination.
InterAcc-€533.27-YWS-[019e1d0a-9319-7f3a-9dde-6d66a52c29da]-YWS-[019e1d0a-924b-72e7-9dff-30c775c4f3d5]

Running locally

  • Ensure Java is installed. (at least SDK 21+).
  • Ensure maven is installed.
  • Clone this repo.

Build with maven

cd path/to/clone

# Compile once with maven
mvn clean compile

Running Commands

Once compiled, this project has a one-line bash script to reduce verbosity; banked.sh. Make it executable:

# On Linux and macOS (or WSL on Windows)
chmod +x banked.sh

On Windows, you can use git or run it directly with Windows Terminal or WSL.

single command

This runs the bank as a single branch.

# Help. Shows restrictions and how to use it.
./banked.sh help single
  • Run a single branch with 4 accounts backed by 2 tellers who process 20 transactions.
# In full
./banked.sh single --accounts 4 --tellers 2 --volume 10

# Abbreviated
./banked.sh single -a 4 -t 2 -c 10

Runs and prints each log to the console in realtime. For example running the command above prints:

InterAcc-€955.91-MNV-[019e1d2c-1889-7153-8a4c-4eefd0a8f565]-MNV-[019e1d2c-17a8-7004-9e13-bca17e175d08]
DEP-€658.52-MNV-[019e1d2c-188d-7597-acc8-1d4109803e4b]
InterAcc-€97.24-MNV-[019e1d2c-17a8-7004-9e13-bca17e175d08]-MNV-[019e1d2c-1889-7153-8a4c-4eefd0a8f565]
DRAW-€27.62-MNV-[019e1d2c-1887-7988-aa00-3f265d1b0614]
InterAcc-€766.38-MNV-[019e1d2c-1887-7988-aa00-3f265d1b0614]-MNV-[019e1d2c-188d-7597-acc8-1d4109803e4b]
InterAcc-€183.22-MNV-[019e1d2c-188d-7597-acc8-1d4109803e4b]-MNV-[019e1d2c-1889-7153-8a4c-4eefd0a8f565]
InterAcc-€235.06-MNV-[019e1d2c-1887-7988-aa00-3f265d1b0614]-MNV-[019e1d2c-1889-7153-8a4c-4eefd0a8f565]
DEP-€548.88-MNV-[019e1d2c-188d-7597-acc8-1d4109803e4b]
DEP-€326.47-MNV-[019e1d2c-188d-7597-acc8-1d4109803e4b]
DEP-€954.17-MNV-[019e1d2c-17a8-7004-9e13-bca17e175d08]
Bank closing, Teller Dpt. notified
Processed: 11 logs

multi command

Unlike the single command, this command can run multiple branches with multiple accounts efficiently (and independently to a certain degree).

# 5 branches; 5 tellers & 100 accounts each. Run at least 10,000 and at most 20,000 transactions in each branch
./banked.sh multi --accounts 100 --branches 5 --tellers 5 --transaction-policy random --min 10000 --max 20000

# Abbreviated
./banked.sh multi -a 100 -b 5 -t 5 -c random --min 10000 --max 20000

About

A simple end-to-end implementation of an in-person bank.

Resources

Stars

Watchers

Forks

Packages

Used by

Contributors

Languages