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.
- 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
- 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
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
- Java 17 or higher
- Maven 3.6 or higher
- PostgreSQL 12 or higher
- Create a PostgreSQL database named
upidb:
CREATE DATABASE upidb;- Update the database configuration in
application.propertiesif needed:
spring.datasource.url=jdbc:postgresql://localhost:5432/upidb
spring.datasource.username=postgres
spring.datasource.password=postgres- 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- Build the project:
mvn clean install- Run the application:
mvn spring-boot:runThe application will start on port 8080 by default.
Swagger UI is available at: http://localhost:8080/swagger-ui.html
API docs are available at: http://localhost:8080/api-docs
POST /api/auth/signup
Request body:
{
"username": "johndoe",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"phone": "1234567890",
"password": "password123",
"roles": ["user"]
}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"]
}Saurabh Kushwaha
🔗 Portfolio
📧 [email protected]
🔗 LinkedIn
🔗 Instagram Dev Page
This project is licensed under the MIT License.