Skip to content

BountyHunter Backend - Tech Stack Overview

1. Runtime & build

  • Language: Java 17
  • Build tool: Gradle multi-module
  • Framework: Spring Boot 3.1.3
  • Spring Cloud BOM: 2022.0.3

2. Deployable modules

Module Vai trò Port mặc định
web Core game APIs 8080
websocket Realtime game commands/events 8081
batch Scheduler + JMS workers 8082
admin Backoffice/admin APIs 8083
webmarketplace Marketplace + payment APIs 8084
authentication Auth code/sign-in/JWT session 8085
livestreamweb Livestream domain APIs 8086
firebaselistener Firebase RTDB command/event listeners 8087
receiver-service Queue/event receiver service 8088

3. Core frameworks & libraries

  • Spring Boot Starters: Web, Validation, Security, Batch, JMS
  • ORM/Data Access: MyBatis Plus (3.5.3.2), dynamic datasource
  • HTTP clients: OpenFeign
  • Cache (local): Caffeine
  • JSON: Jackson + Fastjson
  • Background jobs: JobRunr

4. Data & persistence

  • MySQL 8 (master/slave, HikariCP tuning theo module)
  • Redis
  • Lettuce connection pool
  • Redisson (distributed lock/support)
  • Cache/session/counter/opponent pool/matching state
  • Liquibase: có migration file trong repo (được tham chiếu trong project)

5. Messaging & async

  • Broker: ActiveMQ Artemis (failover:(tcp://localhost:61616))
  • Pattern:
  • Dedicated queue theo domain (queue-prize-allocation-*, invitation, machine, gacha, mission)
  • Programmatic JMS listener registration theo machineId / playableGameBoothSettingId
  • Message Group (JMSXGroupID) cho livestream gift để đảm bảo ordering per streamer

6. Realtime communication

  • WebSocket: @ServerEndpoint("/websocket/{token}")
  • Command-dispatch: @OnCmd + ConsumerContainer
  • Backpressure: WebSocketMessageQueueService với thread pool lớn, queue capacity cấu hình
  • Pub/Sub: broadcast sự kiện gameplay/matching/validation về client

7. Security

  • JWT auth: custom JwtTokenFilter
  • Spring Security: stateless, whitelist bằng application.security.whitelist
  • Method security: @EnableMethodSecurity
  • Session/device control: session repository + firebase token handling

8. External integrations

  • Blockchain/NFT: Web3j, node server integration (Polygon/BNB/Solana), Immutable/Web3Auth login
  • Payment gateways:
  • Credit card (Fincode / SBPS flow)
  • Crypto (Slash)
  • Apple IAP
  • Google Play Billing
  • Native token flow
  • Livestream: Agora SDK
  • Firebase: Realtime Database + FCM admin SDK
  • Storage: AWS S3, Azure Blob Storage

9. Observability & operations

  • Log4j2 (rolling policy)
  • Spring Actuator (health,metrics,hikaricpweb)
  • Swagger/OpenAPI (springdoc)
  • SonarQube plugin trong Gradle root

10. Architectural style

  • Modular monolith theo domain boundaries
  • Clean-ish layering:
  • application-core: business logic/use cases
  • infrastructures/*: adapters/clients/persistence/security
  • app modules (web, batch, ...): delivery layer
  • Hybrid sync + async: REST/WS cho interactive path, JMS/Firebase/Scheduler cho eventually-consistent path