A robust Java-based banking system demonstrating enterprise-level design patterns and clean architecture principles. This application provides core banking functionalities including account management, secure authentication, and financial transactions, all backed by a MySQL database.
- Features
- Architecture
- Prerequisites
- Installation
- Database Setup
- Configuration
- Usage
- Project Structure
- Design Patterns
- Contributing
-
User Management
- Create new user accounts with secure credential storage
- Authenticate users with login validation
- Builder pattern implementation for clean object construction
-
Account Operations
- View real-time account balance
- Deposit funds with transaction logging
- Withdraw money with insufficient funds validation
- Transfer funds between accounts securely
-
Data Persistence
- All transactions stored in MySQL database
- ACID-compliant operations
- Data survives application restarts
-
Clean Architecture
- DAO (Data Access Object) layer for database operations
- Service layer for business logic
- Separation of concerns following SOLID principles
This project follows a layered architecture pattern:
Presentation Layer ← Console UI / Main Class
Service Layer ← Business Logic
DAO Layer ← Data Access Objects
Database Layer (MySQL) ← Persistence
| Layer | Purpose | Example Classes |
|---|---|---|
| Presentation | User interaction, input/output | Main.java, BankingApp.java |
| Service | Business rules, transaction logic | TransactionService, AuthService |
| DAO | Database queries, CRUD operations | UserDAO, AccountDAO |
| Model | Entity definitions | User, Account, Transaction |
Before running this application, ensure you have:
-
Java Development Kit (JDK) 8 or higher
-
MySQL Server 5.7 or higher
-
MySQL JDBC Driver (
mysql-connector-j-9.3.0.jaror compatible version) -
Download from MySQL Official Site
git clone https://github.com/KavishkaVenuka/Java--BankApp.git cd Java--BankApp
- Download the MySQL Connector/J driver
- Add the JAR file to your project's classpath:
- IDE Users: Add to project libraries
- Command Line: Use
-cpflag when running
mysql -u root -p
CREATE DATABASE bankingapp; USE bankingapp;
Navigate to the /sql directory and execute the database schema:
Navigate to the /sql directory and execute the database schema:
mysql -u root -p abc_bank < sql/database.sql
Expected Tables:
users- Stores user credentials and personal informationaccounts- Contains account details and balancestransactions- Logs all financial operations
Locate the database configuration file (typically DatabaseConnection.java in /src/util/) and update with your credentials:
private static final String URL = "jdbc:mysql://localhost:3306/bankingapp"; private static final String USERNAME = "your_mysql_username"; private static final String PASSWORD = "your_mysql_password";
Security Note: For production use, consider using environment variables or external configuration files instead of hardcoding credentials.
Using Command Line: Compile javac -cp .:mysql-connector-j-9.3.0.jar src/**/*.java -d bin
Run java -cp bin:mysql-connector-j-9.3.0.jar Main
Using IDE:
- Import the project
- Add MySQL JDBC driver to build path
- Run
Main.java
-
Create Account
- Enter personal details
- System generates unique account number
- Account stored in database
-
Login
- Authenticate with credentials
- Access account features
-
Perform Transaction
- Select deposit/withdraw/transfer
- System validates and executes
- Transaction logged in database
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Add interest calculation for savings accounts
- Implement transaction history view
- Add email notifications for transactions
- Create GUI using JavaFX or Swing
- Add multi-currency support
- Implement account statements (PDF generation)
- Add admin panel for account management
This project is licensed under the MIT License - see the LICENSE file for details.
Kavishka Venuka
- GitHub: @KavishkaVenuka
- Java JDBC documentation
- MySQL documentation
- Design patterns community resources
⭐ Star this repository if you found it helpful!
For questions or issues, please open an issue on GitHub.