Skip to content

Conversation

@fawizzy
Copy link

@fawizzy fawizzy commented Jan 24, 2026

Summary
This PR adds a new achievement-service NestJS microservice responsible for defining, tracking, and unlocking player achievements, as well as awarding badges. The service runs independently with its own Postgres database and exposes APIs for querying achievement definitions, user progress, and unlock history.

Key Changes

  • New Microservice: microservices/achievement-service

    • NestJS app (modeled after economy-service)
    • Runs on port 3006
    • Uses its own Postgres DB (quest_achievement)
    • Dockerized with Dockerfile and docker-compose.yml
  • Domain Entities

    • Achievement: definition (code, metric, targetValue, rarity, etc.)
    • AchievementProgress: per-user progress (unique per user + achievement)
    • Badge: awarded badge per unlocked achievement (idempotent)
  • Core Services

    • AchievementService: manage achievement definitions
    • AchievementProgressService: record and fetch user progress
    • AchievementUnlockService: evaluate unlocks and orchestrate side effects
    • BadgeService: award and query user badges
    • AchievementHistoryService: fetch user unlock history
    • AchievementNotificationService: unlock hook (currently logs)
  • Core Logic

    • Progress is recorded by metric and increment
    • Unlocks trigger automatically when targets are met
    • Badge awarding is idempotent
    • Unlock history is stored and queryable
  • HTTP API

    • GET /achievements – list all achievement definitions
    • GET /users/:userId/achievements – get user progress
    • GET /users/:userId/achievement-history – get unlock history

closes #103

… transaction modules

- Add AppModule to initialize the application with necessary modules.
- Create Energy module for managing user energy regeneration, consumption, and status.
- Implement Shop module for handling shop items, including creation, retrieval, and purchasing.
- Develop Transaction module for processing user transactions, including purchases and refunds.
- Introduce Payment module to manage payment processing with providers like Stripe and PayPal.
- Add necessary entities, controllers, and services for each module.
- Implement cron job for periodic energy regeneration.
- Set up TypeORM for PostgreSQL database integration.
- Configure global validation and CORS in the main application bootstrap.
@fawizzy fawizzy changed the title feat: implement achievement service with energy management, shop, and… feat: implement achievement service Jan 25, 2026
@Mkalbani
Copy link
Contributor

@fawizzy please resolve conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Achievement Service Setup

2 participants