Skip to content

Laxman1509/BankingApplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏦 Banking System

A full-stack digital banking application built with Spring Boot and React. The platform supports secure customer banking operations, administrator account management, JWT-based authentication, role-based access control, and transaction history tracking.

πŸ“Œ Table of Contents

πŸ“– Overview

Banking System is a full-stack web application that provides a digital banking platform with two roles β€” Customer and Admin. Customers can register, create accounts, deposit and withdraw money, and view their transaction history. Admins can manage all users and accounts, including blocking and unblocking accounts. All APIs are secured using Spring Security and JWT authentication.

βœ… Features

πŸ‘€ Customer

  • Register and log in securely
  • View personal dashboard with account summary
  • Create savings or current bank accounts
  • Deposit and withdraw money
  • View passbook and full transaction history

πŸ›‘οΈ Admin

  • View all registered users
  • View all bank accounts
  • Block and unblock customer accounts
  • Role-based access β€” admin routes are fully protected

πŸ” Security

  • JWT-based stateless authentication
  • BCrypt password encryption
  • Role-based access control (CUSTOMER / ADMIN)
  • Secure REST APIs with Spring Security
  • Swagger UI for API documentation

πŸ› οΈ Tech Stack

Backend

Technology Purpose
Java 21 Core programming language
Spring Boot Backend framework
Spring Security Authentication and authorization
Spring Data JPA Database ORM
JWT Stateless token-based authentication
MySQL Relational database
Maven Build and dependency management
Swagger / OpenAPI API documentation

Frontend

Technology Purpose
React Frontend UI library
Vite Frontend build tool
React Router Client-side routing
Axios HTTP client for API calls
Bootstrap UI styling and layout
React Toastify Notification alerts

Project Structure

Banking Application/
β”œβ”€β”€ BankingSystem/                         # Spring Boot backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   β”‚   └── com/Laxman/BankingSystem/
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ config/            # Security, CORS, data initialization
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ controller/        # REST API controllers
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ dto/               # Request and response DTOs
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ entity/            # JPA entities
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ exception/         # Global exception handling
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ repository/        # Spring Data JPA repositories
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ security/          # JWT and authentication filters
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ service/           # Business logic
β”‚   β”‚   β”‚   β”‚       └── BankingSystemApplication.java
β”‚   β”‚   β”‚   └── resources/
β”‚   β”‚   β”‚       └── application.properties # Application configuration
β”‚   β”‚   └── test/                          # Backend tests
β”‚   β”œβ”€β”€ pom.xml                            # Maven dependencies
β”‚   β”œβ”€β”€ mvnw                               # Maven Wrapper for Linux/macOS
β”‚   └── mvnw.cmd                           # Maven Wrapper for Windows
β”‚
└── BankingSystem-Frontend/                # Frontend root
    β”œβ”€β”€ package.json                       # Root npm scripts
    └── banking-frontend/                  # React + Vite application
        β”œβ”€β”€ public/                        # Static public assets
        β”œβ”€β”€ src/
        β”‚   β”œβ”€β”€ api/                       # Axios API configuration
        β”‚   β”œβ”€β”€ assets/                    # Images and static frontend assets
        β”‚   β”œβ”€β”€ components/                # Reusable React components
        β”‚   β”œβ”€β”€ context/                   # Authentication context
        β”‚   β”œβ”€β”€ pages/
        β”‚   β”‚   β”œβ”€β”€ admin/                 # Admin dashboard and management pages
        β”‚   β”‚   β”œβ”€β”€ auth/                  # Login and registration pages
        β”‚   β”‚   └── user/                  # Customer banking pages
        β”‚   β”œβ”€β”€App.jsx                    # Application routes
        β”‚   β”œβ”€β”€ main.jsx                   # React entry point
        β”‚   └── index.css                  # Global styles
        β”œβ”€β”€ .env.example                   # Example frontend environment variables
        β”œβ”€β”€ package.json                   # Frontend dependencies and scripts
        β”œβ”€β”€ vite.config.js                 # Vite configuration
        └── index.html                     # HTML entry file

βš™οΈ Prerequisites

Make sure the following are installed on your machine before running the project:

Tool Version Purpose
Java 21 Run Spring Boot backend
Node.js + npm Latest LTS Run React frontend
MySQL 8.0+ Database
Git Any Version control

Maven is not required separately β€” the backend includes Maven Wrapper (mvnw.cmd).

πŸš€ Backend Setup

1. Navigate to the backend directory:

cd BankingSystem

2. Create the MySQL database:

CREATE DATABASE bankingDB;

3. Set environment variables (PowerShell):

$env:DB_URL="jdbc:mysql://localhost:3306/bankingDB"
$env:DB_USERNAME="root"
$env:DB_PASSWORD="your_mysql_password"
$env:JWT_SECRET="your-long-secure-jwt-secret-key"
$env:ADMIN_EMAIL="admin@banking.com"
$env:ADMIN_PASSWORD="your_admin_password"

4. Run the backend:

.\mvnw.cmd spring-boot:run

The backend starts on: http://localhost:8085

Swagger API docs available at: http://localhost:8085/swagger-ui.html

πŸ’» Frontend Setup

1. Navigate to the frontend directory:

cd BankingSystem-Frontend

2. Install dependencies:

npm install --prefix banking-frontend

3. Create a .env file inside banking-frontend/:

VITE_API_URL=http://localhost:8085

4. Run the frontend:

npm run dev

The frontend starts on: http://localhost:5173

If port 5173 is busy, Vite will automatically use the next available port (e.g. 5174).

πŸ”‘ Environment Variables

Backend

Variable Description Example
DB_URL MySQL connection URL jdbc:mysql://localhost:3306/bankingDB
DB_USERNAME Database username root
DB_PASSWORD Database password your_password
JWT_SECRET Secret key for JWT signing your-secret-key
JWT_EXPIRATION Token expiry (milliseconds) 86400000
ADMIN_EMAIL Default admin email admin@banking.com
ADMIN_PASSWORD Default admin password your_admin_password

Frontend

Variable Description
VITE_API_URL Backend base URL

⚠️ Never commit .env files to GitHub. They are already excluded in .gitignore.

πŸ“‘ API Endpoints

πŸ” Authentication

Method Endpoint Description Access
POST /api/auth/register Register a new user Public
POST /api/auth/login Login and get JWT token Public

πŸ’³ Customer APIs

Method Endpoint Description Access
GET /api/accounts Get user's accounts Customer
POST /api/accounts Create a new account Customer
GET /api/accounts/{accountNumber} Get account details Customer
POST /api/accounts/deposit Deposit money Customer
POST /api/accounts/withdraw Withdraw money Customer
GET /api/accounts/{accountNumber}/transactions Get transaction history Customer

πŸ›‘οΈ Admin APIs

Method Endpoint Description Access
GET /api/admin/users Get all registered users Admin
GET /api/admin/accounts Get all bank accounts Admin
PUT /api/admin/block/account/{accountNumber} Block an account Admin
PUT /api/admin/unblock/account/{accountNumber} Unblock an account Admin

πŸ”’ Security

  • Passwords are encrypted using BCrypt
  • Authentication uses JSON Web Tokens (JWT) β€” stateless and secure
  • Every protected API validates the JWT token on each request
  • Admin endpoints are restricted using role-based access control
  • Sensitive configuration is loaded from environment variables β€” never hardcoded
  • .env files, build outputs, and node_modules are excluded from Git via .gitignore

πŸ“¦ Build

Backend

cd BankingSystem
.\mvnw.cmd clean package

Output JAR will be in BankingSystem/target/

Frontend

cd BankingSystem-Frontend
npm run build --prefix banking-frontend

Output will be in BankingSystem-Frontend/banking-frontend/dist/

πŸ‘¨β€πŸ’» Author

Laxman Sah

  • πŸŽ“ MCA Student β€” C-DAC, Noida (GGSIPU, Delhi)
  • πŸ’Ό Java Backend Developer | Spring Boot Enthusiast
  • πŸ™ GitHub: Laxman1509
  • πŸ“§ Email: laxmansah1503@gmail.com

⭐ If you found this project useful, consider giving it a star on GitHub!

About

Secure Banking System REST API built with Java 21, Spring Boot, Spring Security, JWT, Spring Data JPA, and MySQL. Includes user authentication, account creation, deposits, withdrawals, transaction history, role-based admin access, account blocking/unblocking, validation, and Swagger API documentation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors