Skip to Content
Admin PanelAchievement Management

Achievement Management (Admin Panel)

The admin panel provides a complete workflow for creating and managing achievements. No code changes are needed — everything is configured through the UI.

Resources

Achievement Rules

Navigate to Achievement Rules in the sidebar to manage rule definitions.

Creating a Rule:

  1. Click Create
  2. Fill in the fields:
FieldDescriptionExample
NameHuman-readable rule name”Win 5 matches”
Field (metric)What to measure — dropdown with 13 optionswins
ComparatorHow to evaluate — dropdowngte (greater or equal)
TargetThreshold value5
WeightContribution to achievement progress (0-100)100

Available Metrics:

MetricDescription
matchesTotal matches played
winsTotal matches won
lossesTotal matches lost
positionsTotal positions opened
wins_in_rowCurrent win streak
total_volumeCumulative trading volume
total_profitCumulative realized PnL
inviteAccepted friends count
levelUser level
depositsNumber of deposits
withdrawalsNumber of withdrawals
profile_completedWhether profile has nickname + avatar (use bool comparator)
trades_closedNumber of closed positions

Available Comparators:

ComparatorWhen to useExample
>= (gte)Progressive goals”Win at least 5 matches”
> (gt)Must exceed”Score above 1000”
<= (lte)Stay below threshold”Keep losses under 5”
< (lt)Must be below”Fewer than 3 liquidations”
= (eq)Exact match”Reach exactly level 10”
boolTrue/false check”Complete your profile”

Achievements

Navigate to Achievements in the sidebar.

Creating an Achievement:

  1. Click Create
  2. Fill in:
FieldDescription
NameDisplay name (shown to users)
KeyUnique slug (first_win, trading_veteran)
DescriptionRich text description
AvatarBadge image (upload)
Is ActiveToggle — inactive achievements are not evaluated
Is HiddenToggle — hidden achievements not shown until completed
Expires AtOptional — time-limited achievements
RulesSelect one or more achievement rules
RewardsSelect consumable items to grant on completion

Roles & Permissions

Achievement management requires the create:achievementDefinitions and update:achievementDefinitions permissions. Assign these via Roles in the admin panel.

Example: Creating “First Win” Achievement

Step 1: Create the Rule

  1. Go to Achievement RulesCreate
  2. Name: First Win Rule
  3. Field: wins
  4. Comparator: gte
  5. Target: 1
  6. Weight: 100
  7. Save

Step 2: Create the Reward (Optional)

  1. Go to ConsumablesCreate
  2. Name: 50 XP Boost
  3. Type: exp
  4. Value: 50
  5. Save

Step 3: Create the Achievement

  1. Go to AchievementsCreate
  2. Name: First Win
  3. Key: first_win
  4. Description: Win your first match!
  5. Upload a badge image
  6. Is Active: true
  7. Link the rule from Step 1
  8. Link the reward from Step 2
  9. Save

Step 4: Test

  1. Log in as a test player (use dev code 12345)
  2. Play and win a match
  3. Check the player’s achievement progress in the admin panel
  4. The achievement should show 100% progress and “completed”

Multi-Rule Achievements

For complex achievements, create multiple rules with weights that sum to 100:

Example: “Trading Master”

  • Rule 1: wins >= 10, weight 50
  • Rule 2: total_profit >= 500, weight 30
  • Rule 3: trades_closed >= 100, weight 20

A player with 8 wins (80% of target), $400 profit (80% of target), and 60 closed trades (60% of target):

  • Rule 1: 80% × 50 = 40
  • Rule 2: 80% × 30 = 24
  • Rule 3: 60% × 20 = 12
  • Total: 76% (not yet completed)

How It Works Behind the Scenes

  1. When a user performs any action (trade, login, deposit, etc.), an event is published to NATS
  2. The achievement worker picks up the event and recalculates ALL metrics for that user
  3. Each active achievement’s rules are evaluated using the current metrics
  4. Progress is stored as a percentage (0-100) in UserAchievement
  5. When progress reaches 100%, rewards are granted and a notification is sent
  6. Completed achievements are never re-evaluated or re-granted

See the Achievement System documentation for technical details.

Last updated on