CRUMB a card from devarno-cloud

XP & Level System

smo1 beginner 4 min read

ELI5

Every time you do something useful in SMO1 — create a link, get clicks, log in daily — you earn experience points (XP). Collect enough XP and you level up, like in a video game. The higher your level, the more XP you need for the next one. There is also a login streak: come back every day and you get bonus XP at 7, 30, 100, and 365 days.

Technical Deep Dive

XP Events

EventXP RewardCondition
LINK_CREATED10Every new link
FIRST_LINK50One-time bonus for the very first link
CLICK_MILESTONE_1025Link reaches 10 total clicks
CLICK_MILESTONE_10050Link reaches 100 total clicks
CLICK_MILESTONE_1000100Link reaches 1,000 total clicks
DAILY_LOGIN5Once per calendar day
STREAK_7507-day login streak
STREAK_3015030-day login streak
STREAK_100500100-day login streak
STREAK_3651500365-day login streak

Level Formula

Each level requires exponentially more XP:

XP for level N = 100 × (1.5)^(N-1)
LevelXP to reachCumulative XPApproximate effort
11001002 links + daily logins
2150250First week of regular use
3225475Active user
4338813Power user
55061,319Heavy usage
67592,078Influencer tier
71,1393,217Community leader
81,7094,926Prolific creator
92,5637,489SMO1 veteran
103,84511,334Legend

The level is computed by summing the series until the cumulative threshold exceeds the user’s total XP.

Streak Mechanics

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#e8f4f8', 'primaryTextColor': '#2d3748', 'primaryBorderColor': '#90cdf4', 'lineColor': '#718096', 'secondaryColor': '#f0fff4', 'tertiaryColor': '#fefcbf'}}}%%
flowchart TD
A[User logs in] --> B{Last login was<br/>yesterday?}
B -->|Yes| C[Increment streak]
B -->|No| D{Last login was<br/>today?}
D -->|Yes| E[No change]
D -->|No| F[Reset streak to 1]
C --> G{Streak milestone?}
G -->|7| H[Grant +50 XP]
G -->|30| I[Grant +150 XP]
G -->|100| J[Grant +500 XP]
G -->|365| K[Grant +1500 XP]
G -->|Other| L[No bonus]
F --> M[Grant +5 XP<br/>daily login]
E --> N[No XP]

Streak state lives on the User model:

  • streak_current — consecutive daily logins
  • streak_longest — all-time maximum streak
  • last_streak_at — timestamp of the most recent streak-affecting login

A login “counts” once per calendar day (UTC). Multiple logins on the same day do not double-count.

XP Event Persistence

Every XP grant is recorded as an xp_event row:

ColumnDescription
idUUID
user_idRecipient
event_typelink_created, click_milestone_10, etc.
xp_amountPoints granted
reference_idOptional foreign key (e.g., link UUID)
created_atTimestamp

This audit trail prevents double-granting and enables “recalculate XP from events” disaster recovery.

Key Terms

  • Base XP → 100 points required for level 1; each subsequent level multiplies by 1.5×
  • Cumulative threshold → The running sum of base × 1.5^(N-1); your total XP is compared against this to determine level
  • Streak → Consecutive calendar days with at least one login
  • Milestone bonus → Large one-time XP grants at 7, 30, 100, and 365 days
  • XP event → Immutable audit row recording why XP was granted

Q&A

Q: Why 1.5× exponential instead of linear? A: Linear progression would make high levels trivial to reach. Exponential growth keeps early levels accessible while making top levels genuinely rare and prestigious.

Q: Can a user lose XP? A: No. XP is monotonically increasing. Links can be deleted, but earned XP is not revoked. This avoids negative emotional feedback.

Q: What happens if a user logs in at 23:59 and again at 00:01? A: The second login counts as the next calendar day (UTC), so the streak increments by 1. The gap between logins is only 2 minutes, but the calendar date changed.

Q: How is level calculated if a user’s XP is between thresholds? A: The user stays at the highest level whose cumulative threshold they have met. Excess XP carries over toward the next level but does not grant partial progress bonuses.

Examples

Think of the XP system like a coffee shop loyalty card:

  • Creating a link is buying a coffee (+10 stamps)
  • First link bonus is your welcome drink (+50 stamps)
  • Click milestones are referrals — each time a friend buys a coffee because of you, you get bonus stamps
  • Daily login is showing your face at the counter (+5 stamps)
  • Streak bonuses are the monthly “regular customer” rewards: free pastry at 7 days, free bag of beans at 30 days, a branded mug at 100 days, and a VIP membership at 365 days
  • Leveling up is earning a new tier on your card: bronze, silver, gold, platinum — each tier requires more total stamps than the last

neighbors on the map