Building a Centralized Premium System for a Discord Music Bot

Inside the Mewwme Premium API Architecture
When you operate a growing Discord music bot ecosystem, premium management quickly becomes more complex than expected.
What starts as a simple “unlock premium features” toggle evolves into:
- Multi-tier subscription handling
- Guild-based premium slot allocation
- OAuth integrations
- Webhook event synchronization
- Automated subscription lifecycle management
To solve this properly, I built Mewwme Premium API a centralized premium management system designed specifically for the internal infrastructure of the Mewwme Music Bot ecosystem.
Official Website: https://meww.me
🚀 Why I Built This
The Mewwme Music Bot needed a scalable and reliable premium infrastructure powered by Patreon.
Instead of embedding premium logic inside every bot instance, I designed a dedicated API service responsible for:
- Handling Patreon OAuth authentication
- Managing subscription tiers (Silver / Gold)
- Assigning premium status to Discord guilds
- Processing Patreon webhook events
- Synchronizing subscription updates automatically
- Logging system events via Discord webhooks
The goal was simple:
Centralize premium logic. Eliminate duplication. Automate everything.
🧠 Architecture Philosophy
The API acts as the core premium authority across all Mewwme bot instances.
Instead of each bot checking Patreon individually:
Bot → Premium API → Database → Patreon Sync
This ensures:
- Consistency across shards and clusters
- Single source of truth
- Easier maintenance
- Clean separation between bot logic and subscription logic
Premium validation becomes lightweight and fast bots only need to query the API.
✨ Core Features
🔐 Patreon OAuth2 Integration
Secure authentication flow connecting Discord users with their Patreon accounts.
🏆 Premium Tier Management
Two subscription levels:
| Tier | Premium Guild Slots |
|---|---|
| Silver | 2 guilds |
| Gold | 4 guilds |
Slot allocation is automatically enforced at the API level.
🏠 Guild Premium Activation
Users can activate premium in specific Discord servers (guilds). The API tracks usage and prevents over-allocation.
🔄 Automatic Webhook Handling
Patreon events are processed in real time:
- New pledges
- Upgrades / downgrades
- Cancellations
- Expired subscriptions
The system updates premium access automatically.
📡 Discord Webhook Logging
All key events are logged directly to Discord for monitoring.
🗄️ Prisma ORM Integration
Database management is handled through Prisma for clean schema control and migrations.
🔌 API Design Overview
Authentication
GET /auth/patreon?discordId=<ID>
GET /auth/patreon/callback
Handles OAuth flow and account linking.
Premium Management
POST /premium/servers
DELETE /premium/servers
GET /premium/show
GET /premium/check
Core endpoints for activation, validation, and status checking.
Webhooks
POST /webhooks/patreon
Automatically syncs subscription changes without manual intervention.
🔐 Security Considerations
Premium systems handle sensitive data. This API follows several best practices:
- Environment-based secret storage
- No hardcoded credentials
- Webhook validation
- HTTPS-only production deployment
- Dependency monitoring
Security was designed as a requirement — not an afterthought.
⚠️ Project Status
The project is no longer actively maintained.
Important notes:
- Built exclusively for internal Mewwme infrastructure
- Self-hosting is not officially supported
- Issues and pull requests are not reviewed
- Custom deployments are unsupported
The repository remains open-source under GPL-3.0 for transparency and archival purposes.
🧩 Lessons Learned
Building this system taught me:
- Subscription logic should never live inside your main bot process.
- Webhooks are essential for real-time subscription accuracy.
- Centralization drastically reduces infrastructure headaches.
- Automation eliminates 90% of manual support tickets.
If you're building a Discord bot with paid tiers, separating premium infrastructure early will save you massive refactoring later.
Mewwme Premium API wasn’t just a side utility it became the backbone of subscription management for the Mewwme ecosystem.
It demonstrates how even a “simple premium system” requires:
- Proper architecture
- Clear separation of concerns
- Secure authentication
- Automated lifecycle handling
If you’re building scalable Discord bot infrastructure, designing your premium system as a dedicated service is one of the best architectural decisions you can make.