How kpzxpf/auction works
Project type and purpose
• This is a full-stack Spring-Boot auction application that:
– Serves a static JS/HTML/CSS frontend from src/main/resources/static
– Exposes REST endpoints and WebSocket channels for user operations (create lots, place bids, user auth, profile, feed, etc.)
– Uses a relational database (with Liquibase changelogs for schema)
– Integrates with external systems: Kafka for event messaging, Amazon S3 for image storage
– Implements caching layers for lots and bids, plus image resizing
File structure
• src/main/java/com/volzhin/auction/config
– Configures WebSocket, Kafka producer/consumer, Argon2 password hashing, Amazon S3
• src/main/java/com/volzhin/auction/controller
– REST controllers: AuthController, LotController, BidController, etc.
• src/main/java/com/volzhin/auction/service
– Service layer: business logic, caches, image services (resize & S3), transaction management
• src/main/java/com/volzhin/auction/producer & consumer
– Kafka producers publish events (NewBid, UpdateLot, DeleteLot)
– Kafka consumers subscribe to the same topics to handle asynchronous updates (e.g., update in-memory caches or push WebSocket notifications)
• src/main/java/com/volzhin/auction/repository
– JPA repositories for DB persistence plus cache repositories
• src/main/resources
– application.yaml – DB, Kafka, S3 credentials
– Liquibase changelogs to initialize schema and seed data
– static – UI assets
• docker-compose.yaml
– Defines external services: likely Postgres, Kafka, Zookeeper, possibly Redis
Core components
a. Frontend clients (browser)
b. Spring Boot monolith
– REST API layer
– WebSocket endpoint
– Service layer
– Cache layer (bid/lot caches)
– Kafka producers & consumers
– JPA persistence
– Image resizing & S3 client
c. External systems
– Relational database (Postgres/MySQL)
– Kafka cluster
– Amazon S3 bucket
– (Optional) Redis or in-memory cache store if used
d. Continuous deployment artifacts
– Docker Compose orchestrates DB, Kafka, ZK
Relationships & data flows
• UI → HTTP REST → Controllers → Services → Repositories → Database
• Services → KafkaProducer → Kafka topics
• Kafka topics → KafkaConsumer → Services → Cache update → WebSocketPush → UI
• Controllers → ImageService → ResizeService → S3ServiceImpl → S3
• Services → PasswordHashingService (Argon2) → Secure storage in DB
• Liquibase migrations run on application startup against the DB
Architectural patterns & design principles
• Monolithic, layered architecture (Controller → Service → Repository)
• Event-driven modules via Kafka for decoupling business operations (new bids, lot updates, deletions)
• Cache-aside strategy for lots and bids to reduce DB load
• S3 adapter pattern for image storage
• WebSocket for real-time updates to the UI
• Configuration centralization (application.yaml) & dependency injection via Spring