AZLicense
Self-hosted licensing for plugin authors. One LICENSE_KEY activates all three surfaces: a Discord bot, a small HTTP API, and a built-in web console. You manage licenses with slash commands or from the browser, and your plugin checks a license on boot against POST /v1/license/verify. Licenses bind per server (IP or hardware), expire on schedule, and keep running offline with a signed 72-hour token when the API is unreachable.
What you received
azlicense/
├── .env # your configuration
├── requirements.txt # Python dependencies
├── run.py # starts everything
├── app_config.py # launcher settings (ports, log level)
├── gen_keys.py # generates encryption keys
├── license_client.py # validates your LICENSE_KEY at startup
├── bot/ # Discord bot
├── api/ # license verification API
├── app/ + static/ # web console (same key, no extra setup)
├── shared/ # shared code
├── database/ # database models
├── assets/ # bot avatar
└── sdk-java/ # Java SDK to add to your pluginOne python run.py starts the API, the web console and the bot. Every start validates your LICENSE_KEY first — no key, no start.
Install
Upload the entire
azlicense/folder to your server or hosting panel.Your host must have Python 3.10+ installed:
bashpip install -r requirements.txtGenerate the signing keys — this creates
private_key.pemandpublic_key.pem:bashpython gen_keys.pyOpen
.envand fill in the values below, pasting the whole key files intoPUBLIC_KEYandPRIVATE_KEY.Start everything:
bashpython run.pyYou should see
License OK, then the API on port 8000, the web console on port 8080, and the bot connect. Single-part flags:--api-only,--web-only,--bot-only.
Web console
The web console ships inside AZLicense — no separate download, no separate key. python run.py starts the API, the console and the bot together, and the console answers on WEB_PORT (8080 by default — change it in app_config.py, or run it alone with --web-only).
It serves the management portal with dedicated pages for everything:
- Overview — live licence stats, top products and activations, read straight from the shared register.
- All licences & Issue — the full register plus issuing from the browser: suspend, unsuspend, resize the server limit, clear bindings, transfer, delete.
- Products — create and delete products in the browser. Deleting a product that still owns licences is refused, with an explicit force option that takes the licences with it.
- Webhooks — add endpoints, pick events (the same set as the bot's
/webhookcommands), and hit Test to fire a sample payload and see the real HTTP delivery status. - Audit log — every admin action, from Discord and the web, in one trail.
- Settings — proves what the server is actually running: ports, URLs, cookie policy, Discord client — with all secrets masked. Nothing sensitive is ever sent to the browser.
It reads the same database and the same .env as the bot, so changes appear on both sides instantly. Discord sign-in covers your customers too.
- Two front doors —
admin.<domain>for you (everything), anddashboard.<domain>for your customers (only their own licences). One sign-in covers both via a cookie scoped to the parent domain; leaveADMIN_URL/DASHBOARD_URLempty to run it as a single site. - First-run wizard — on first open the console prints a setup token and walks you through the database check, the Discord OAuth client id/secret and your hostnames; the wizard writes the values into
.env. Re-open it any time at/setup, still token-gated. - Runtime branding — edit
static/brand.jsonand reload: wordmark, logo letter, tagline, accent colour and support link, no rebuild. - Optional marketplace webhook — point BuiltByBit (or any marketplace speaking the same payload) at
POST {PUBLIC_URL}/api/buildbybit/webhookand a paid order becomes a licence automatically. Leave theBUILDBYBIT_*variables empty and the endpoint is never registered.
Configuration (.env)
| Variable | What to put |
|---|---|
BOT_TOKEN | Your bot token from https://discord.com/developers |
ADMIN_DISCORD_IDS | Your Discord user ID (add multiple with commas) |
MEMBER_ROLE_ID | Role users must have to use bot commands (leave empty to disable) |
PUBLIC_KEY | Open public_key.pem, paste the whole contents here |
PRIVATE_KEY | Open private_key.pem, paste the whole contents here |
API endpoints
| Endpoint | Description |
|---|---|
POST /v1/license/verify | Validate a license against a server |
POST /v1/license/reset | Remove a server binding |
GET /v1/license/info | Fetch license metadata |
GET /health | Health check |
Verification failures return 400/404 with a machine-readable detail — License not found., License has been suspended., License has expired..
Rate limiting: 60 requests/min per IP across the API, and 30 requests/min per license key on verify, reset, and info. Excess requests return 429 with a Retry-After header — license clients should back off and retry instead of hammering the endpoint.
Slash commands
/create, /list, /info, /edit, /delete, /export, /stats, /servers, /audit, /add-server, /remove-server, /server-limit, /binding-mode, plus /license, /mylicense, /product, /avatars and /setup.
Support
Discord support for this system: https://discord.gg/MwjpYSA5jg
Requirements
- Python 3.10+, SQLite or PostgreSQL
- A Discord application / bot token
