Skip to content

A complete backend system for UPI (Unified Payments Interface) using Java & Spring Boot - secure, scalable, and sandbox-ready.

Notifications You must be signed in to change notification settings

Github-Saurabh0/Design-a-backend-for-upi-using-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UPI Backend System using Java & Spring Boot

A comprehensive backend system for UPI (Unified Payment Interface) built with Java and Spring Boot.

Note: This is a simulated backend intended for learning and prototyping. Real UPI integration requires approval from NPCI/RBI.

Features

  • User authentication and authorization with JWT
  • Bank account management
  • Virtual Payment Address (VPA) management
  • Transaction processing
  • Role-based access control
  • API documentation with Swagger/OpenAPI

Technology Stack

  • Java 17
  • Spring Boot 2.7.x
  • Spring Security
  • Spring Data JPA
  • PostgreSQL (with H2 for testing)
  • JWT for authentication
  • Lombok for reducing boilerplate code
  • ModelMapper for DTO conversions
  • Swagger/OpenAPI for API documentation

Project Structure

src/main/java/com/upi/
├── config/                  # Configuration classes
├── controller/              # REST controllers
├── dto/                     # Data Transfer Objects
│   ├── auth/                # Authentication DTOs
│   ├── bank/                # Bank account DTOs
│   ├── transaction/         # Transaction DTOs
│   └── vpa/                 # VPA DTOs
├── exception/               # Exception handling
├── model/                   # Entity classes
├── repository/              # JPA repositories
├── security/                # Security configuration
│   ├── jwt/                 # JWT utilities
│   └── services/            # Security services
├── service/                 # Service interfaces
│   └── impl/                # Service implementations
└── util/                    # Utility classes

Getting Started

Prerequisites

  • Java 17 or higher
  • Maven 3.6 or higher
  • PostgreSQL 12 or higher

Database Setup

  1. Create a PostgreSQL database named upidb:
CREATE DATABASE upidb;
  1. Update the database configuration in application.properties if needed:
spring.datasource.url=jdbc:postgresql://localhost:5432/upidb
spring.datasource.username=postgres
spring.datasource.password=postgres

Building and Running

  1. Clone the repository:
git clone https://github.com/Github-Saurabh0/Design-a-backend-for-upi-using-Java.git
cd Design-a-backend-for-upi-using-Java
  1. Build the project:
mvn clean install
  1. Run the application:
mvn spring-boot:run

The application will start on port 8080 by default.

API Documentation

Swagger UI is available at: http://localhost:8080/swagger-ui.html

API docs are available at: http://localhost:8080/api-docs

Authentication

Register a new user

POST /api/auth/signup

Request body:

{
  "username": "johndoe",
  "firstName": "John",
  "lastName": "Doe",
  "email": "[email protected]",
  "phone": "1234567890",
  "password": "password123",
  "roles": ["user"]
}

Login

POST /api/auth/signin

Request body:

{
  "username": "johndoe",
  "password": "password123"
}

Response:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "id": 1,
  "username": "johndoe",
  "email": "[email protected]",
  "phone": "1234567890",
  "roles": ["ROLE_USER"]
}

Author

Saurabh Kushwaha
🔗 Portfolio
📧 [email protected]
🔗 LinkedIn
🔗 Instagram Dev Page


License

This project is licensed under the MIT License.


Star this repo if you found it helpful!

About

A complete backend system for UPI (Unified Payments Interface) using Java & Spring Boot - secure, scalable, and sandbox-ready.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages