{"repo":"zgabrieloliveira/idempotent-payment-gateway","free":true,"listed":false,"github":"https://github.com/zgabrieloliveira/idempotent-payment-gateway","clone":"git clone https://github.com/zgabrieloliveira/idempotent-payment-gateway.git","description":"A high-performance Payment Gateway API built with Spring Boot 3 to solve concurrency race conditions and guarantee idempotency using Redis and PostgreSQL Pessimistic Locking.","language":"Java","stars":12,"topics":["concurrency","idempotency","k6","payment-gateway","pessimistic-locking","postgresql","spring-boot"],"license":null,"category":"auth-billing-email","readme_excerpt":"🛡️ Idempotent Payment Gateway A high-performance, resilient payment gateway MVP designed to handle concurrency and idempotency challenges in distributed systems. Built with Java 17 , Spring Boot 3 , Redis , and PostgreSQL . 📖 About The Project In financial systems, two problems are critical: 1. Double Spending/Charging: A network glitch shouldn't cause a user to be charged twice for the same click. 2. Race Conditions: Multiple concurrent transactions shouldn't corrupt the account balance. This project implements a robust solution using Idempotency Keys (cached in Redis) and Pessimistic Locking (Database level) to guarantee data integrity under stress. 🏗️ Architecture The system follows a layered architecture with a focus on data consistency. Key Features - Idempotency: Prevents duplicate processing of the same request using Idempotency-Key headers and Redis . - Concurrency Control: Uses PESSIMISTIC WRITE (Select for Update) locking to serialize concurrent balance updates. - Audit Trail: Every balance change creates an immutable BankEntry and Transaction Header. - Performance: Validated with k6 load testing (50+ concurrent users with sub-200ms latency). 🛠️ Tech Stack - Language: Java 17 - Framework: Spring Boot (Web, Data JPA, Validation, Redis) - Database: PostgreSQL - Cache: Redis - Migrations: Flyway - Testing: k6, JUnit 5 🚀 Quick Start Prerequisites - Java 17+ - Docker & Docker Compose - Maven 1. Start Infrastructure (Postgres & Redis) Run Redis and Postgres container","default_branch":null,"files":null,"tree":[],"storefront":"/r/zgabrieloliveira","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/zgabrieloliveira/idempotent-payment-gateway/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}