ATM CLI is a simple and interactive ATM (Automated Teller Machine) CLI-based app created with Commander.js library. It uses MySQL as a local running database.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
The things you need before cloning the app.
- MySQL 8.0 installed
- Git installed (optional but recommended)
- Your favorite Code Editor app! (VSCode, Sublime, etc.)
A step by step guide that will tell you how to get the development environment up and running.
Using Git
git clone https://github.com/raulmaulidhino-dev/atm-cli.git
cd atm-cli
npm install
Or you can also install the zip file and unzip it after installation. Open the atm-cli folder and run
npm install
Use the following command to log in to your MySQL server:
mysql -u your_username -pReplace your_username with your MySQL username (e.g., root).
You will be prompted to enter your MySQL password.
Once logged in, run the following SQL command to create a new database:
CREATE DATABASE your_database_name;Replace your_database_name with the name you want for your database (e.g., atm_db).
You can then select it:
USE your_database_name;Import the model/atm_db.sql database schema file from the terminal (exit MySQL first):
mysql -u your_username -p your_database_name < model/atm_db.sqlYou can rename the .env.example file into .env and replace the content inside based on your MySQL server data
DB_HOST="localhost"
DB_USER="your_username"
DB_PASSWORD="your_password"
DB_NAME="your_database_name"- Make sure MySQL is installed and running on your machine.
- If you face permission issues, try running the command with
sudo(on Unix-based systems).
node atm register -n <name> -pe.g.
node atm register -n john -pYou will be prompted to enter your PIN.
node atm login -n <name> -pe.g.
node atm login -n john -pYou will be prompted to enter your PIN.
node atm check-balancenode atm deposit <amount>e.g.
node atm deposit 61.74node atm withdraw <amount>e.g.
node atm withdraw 11.42node atm transfer <amount> -t <target_account_id>e.g.
node atm transfer 10 -t 2- After logging in, account session will be saved inside
session/session.json, forever! Until you remove it manually~ check-balance,deposit,withdraw,transferonly work if the current login session insession/session.jsonexists- To learn and explore more about the commands and flags, run this command:
node atm -h--
Made with ❤️ in Indonesia 🇮🇩
MIT © Raul Maulidhino