Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

πŸ’° Wallet Application

A full-stack digital wallet application built with Java Spring Boot backend and vanilla HTML/CSS/JavaScript frontend. Users can register, log in, check their balance, and send money to other users.


✨ Features

  • User Registration β€” Sign up with email & password, receive β‚Ή1000 starting balance
  • User Login β€” Authenticate with email and password
  • Balance Dashboard β€” View current wallet balance in real-time
  • Money Transfer β€” Send money to any registered user
  • Error Handling β€” Prevents self-transfers, insufficient balance, duplicate accounts, and invalid credentials
  • Transactional Safety β€” Money transfers use @Transactional for atomicity

πŸ› οΈ Tech Stack

Layer Technology
Backend Java 17+, Spring Boot 3.2.5
Database H2 (in-memory relational DB)
ORM Spring Data JPA / Hibernate
Frontend HTML5, CSS3, Vanilla JavaScript
API Format RESTful JSON
Build Tool Maven 3.9.6 (wrapper included)

πŸ“ Project Structure

Wallet/
β”œβ”€β”€ README.md
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ pom.xml
β”‚   β”œβ”€β”€ mvnw.cmd
β”‚   β”œβ”€β”€ .mvn/wrapper/
β”‚   └── src/main/
β”‚       β”œβ”€β”€ java/com/wallet/
β”‚       β”‚   β”œβ”€β”€ WalletApplication.java          # Spring Boot entry point
β”‚       β”‚   β”œβ”€β”€ model/
β”‚       β”‚   β”‚   └── User.java                   # JPA Entity (id, email, password, balance)
β”‚       β”‚   β”œβ”€β”€ repository/
β”‚       β”‚   β”‚   └── UserRepository.java         # Spring Data JPA Repository
β”‚       β”‚   β”œβ”€β”€ service/
β”‚       β”‚   β”‚   └── WalletService.java          # Business logic with @Transactional
β”‚       β”‚   β”œβ”€β”€ controller/
β”‚       β”‚   β”‚   └── WalletController.java       # REST API endpoints
β”‚       β”‚   └── config/
β”‚       β”‚       └── WebConfig.java              # CORS configuration
β”‚       └── resources/
β”‚           β”œβ”€β”€ application.properties          # H2 & JPA configuration
β”‚           └── static/                         # Frontend served by Spring Boot
β”‚               β”œβ”€β”€ login.html
β”‚               β”œβ”€β”€ dashboard.html
β”‚               β”œβ”€β”€ send.html
β”‚               └── style.css
└── frontend/                                   # Standalone frontend files
    β”œβ”€β”€ login.html
    β”œβ”€β”€ dashboard.html
    β”œβ”€β”€ send.html
    └── style.css

πŸš€ Getting Started

Prerequisites

  • Java 17 or higher installed (Download)
  • No Maven installation needed β€” Maven wrapper is included

Run the Application

# Clone the repository
git clone https://github.com/atharv01h/Wallet-App.git
cd wallet-app/backend

# Start the Spring Boot server (Windows)
.\mvnw.cmd spring-boot:run

# Start the Spring Boot server (Linux/Mac)
./mvnw spring-boot:run

Note: First run downloads all dependencies and may take a few minutes. Subsequent runs are much faster.

Open in Browser

Navigate to: http://localhost:8080/login.html


πŸ“‘ API Endpoints

Method Endpoint Description Request Body
POST /api/register Register a new user { "email": "...", "password": "..." }
POST /api/login Login with credentials { "email": "...", "password": "..." }
GET /api/balance?email=... Get wallet balance β€”
POST /api/send Transfer money { "fromEmail": "...", "toEmail": "...", "amount": 100 }

Example API Usage (cURL)

# Register
curl -X POST http://localhost:8080/api/register \
  -H "Content-Type: application/json" \
  -d '{"email":"alice@wallet.com","password":"pass123"}'

# Login
curl -X POST http://localhost:8080/api/login \
  -H "Content-Type: application/json" \
  -d '{"email":"alice@wallet.com","password":"pass123"}'

# Check Balance
curl http://localhost:8080/api/balance?email=alice@wallet.com

# Send Money
curl -X POST http://localhost:8080/api/send \
  -H "Content-Type: application/json" \
  -d '{"fromEmail":"alice@wallet.com","toEmail":"bob@wallet.com","amount":250}'

πŸ–₯️ Application Pages

Login / Register

  • Enter email and password
  • Click "Create Account" to register (β‚Ή1000 default balance)
  • Click "Sign In" to log in

Dashboard

  • View your current wallet balance
  • Navigate to send money or logout
  • Refresh balance button for real-time updates

Send Money

  • Enter recipient's email and amount
  • Submit to transfer funds instantly
  • Error messages shown for invalid operations

βš™οΈ Business Rules

Rule Description
Default Balance New users receive β‚Ή1000 on registration
Self-Transfer Cannot send money to yourself
Insufficient Funds Cannot send more than your available balance
Duplicate Email Cannot register with an already-used email
Positive Amount Transfer amount must be greater than zero

πŸ—„οΈ Database

The app uses H2 in-memory database β€” all data resets on server restart.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     HTTP/JSON     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend   β”‚ ◄──────────────► β”‚           Spring Boot Backend        β”‚
β”‚  (HTML/JS)   β”‚                  β”‚                                      β”‚
β”‚              β”‚                  β”‚  Controller β†’ Service β†’ Repository   β”‚
β”‚  login.html  β”‚                  β”‚      ↓           ↓          ↓        β”‚
β”‚  dashboard   β”‚                  β”‚  REST API    Business    JPA/H2 DB   β”‚
β”‚  send.html   β”‚                  β”‚              Logic                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ License

This project is open source and available for educational purposes.


πŸ‘¨β€πŸ’» Created By

Atharv Hatwar

About

A full-stack digital wallet application built with Java Spring Boot backend and vanilla HTML/CSS/JavaScript frontend. Users can register, log in, check their balance, and send money to other users.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages