A console-based banking system written in C that demonstrates account management, authentication, file-based persistence, transfers, and transaction history β without an external database.
π Learning project: built to practice C programming, structs, file I/O, functions, input validation, error handling, and basic application architecture.
β οΈ Important: this is an educational simulation, not production banking software. Do not use real credentials, personal financial data, or real money.
- π€ Create bank accounts with year-based IDs (
2026/1,2026/2,2026/3, ...) - π₯οΈ Styled terminal interface with reusable ANSI color helpers and
NO_COLORsupport - π Customer dashboard with account summary and the five most recent transactions
- π Change PIN from the authenticated account menu
- π¦ Limit each login session to three authentication attempts
- π PIN-protected login with 4-digit validation
- π° Deposit and withdraw money
- π Transfer money between accounts
- π Check account balance
- π§Ύ View timestamped transaction history
- π List active demo accounts
- ποΈ Delete accounts only after the balance reaches zero
- πΎ Persistent storage using binary files
- π‘οΈ Defensive input validation and file-write checks
- π§° Simple
Makefilebuild and test workflow - π€ GitHub Actions CI for automated build and smoke testing
- π₯οΈ Runs on Linux, macOS, and Windows with a compatible C11 toolchain
- GCC or another C11-compatible compiler
- Make (recommended)
makeOr compile directly:
gcc -Wall -Wextra -Wpedantic -std=c11 -O2 -o banking_system banking_system.cLinux/macOS/WSL:
./banking_systemWindows (MinGW):
banking_system.exeUse the following commands during development:
make # build the application
make test # run the smoke/regression tests
make sanitize # build with sanitizers
make verify # run the complete local verification workflowThe repository also runs automated checks through GitHub Actions on pushes and pull requests.
The project uses a small regression/smoke suite to catch common failures in account creation, startup, invalid input, and transfer behavior.
- Successful compilation with the configured C11 flags
- Account creation and persisted runtime data
- Clean program startup and exit
- Invalid input handling
- Self-transfer rejection
- Temporary test-data cleanup
Install a C toolchain and Make. On Windows, MinGW/MSYS2 or another GCC-compatible environment can provide both.
Check that GCC is available in your terminal:
gcc --versionIf the command is unavailable, install GCC and add it to your system PATH.
The application normally creates accounts.dat and transactions.dat in the working directory. The automated smoke test uses temporary test data and cleans it up when it finishes.
If you want to reset a local demo manually, first make sure the program is not running, then remove the generated runtime files:
Linux/macOS/WSL:
rm -f accounts.dat transactions.datWindows PowerShell:
Remove-Item accounts.dat, transactions.dat -ErrorAction SilentlyContinueThese files contain local demo data and should remain untracked; do not commit them to the repository.
make sanitize depends on compiler sanitizer support. If your toolchain does not provide AddressSanitizer, use make test and the normal make build, then report the toolchain details when opening an issue.
================ BANKING SYSTEM ================
1. Create Account
2. Login
3. List All Accounts (demo)
4. Exit
==================================================
Choose an option: 1
=== Create New Account ===
Enter full name: Alex Kumar
Set a 4-digit PIN: 1234
Enter initial deposit amount: 5000
Account created successfully!
Your account number is: 2026/1
Account IDs use a readable YYYY/N format. New accounts in the current configured account year start at 2026/1 and continue sequentially (2026/2, 2026/3, ...). The sequence is persisted with the account data, so deleted accounts do not cause an existing ID to be reused. For example, if 2026/1 and 2026/2 already exist and 2026/1 is deleted, the next new account remains 2026/3, not 2026/1. After login, users can check their balance, deposit, withdraw, transfer funds, review transactions, or delete an account after its balance reaches zero.
- Create an account and note the generated
YYYY/Naccount number. - Log in with the account number and 4-digit PIN.
- Use deposits, withdrawals, transfers, and transaction history from the account menu.
- Keep the account balance at zero before deleting the account.
This flow is intended for local learning and testing; runtime data stays in the ignored accounts.dat and transactions.dat files.
This project is useful for students learning C because it combines several concepts in one application:
struct-based data modeling- Functions and modular program flow
- Binary file read/write operations
- Account lookup and record updates
- Year-based sequential account ID generation (
YYYY/N) - Transaction logging
- Basic authentication
- Robust line-based input parsing
- Persistent local application state
- Make-based compilation and testing
- Continuous integration with GitHub Actions
The application follows a simple file-backed design:
User Input β Menu/Validation β Account Operations β File Storage
β
Transaction Logging
Core responsibilities are kept in banking_system.c, while the tests/ directory contains regression checks and .github/workflows/ runs the automated CI workflow.
.
βββ .github/
β βββ ISSUE_TEMPLATE/
β β βββ bug_report.md
β β βββ feature_request.md
β βββ workflows/
β βββ ci.yml
βββ tests/
β βββ smoke_test.sh
βββ banking_system.c
βββ ui.h
βββ Makefile
βββ LICENSE
βββ CONTRIBUTING.md
βββ SECURITY.md
βββ README.md
βββ .gitignore
accounts.dat and transactions.dat are generated locally at runtime and are intentionally excluded from Git.
This is an educational project, not production banking software.
The current implementation intentionally keeps the design simple. In particular:
- PINs are stored as plaintext in the local binary account file.
- Account and transaction files are not encrypted at rest.
- The three-attempt login limit applies only to one login session; it is not persistent rate limiting or a production-grade lockout.
- PINs remain stored in plaintext in the local binary account file.
- The demo account directory displays account data and should not be treated as a real bank interface.
- File operations are designed for a simple local application, not concurrent users.
- There is no real bank/payment integration.
See SECURITY.md for the project's security notes and responsible-reporting guidance.
Potential next improvements:
- Hash PINs with a vetted password-hashing library
- Replace floating-point money with integer cents
- Add comprehensive automated unit/integration tests
- Make transfers fully atomic with stronger storage guarantees
- Add account statements/export
- Add a styled terminal UI and customer dashboard
- Add customer PIN change and a three-attempt login limit
- Add account statements/export
- Add transaction filtering by date and type
- Add login retry limits and lockout
- Improve cross-platform tooling
- Make the account year configurable instead of compile-time configured
- Add a database-backed version for comparison
Contributions are welcome β especially improvements that make the project safer, easier to understand, or more useful for C learners.
- Build the project with
make. - Run
make testto execute the regression checks. - Run
make verifywhen changing core behavior. - Keep generated runtime files such as
accounts.datandtransactions.datout of commits. - Explain the behavior change and testing performed in the pull request description.
See CONTRIBUTING.md for development guidelines. Bug reports and feature ideas can also use the repository's issue templates.
If this project helped you learn C, file handling, or application design, consider starring the repository. A genuine star helps other learners discover the project.
Issues, pull requests, documentation improvements, and constructive feedback are also welcome.
Released under the MIT License. See LICENSE for details.
Prabhjot Singh Gill
GitHub: @prabhtheone
c c-programming c11 banking-system banking finance console-application file-handling file-io binary-files authentication transaction-history makefile github-actions smoke-test beginner-project student-project learning-c systems-programming