{"id":25877199,"url":"https://github.com/andytrix/atm-cash-machine","last_synced_at":"2026-02-17T10:38:48.140Z","repository":{"id":279945136,"uuid":"939943294","full_name":"andytrix/atm-cash-machine","owner":"andytrix","description":"ATM simulator built with Qt, Node.js, and MySQL, featuring authentication, transactions, and card management for a real banking experience.","archived":false,"fork":false,"pushed_at":"2025-02-28T10:47:47.000Z","size":1199,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T02:41:17.649Z","etag":null,"topics":["atm","automat","automated","bank","bank-automat","bankautomat","cash","cash-machine","database","machine","mysql","node-js","oamk","qt","rest-api","simulator","sql","teller","transactions","transfer"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andytrix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-27T11:10:03.000Z","updated_at":"2025-03-03T07:42:03.000Z","dependencies_parsed_at":"2025-02-28T17:25:32.231Z","dependency_job_id":"029e9fa4-108a-4ff3-8d93-ae06d7434190","html_url":"https://github.com/andytrix/atm-cash-machine","commit_stats":null,"previous_names":["andytrix/atm-cash-machine"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andytrix/atm-cash-machine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andytrix%2Fatm-cash-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andytrix%2Fatm-cash-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andytrix%2Fatm-cash-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andytrix%2Fatm-cash-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andytrix","download_url":"https://codeload.github.com/andytrix/atm-cash-machine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andytrix%2Fatm-cash-machine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29540247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T08:11:05.436Z","status":"ssl_error","status_checked_at":"2026-02-17T08:09:38.860Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atm","automat","automated","bank","bank-automat","bankautomat","cash","cash-machine","database","machine","mysql","node-js","oamk","qt","rest-api","simulator","sql","teller","transactions","transfer"],"created_at":"2025-03-02T11:19:12.088Z","updated_at":"2026-02-17T10:38:48.111Z","avatar_url":"https://github.com/andytrix.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ATM Cash Machine\n\nExperience a full-featured ATM simulator powered by Qt, Node.js, and MySQL. With secure authentication, dynamic transactions, and comprehensive card management, it brings the authentic feel of real-world banking right to your screen.\n\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/049496ca-0f47-4c48-813c-28f51802c0b7\" \n       alt=\"ATM 1\" width=\"480\" style=\"margin-right: 10px;\" /\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/2e31eb09-a4d5-45df-8d2d-3d76bdf1618b\"\n       alt=\"ATM 2\" width=\"480\" /\u003e\n\u003c/p\u003e\n\n# Contents\n\n- [Introduction](#atm-cash-machine)\n- [Features](#features)\n- [Technology Stack](#technology-stack)\n- [Installation \u0026 Setup](#installation--setup)\n- [Creating a User and Linking a Card](#creating-a-user-and-linking-a-card)\n- [Directory Structure](#directory-structure)\n- [System, Database \u0026 Class Architecture](#system-database--class-architecture)\n  - [Entity-Relationship (ER) Diagram](#entity-relationship-er-diagram)\n  - [Deployment Diagram](#deployment-diagram)\n  - [Class Diagram](#class-diagram)\n\n# Features\n\n- **User Authentication:** Login with a PIN-based system secured using bcrypt hashing\n- **Banking Transactions:** Deposit, withdraw, and transfer money\n- **Card Management:** Multiple card types with status tracking (active, locked, inactive)\n- **Card Types:** Supports debit cards, credit cards, and dual cards (credit/debit)\n- **Database Integration:** MySQL-based backend with structured data storage\n- **Multi-Language Support:** Available in Finnish, Swedish, and English\n- **Profile Picture Upload:** Users can add their own profile picture\n- **PIN Code Change:** Users can securely update their PIN code\n- **Auto Logout Timer:** 30 seconds timeout from Main Menu, 10 seconds timeout in other views\n- **Realistic Interface:** Built with Qt for an authentic ATM experience\n\n# Technology Stack\n\nFrontend: Qt Creator (C++)  \nBackend: Node.js with Express.js  \nDatabase: MySQL\n\n# Installation \u0026 Setup\n\n**Prerequisites**\n\nMake sure you have the following installed on your system:\n\n- Qt Creator (for UI development)\n- Node.js \u0026 npm (for backend)\n- MySQL Server (for database storage)\n\n**1. Clone the Repository**\n\n```bash\ngit clone https://github.com/andytrix/atm-cash-machine.git  \ncd atm-cash-machine\n```\n**2. Setup the Database**\n\n- Start your MySQL server.\n- (Optional) Create the bankuser account if it does not exist yet. Log into MySQL (e.g., mysql -u root -p) and run:\n- \n ```bash\nCREATE USER 'bankuser'@'localhost' IDENTIFIED BY 'bankuser';\nGRANT ALL PRIVILEGES ON *.* TO 'bankuser'@'localhost';\nFLUSH PRIVILEGES;\n```\n\n- Import the database schema from the project directory (where db_dump.sql is located):\n\n```bash\nmysql -u root -p \u003c db_dump.sql\n```\n\n**3. Configure Environment Variables**\n\nUse the .env file as a template or create a .env file in the backend directory with the following content:\n\n```bash\nDB_HOST=127.0.0.1\nDB_USER=bankuser\nDB_PASS=bankuser\nDB_NAME=bank-automat\nMY_TOKEN=supersecret\nDB_PORT=3306\n```\n\n**4. Start the Backend Server**\n\n```bash\ncd backend  \nnpm install\nnpm start  \n```\nBy default, the server will listen on http://localhost:3000.\n\n**5. Run the Qt Application**\n\n- Open Qt Creator.\n- Load the project file (.pro).\n- Build and run the application.\n\n**6. Testing**\nYou can test the backend endpoints using a tool like Postman or your web browser (e.g. http://localhost:3000/account).\nIf your login route is something like POST /login, you’ll likely need to provide a card number and a PIN (which is hashed in the database).\nOn successful login, the server should return a token. Copy that token from the response.\nOn subsequent requests to protected endpoints, include the token in an Authorization: Bearer \u003ctoken\u003e header.\n\n# Creating a User and Linking a Card\n\n**Creating a User with a Single (Debit) Card**\n\nInsert a new customer:\n\n```bash\nINSERT INTO customer (idcustomer, fname, lname, thumbnail, created_at)\nVALUES (1, 'John', 'Doe', 'example.png', NOW());\n```\n- idcustomer is the primary key.\n- fname and lname are the user’s first and last names.\n- thumbnail can be any image filename or NULL if you’re not using profile pictures.\n\nInsert a new card:\n\n```bash\nINSERT INTO card (idcard, idcustomer, pin, cardtype, status, created_at, expiry_date)\nVALUES (\n    1,\n    1,\n    '$2a$10$Kf86Rkz9gt21rvkgX4/t6eWSaaH65ZECxywqQkIvouezrur9ZYZNC',  -- hashed PIN for \"1234\"\n    'single',  -- indicates this is a single-type card (debit or credit)\n    'active',\n    NOW(),\n    '2030-12-31 00:00:00'\n);\n```\n\n- cardtype='single' means this card is either debit or credit. We’ll link it as debit in the next steps.\n- status='active' indicates the card is ready for use.\n\nInsert a debit account:\n\n```bash\nINSERT INTO account (idaccount, idcustomer, type, credit_balance, credit_limit, debit_balance, created_at)\nVALUES (\n    1,\n    1,\n    'debit',\n    0.00,\n    0.00,\n    1000.00,  -- e.g., an initial debit balance\n    NOW()\n);\n```\n\n- type='debit' marks this account as a debit account.\n- debit_balance is the current amount of money available.\n\nLink the card to the account:\n\n```bash\nINSERT INTO card_account (idcard_account, idcard, idaccount, type)\nVALUES (\n    1,\n    1,\n    1,\n    'debit'\n);\n```\n\n- This tells the system that card 1 is associated with account 1 in a debit capacity.\n\nAt this point, you have:\n\n- One customer (idcustomer=1)\n- One card (idcard=1)\n- One debit account (idaccount=1)\n- A card_account link specifying that card #1 is a debit card for account #1.\n\n**Creating a User with a Dual Card (Debit + Credit)**\n\nInsert a customer (If you’re using the same customer as above, you can skip re-inserting them. Otherwise, insert a new one with a unique idcustomer):\n\n```bash\nINSERT INTO customer (idcustomer, fname, lname, thumbnail, created_at)\nVALUES (\u003cunique idcustomer\u003e, 'Jane', 'Doe', 'example.png', NOW());\n```\nInsert a new card:\n\n```bash\nINSERT INTO card (idcard, idcustomer, pin, cardtype, status, created_at, expiry_date)\nVALUES (\n    2,\n    1,\n    '$2a$10$Kf86Rkz9gt21rvkgX4/t6eWSaaH65ZECxywqQkIvouezrur9ZYZNC',  -- hashed PIN for \"1234\"\n    'dual',   -- indicates a dual card\n    'active',\n    NOW(),\n    '2030-12-31 00:00:00'\n);\n```\n- cardtype='dual' means this single card can handle both debit and credit.\n\nInsert a credit account:\n\n```bash\nINSERT INTO account (idaccount, idcustomer, type, credit_balance, credit_limit, debit_balance, created_at)\nVALUES (\n    2,\n    1,\n    'credit',\n    0.00,\n    2000.00,  -- for example, a 2000 credit limit\n    0.00,\n    NOW()\n);\n```\n\nInsert a debit account:\n\n```bash\nINSERT INTO account (idaccount, idcustomer, type, credit_balance, credit_limit, debit_balance, created_at)\nVALUES (\n    3,\n    1,\n    'debit',\n    0.00,\n    0.00,\n    1500.00,  -- e.g., an initial debit balance\n    NOW()\n);\n```\nLink the card to both accounts:\n\n```bash\nINSERT INTO card_account (idcard_account, idcard, idaccount, type)\nVALUES \n    (2, 2, 3, 'debit'),\n    (3, 2, 2, 'credit');\n```\n\nHere we create two links:\n\n- idcard_account=2 for the debit account (account #3)\n- idcard_account=3 for the credit account (account #2)\n\n# Directory Structure\n\n``` ATM/\n├── LICENSE                    # The license file specifying terms for using this project.\n├── README.md                  # The main README file explaining the project.\n├── .gitignore                 # Specifies files and directories to be ignored by Git.\n├── db_dump.sql                # SQL file containing the initial database schema.\n├── ER-diagram.png             # Entity-Relationship (ER) diagram visualizing the database structure.\n├── Class_Diagram.png          # Class diagram representing object-oriented relationships in the project.\n├── Deployment_Diagram.png     # Deployment diagram illustrating the system's deployment architecture.\n├── backend/                   \n│   ├── bin/                   # Holds executables or compiled files related to backend.\n│   ├── www/                   # Contains web-related resources for the backend.\n│   ├── .env                   # Example environment file with placeholder data;\n│   ├── models/                \n│   │   ├── account_model.js   # Defines the account model.\n│   │   ├── card_account_model.js # Manages the relationship between cards and accounts.\n│   │   ├── card_model.js      # Defines the card model.\n│   │   ├── customer_model.js  # Manages customer-related data.\n│   │   └── transaction_model.js # Manages transaction-related data.\n│   ├── public/                \n│   │   ├── stylesheets/\n│   │   │   └── style.css      # The stylesheet for the web interface.\n│   │   ├── images/            # Stores user-uploaded images, such as profile pictures.\n│   │   └── index.html         # The main HTML file for the web frontend.\n│   ├── routes/                \n│   │   ├── account.js         # Routes for account-related operations.\n│   │   ├── card.js            # Routes for card-related operations.\n│   │   ├── card_account.js    # Routes for linking cards and accounts.\n│   │   ├── customer.js        # Routes for customer-related operations.\n│   │   ├── index.js           # The entry point for initializing the backend.\n│   │   ├── login.js           # Handles login-related routes.\n│   │   └── transaction.js     # Routes for transaction-related operations.\n│   ├── app.js                 # The main backend application file that sets up and configures middleware.\n│   ├── create_token.js        # Handles token creation for secure communication.\n│   ├── database.js            # Manages database connections and queries.\n│   ├── package-lock.json      # The exact versions of npm dependencies.\n│   └── package.json           # Defines the dependencies and scripts for the backend.\n├── bank-automat/\n│   ├── balance.cpp            # Implements balance-related logic.\n│   ├── balance.h              # Header file for balance functionality.\n│   ├── balance.ui             # The UI for displaying balance information.\n│   ├── bank-automat.pro       # Qt project file for the ATM application.\n│   ├── cardmode.cpp           # Implements the logic for card mode.\n│   ├── cardmode.h             # Header file for card mode functionality.\n│   ├── cardmode.ui            # The UI for card mode.\n│   ├── customerdata.cpp       # Implements customer data functionality.\n│   ├── customerdata.h         # Header file for customer data functionality.\n│   ├── customerdata.ui        # The UI for displaying customer information.\n│   ├── environment.cpp        # Implements environment configuration functionality.\n│   ├── environment.h          # Header file for environment configuration.\n│   ├── login.cpp              # Implements login functionality.\n│   ├── login.h                # Header file for login functionality.\n│   ├── login.ui               # The UI for the login screen.\n│   ├── main.cpp               # The main entry point for the ATM application.\n│   ├── mainmenu.cpp           # Implements the main menu logic.\n│   ├── mainmenu.h             # Header file for the main menu.\n│   ├── mainmenu.ui            # The UI for the main menu.\n│   ├── mainwindow.cpp         # Implements the main window logic.\n│   ├── mainwindow.h           # Header file for the main window.\n│   ├── mainwindow.ui          # The UI for the main window.\n│   ├── transaction.cpp        # Implements transaction functionality.\n│   ├── transaction.h          # Header file for transaction functionality.\n│   ├── transaction.ui         # The UI for displaying transaction information.\n│   ├── transfer.cpp           # Implements money transfer logic.\n│   ├── transfer.h             # Header file for money transfer functionality.\n│   ├── transfer.ui            # The UI for transferring money.\n│   ├── withdraw.cpp           # Implements withdrawal functionality.\n│   ├── withdraw.h             # Header file for withdrawal functionality.\n│   └── withdraw.ui            # The UI for withdrawal operations.\n```\n\n# System, Database \u0026 Class Architecture\n\nThe system is structured into multiple tables:\n\n- **customer:** Stores user details, including first name, last name, profile picture, and account creation date.\n- **card:** Holds card-specific data, including debit, credit, and dual card types, PIN codes, status (active, locked, inactive), and expiry date.\n- **card_account:** Links cards to accounts and defines whether the link is debit or credit.\n- **account:** Tracks account balances, credit limits, and account creation date.\n- **transaction:** Logs all ATM transactions, including withdrawals and deposits.\n\n### **Entity-Relationship (ER) Diagram**\n\nBelow is the ER diagram representing the database structure:  \n\n\u003cimg width=\"886\" alt=\"ER Diagram\" src=\"https://github.com/andytrix/atm-cash-machine/blob/main/ER-diagram.png\" /\u003e\n\n### **Deployment Diagram**\n\nShows how software components are distributed across different hardware and network nodes:  \n\n![Deployment Diagram](https://github.com/andytrix/atm-cash-machine/blob/main/Deployment_Diagram.png)\n\n### **Class Diagram**\n\nIllustrates the relationships between key classes in the project:  \n\n![Class Diagram](https://github.com/andytrix/atm-cash-machine/blob/main/Class_Diagram.png)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandytrix%2Fatm-cash-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandytrix%2Fatm-cash-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandytrix%2Fatm-cash-machine/lists"}