curl --location 'localhost:8083/user-onboarding/create/user'
--header 'Content-Type: application/json'
--data-raw '{
"name": "Som",
"email": "somnath.try@gmail.com",
"phoneNo": "123456677",
"password": "12345",
"userIdentifier": "AADHAAR",
"userIdentifierValue": "56587452256",
"dob": "14/02/2003",
"address": "BTM Layout, Bangalore"
}'
curl --location --request POST 'localhost:8082/txn-service/initiate/transaction?amount=4&receiver=5635878963&purpose=Sending%20Mney%20to%20robin%204rs'
--header 'Authorization: Basic NTY5NzQ1NTI1MzoxMjM0NQ=='
curl --location 'localhost:8082/txn-service/transaction/history?mobile=5697455253'
--header 'mobile: 5697455253'
--header 'Authorization: Basic NTY5NzQ1NTI1MzoxMjM0NQ=='
- Kafka Should be up and running
- Mysql Should be up and database should be created, take database name from application.properties file
- Following topics needs to be created: user-details, txn-details, txn-update
A distributed Spring Boot microservices system enabling core digital wallet functionalities, including user onboarding, wallet creation, fund transfers, transaction tracking, and email notifications.
- β User registration with KYC verification
- πΌ Wallet creation & balance management
- π Money transfer between users
- π Transaction history
- βοΈ Email notifications on onboarding
[User Service] β Kafka β [Notification Service]
β Kafka β [Wallet Service]
[Transaction Service] β Kafka β [Wallet Service]
[Wallet Service] β Kafka β [Transaction Service]
- Java 17, Spring Boot 3.2.5
- MySQL, Apache Kafka
- Spring Security (Basic Auth), BCrypt
- Maven build
- Mailtrap for email testing
- Endpoints:
POST /user-onboarding/create/userβ Create userGET /user-onboarding/get/userβ Fetch user
- Highlights:
- KYC via PAN/AADHAAR/VOTER_ID
- Password encryption
- Publishes to Kafka topic:
user-details
- Creates wallet with βΉ50 initial balance
- Transfers and updates balances
- Kafka:
- Listen:
user-details,txn-details - Publish:
txn-update
- Listen:
- Endpoints:
POST /txn-service/initiate/transactionGET /txn-service/transaction/history
- Handles money transfers and logs transactions
- Basic Auth via
phone:password - Kafka:
- Listen:
txn-update
- Listen:
- Sends welcome emails using Mailtrap
- Kafka:
- Listen:
user-details
- Listen:
- Java 17
- Apache Kafka (local)
- MySQL
walletuserdb(User)walletdb(Wallet)transactiondb(Transactions)
kafka-topics --create --topic user-details --bootstrap-server localhost:9092
kafka-topics --create --topic txn-details --bootstrap-server localhost:9092
kafka-topics --create --topic txn-update --bootstrap-server localhost:9092# Common module
cd common
mvn install
# Services
cd ../UserService && mvn spring-boot:run
cd ../WalletService && mvn spring-boot:run
cd ../TxnService && mvn spring-boot:run
cd ../NotificationService && mvn spring-boot:runcurl --location 'localhost:8083/user-onboarding/create/user' --header 'Content-Type: application/json' --data '{
"name": "John Doe",
"email": "john@example.com",
"phoneNo": "1234567890",
"password": "secure123",
"userIdentifier": "AADHAAR",
"userIdentifierValue": "56587452256",
"dob": "01/01/1990",
"address": "City, Country"
}'curl --location --request POST 'localhost:8082/txn-service/initiate/transaction?amount=100&receiver=9876543210&purpose=Payment' --header 'Authorization: Basic <base64(phone:password)>'curl 'localhost:8082/txn-service/transaction/history?mobile=1234567890' --header 'Authorization: Basic <base64(phone:password)>'- Basic Auth with phone number
- Password hashing using BCrypt
- Role-based access (
USER,ADMIN)
Each service has its application.properties under:
/UserService/src/main/resources//WalletService/src/main/resources//TxnService/src/main/resources//NotificationService/src/main/resources/
CommonConstantsUserIdentifierenum
UserController,UserService,User
TransactionWorker,Wallet,OnboardedUserConsumer
TransactionController,TransactionService,Transaction
EmailWorker,UserCreatedConsumer
CREATE TABLE user (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255), email VARCHAR(255) UNIQUE,
phone VARCHAR(255) UNIQUE, address TEXT,
dob VARCHAR(20), password VARCHAR(255),
user_identifier ENUM('PAN','AADHAAR','VOTER_ID'),
user_identifier_value VARCHAR(255),
role ENUM('USER','ADMIN'),
user_status ENUM('ACTIVE','INACTIVE','BLOCKED'),
created_on DATETIME, updated_on DATETIME
);CREATE TABLE wallet (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id VARCHAR(255), balance DOUBLE,
phone_no VARCHAR(255) UNIQUE,
user_identifier VARCHAR(50),
user_identifier_value VARCHAR(255),
created_on DATETIME, updated_on DATETIME
);CREATE TABLE transaction (
id INT AUTO_INCREMENT PRIMARY KEY,
txn_id VARCHAR(255), sender_id VARCHAR(255),
receiver_id VARCHAR(255), amount DOUBLE,
purpose VARCHAR(255),
txn_status ENUM('INITIATED','FAILED','SUCCESS','PENDING'),
txn_message TEXT,
created_on DATETIME, updated_on DATETIME
);- Global
@ControllerAdvicehandling - DB & Kafka exception coverage
- Transaction status resolution via Kafka
mvn test- Spring Actuator endpoints
- Kafka CLI tools
- DB consistency checks
| Issue | Solution |
|---|---|
| Kafka not reachable | Ensure Kafka runs on localhost:9092 |
| DB connection errors | Check credentials in application.properties |
| Auth failures | Ensure correct Base64(phone:password) |
| Txn not processed | Check wallet balance & receiver user |
- Swagger API docs
- Circuit Breakers (Resilience4j)
- JWT Authentication
- Wallet balance check endpoint
- Admin dashboard
- Transaction reversal system
.
βββ common/
βββ UserService/
βββ WalletService/
βββ TxnService/
βββ NotificationService/
βββ README.md
For any queries or contributions, feel free to open issues or raise pull requests.