A high-performance, distributed auction and bidding system with multiple bidding strategies, designed to handle concurrent bids efficiently. The system simulator allows comprehensive testing of different bidding mechanisms with real-time performance metrics.
The Bidding Engine is the core simulator of the project, supporting multiple bidding strategies to handle concurrent auction operations. Combined with the User Service, Product Service, and API Gateway, this forms a complete distributed bidding system.
- ** Bidding Strategy Simulator**: Test and compare three distinct bidding strategies
- ** High-Concurrency Support**: Handle thousands of simultaneous bids
- ** Real-Time Performance Metrics**: Monitor bid success rates, conflicts, and latency
- ** Distributed Architecture**: Microservices-based design with independent scaling
- ** Cloud-Native**: Deployed on Railway with Neon PostgreSQL and Upstash Redis
┌─────────────────────────────────────────────────────────────┐
│ Frontend (Angular 21) │
│ https://www.bidzapp.tech/ │
└─────────────┬───────────────────────────────────────────────┘
│
┌─────────────▼───────────────────────────────────────────────┐
│ API Gateway (Spring Boot 4.0.5) │
│ Route & Load Balance Requests │
└─────────────┬───────────────────────────────────────────────┘
│
┌─────────┼─────────┬──────────────┐
│ │ │ │
│ │ │ │
▼ ▼ ▼ ▼
User Product Bidding Engine (Other Services)
Service Service (Simulator)
│ │ │ │
└─────────┴─────────┴──────────────┘
│
┌─────────┴─────────┬──────────────┐
│ │ │
▼ ▼ ▼
Neon PostgreSQL Upstash Redis Database
(Distributed DB) (Cache & Locks) Services
| Service | Purpose | Tech Stack |
|---|---|---|
| Bidding Engine | Core auction & bidding logic with 3 strategies | Spring Boot 4.0.5, Java 21, PostgreSQL, Redis |
| User Service | User authentication & management | Spring Boot 4.0.5, Java 21, PostgreSQL |
| Product Service | Product catalog & inventory | Spring Boot 4.0.5, Java 21, PostgreSQL |
| API Gateway | Request routing & load balancing | Spring Boot 4.0.5, Java 21 |
| Frontend | Web UI for auction management | Angular 21, Material Design |
- Please configure the product , user , api-gateway services if u want a fully distributed bidding engine
- As right now it only simulates the amount of concurrent users that u need on different locking strategy
The Bidding Engine Simulator implements three different bidding strategies to test system behavior under concurrent load:
- Uses Redis-based distributed locks for synchronized bid processing
- Best for: Ensuring strict ACID compliance in high-concurrency scenarios
- Serializes bid processing but guarantees data consistency
- Lower throughput, higher consistency
- Uses database-level version control for conflict detection
- Best for: High-throughput scenarios with manageable conflict rates
- Allows concurrent reads but validates on write
- Higher throughput with retry mechanisms
- Direct bid placement without explicit locking
- Best for: Baseline performance comparison
- Fastest but susceptible to race conditions
- Useful for identifying concurrency issues
- Concurrent Bid Simulation: Simulate multiple users placing bids simultaneously
- Performance Metrics: Track success rates, response times, and conflicts
- Real-Time Statistics: Monitor bid statistics (min, max, average bids)
- Strategy Comparison: A/B test different strategies on the same auction
BiddingEngine/
├── fronted/ # Angular Frontend Application (10%)
│ ├── src/
│ │ ├── app/
│ │ │ ├── bidding-api.service.ts # API communication service
│ │ │ ├── bidding.models.ts # Bidding data models
│ │ │ ├── feature/
│ │ │ │ └── bidding-dashboard/ # Auction dashboard UI
│ │ │ ├── shared/ # Shared components & utilities
│ │ │ └── core/ # Core services & interceptors
│ │ └── index.html
│ ├── package.json
│ └── angular.json
│
├── biddingengine/ # Core Bidding Engine Service (60%)
│ ├── src/main/java/com/emi/biddingengine/
│ │ ├── BiddingengineApplication.java # Spring Boot entry point
│ │ ├── controller/
│ │ │ ├── AuctionController.java # Auction REST endpoints
│ │ │ └── BidController.java # Bidding REST endpoints
│ │ ├── services/
│ │ │ ├── AuctionService.java # Auction business logic
│ │ │ └── BidService.java # Bidding logic (3 strategies)
│ │ ├── serviceImpl/ # Strategy implementations
│ │ ├── entity/ # JPA entities
│ │ ├── repository/ # Data persistence layer
│ │ ├── dtos/ # Request/Response DTOs
│ │ ├── config/ # Spring configuration
│ │ └── client/ # External service clients
│ ├── src/main/resources/
│ │ ├── db/migration/ # Flyway DB migrations
│ │ ├── application.properties # Configuration
│ │ └── static/, templates/
│ ├── Dockerfile # Multi-stage Docker build
│ ├── pom.xml
│ └── target/
│
├── api-gateway/ # API Gateway Service (10%)
│ ├── src/main/java/com/emi/api_gateway/
│ ├── pom.xml
│ └── mvnw
│
├── user/ # User Service (10%)
│ ├── src/main/java/com/emi/user/
│ ├── src/main/resources/db/migration/
│ ├── pom.xml
│ └── mvnw
│
├── product/ # Product Service (10%)
│ ├── src/main/java/com/emi/product/
│ ├── src/main/resources/db/migration/
│ ├── pom.xml
│ └── mvnw
│
├── Docker/
│ ├── docker-compose.yml # Local development environment
│ └── infra/ # Infrastructure setup
│
├── railway.json # Railway deployment configuration
└── README.md
- Java 21+
- Maven 3.9.6+
- PostgreSQL 15+ (or use Neon)
- Redis (or use Upstash)
- Node.js 18+ (for frontend)
- Angular CLI 21+
# Start PostgreSQL and Redis
cd Docker
docker-compose up -d
# Build all services
cd ../biddingengine
mvn clean package -DskipTests
cd ../user
mvn clean package -DskipTests
cd ../product
mvn clean package -DskipTests
cd ../api-gateway
mvn clean package -DskipTestsBidding Engine:
cd biddingengine
mvn spring-boot:run
# Runs on http://localhost:8080User Service:
cd user
mvn spring-boot:run
# Runs on http://localhost:8081Product Service:
cd product
mvn spring-boot:run
# Runs on http://localhost:8082API Gateway:
cd api-gateway
mvn spring-boot:run
# Runs on http://localhost:8000Frontend (Angular):
cd fronted
npm install
npm start
# Runs on http://localhost:4200| Component | Platform | URL |
|---|---|---|
| Frontend | Hosted CDN | https://www.bidzapp.tech/ |
| Bidding Engine | Railway | https://distributed-bidding-engine-production.up.railway.app/ |
| Database | Neon PostgreSQL Cluster | Serverless, auto-scaling |
| Cache/Locks | Upstash Redis | Managed, distributed |
PostgreSQL (Neon)
- Serverless, auto-scaling PostgreSQL cluster
- Connection pooling for optimal performance
- SSL/TLS encryption enabled
- Multi-region replication available
Redis (Upstash)
- Distributed Redis for bid locks and caching
- Used by Redis Lock Bidding Strategy
- High availability with automatic failover
- Real-time data consistency
Railway Deployment
- Container-based deployment via Docker
- Auto-scaling capabilities
- Environment variables for configuration
- Health checks and monitoring
The frontend provides an intuitive interface to test bidding strategies: (though only 3 stratergies for now)
- Select a product from the catalog
- Set starting price and duration
- Auction goes live immediately
Simulation Parameters:
├── Number of Users: Simulate N concurrent bidders
├── Bidding Strategy: Choose [Redis Lock | Optimistic Lock | Naive]
└── Duration: Run for specified time period
Results Display:
├── Success Rate: % of bids successfully processed
├── Conflict Rate: % of conflicts detected (for optimistic lock)
├── Avg Response Time: Average bid processing latency
├── Max/Min/Avg Bid Amount: Bid statistics
└── Winner: Final highest bidder
- Real-time bid success/failure tracking
- Conflict occurrence detection
- Performance comparison between strategies
- Export results for analysis
Auctions
POST /api/auctions- Create new auctionGET /api/auctions/{id}- Get auction detailsGET /api/auctions- List all auctionsPOST /api/auctions/{id}/close- End auction
Bidding
POST /api/bids/place- Place a bid with strategy selectionPOST /api/bids/simulate- Run concurrent bid simulationGET /api/bids/stats/{auctionId}- Get bid statisticsGET /api/bids/results/{auctionId}- Get detailed bid results
POST /api/users/register- Register new userGET /api/users/{id}- Get user profilePUT /api/users/{id}- Update user info
POST /api/products- Create productGET /api/products- List productsGET /api/products/{id}- Get product details
- Framework: Spring Boot 4.0.5
- Language: Java 21
- Database: PostgreSQL 15+ (via Neon)
- Cache/Messaging: Redis (via Upstash)
- ORM: Hibernate JPA
- Database Migration: Flyway
- Build Tool: Maven 3.9.6
- Framework: Angular 21.2
- UI Library: Angular Material 21.2
- HTTP Client: Angular HttpClient
- Styling: SCSS
- State Management: RxJS
- Containerization: Docker
- Orchestration: Railway (Cloud Native)
- Database: Neon (Serverless PostgreSQL)
- Cache: Upstash (Managed Redis)
| Metric | Redis Lock | Optimistic Lock | Naive |
|---|---|---|---|
| Throughput | ⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Consistency | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐ |
| Latency | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Conflict Rate | 0% | 5-15% | 20-40% |
- Use Redis Lock for high-value auctions requiring guaranteed consistency (for this project it cant handle too many request as it is running on free tier)
- Use Optimistic Lock for balanced performance and safety in typical scenarios
- Use Naive only for testing baselines and low-concurrency scenarios
- Enable Redis caching for frequent product/user lookups
- Use database connection pooling (configured in Neon)
- Can also use kafka based strategy method
- SSL/TLS encryption for all external connections
- Database credentials stored in environment variables
- Redis password authentication (Upstash)
- CORS configuration for frontend communication
- Input validation on all endpoints
- Transaction-based operations for data consistency
This project simulator demonstrates a complete distributed bidding system by integrating:
| Component | Role | Status |
|---|---|---|
| Bidding Engine | Core auction logic & strategy simulator | Complete |
| User Service | User identity & account management | Complete |
| Product Service | Inventory & product catalog | Complete |
| API Gateway | Request routing & authentication | Complete |
| Frontend | User interface & visualization | Complete |
To build a production bidding platform, simply extend:
- Add payment processing service
- Implement authentication & authorization service
- Add notification service (email/SMS)
- Integrate with seller dashboard
- Add advanced reporting & analytics
- Api-gateway is also need to be configured
- Also the integrate the user and product service in bidding engine
- The integration is mandatory as right now bidding engine is only a simulator
Run the built-in simulator to:
- Compare bidding strategy performance
- Identify system bottlenecks
- Validate concurrent bid handling
- Generate performance baselines
- Test high-load scenarios
Example simulation parameters:
Strategy: Redis Lock
Users: 100
Duration: 5 minutes
Expected Result: High consistency, moderate throughput
- Fork the repository
- Create feature branch:
git checkout -b feature/bidding-enhancement - Commit changes:
git commit -am 'Add bidding enhancement' - Push to branch:
git push origin feature/bidding-enhancement - Submit a pull request
This project is private and proprietary. All rights reserved.
For issues, questions, or feature requests:
- Create an issue in the repository
- Check existing documentation
- Review the API endpoints documentation
- Redis Lock Pattern: Distributed mutual exclusion using Redis
- Optimistic Locking: Version-based conflict detection in databases
- Concurrency Control: Handling simultaneous operations safely
- Multi-service architecture patterns
- Database migration with Flyway
- Spring Data JPA for ORM
- REST API design principles
- Component-based architecture
- RxJS reactive programming
- Material Design components
- HTTP communication patterns