Building a Discord Bot Economy System: Currency, Shops, and Leaderboards

Published on

Step-by-step guide to building an economy system for your Discord bot with currency, item shops, gambling, and persistent leaderboards.

Written by Space-Node Team – Infrastructure Team – 15+ years combined experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

Economy bots are among the most engaging Discord features. Users earn and spend virtual currency, compete on leaderboards, and interact with shops. Here is how to build one that scales.

Database Choice

An economy system needs persistent storage. Your options:

  • SQLite - Simple, file-based, perfect for small-medium bots. No separate server needed.
  • PostgreSQL - Better for large bots with thousands of active users. Handles concurrent writes well.
  • MongoDB - Flexible schema, good for complex item systems.

For most Discord bots, SQLite is the right starting point. You can migrate later if needed.

Core Schema

Your economy needs at least two tables:

CREATE TABLE users (
  user_id TEXT PRIMARY KEY,
  balance INTEGER DEFAULT 0,
  bank INTEGER DEFAULT 0,
  last_daily TIMESTAMP,
  last_work TIMESTAMP
);

CREATE TABLE transactions (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  user_id TEXT,
  amount INTEGER,
  type TEXT,
  description TEXT,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Tracking transactions separately from balances gives you audit capabilities and makes debugging easier.

Essential Commands

Every economy bot needs these core commands:

Balance Check

Show the user their wallet and bank balance. Include a net worth calculation if you have items.

Daily Rewards

Give users a fixed amount once per 24 hours. Add streak bonuses for consecutive daily claims - this drives daily engagement.

Work Command

A cooldown-based earning command. Randomize the payout within a range to keep it interesting. Common cooldown: 30-60 minutes.

Transfer

Let users send currency to each other. Always validate that the sender has enough balance and that amounts are positive integers.

Leaderboard

Show the top 10-25 users by balance. Cache this query - it can be expensive on large datasets. Refresh every 5-10 minutes.

Item Shop

Adding a shop creates a proper economy loop:

CREATE TABLE items (
  id INTEGER PRIMARY KEY,
  name TEXT,
  description TEXT,
  price INTEGER,
  type TEXT
);

CREATE TABLE inventory (
  user_id TEXT,
  item_id INTEGER,
  quantity INTEGER DEFAULT 1,
  PRIMARY KEY (user_id, item_id)
);

Items can be cosmetic (custom roles, badges) or functional (experience boosters, cooldown reducers).

Anti-Abuse Measures

Economy systems attract exploitation attempts:

  1. Rate limiting - Cap how many economy commands a user can run per minute
  2. Transaction validation - Always check balances server-side, never trust client state
  3. Alt detection - Watch for new accounts farming daily rewards
  4. Maximum balances - Set reasonable caps to prevent inflation

Hosting Considerations

Economy bots with active databases need consistent uptime and fast disk I/O. NVMe SSD hosting is important here - SQLite performance depends heavily on disk speed.

A 1GB RAM plan handles most economy bots. If you have thousands of concurrent users, consider 2GB+ for the database cache.

Scaling Tips

  • Use database connection pooling for PostgreSQL
  • Cache frequently accessed data (leaderboards, shop items) in memory
  • Run database maintenance (VACUUM for SQLite) on a schedule
  • Back up your database regularly - losing user economy data kills engagement

The key to a successful economy bot is balance: earning should feel rewarding but not too easy, and spending should offer meaningful choices.

Space-Node Team

About the Author

Space-Node Team – Infrastructure Team – Experts in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 15+ years combined experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

Our team specializes in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters. We maintain GDPR compliance and ISO 27001-aligned security standards.

View Space-Node's full team bio and credentials →

Launch Your VPS Today

Get started with professional VPS hosting powered by enterprise hardware. Instant deployment and 24/7 support included.

Building a Discord Bot Economy System: Currency, Shops, and Leaderboards