Invite Codes — Admin Guide
This page covers managing invite codes from an administrator's perspective: enabling invite-only registration, generating bulk codes, and configuring per-user quotas.
Enabling invite-only registration
Set the INVITE_ONLY environment variable to true and restart the server:
INVITE_ONLY=true
With this flag set, the sign-up form will show an invite code field. Users who attempt to register without a valid code will see an error.
To disable all new registrations entirely (not just gate them with invite codes):
ALLOW_SIGNUP=false
Admin panel — Invite Codes
Navigate to https://your-domain.com/admin/invite-codes (requires admin account). From this page you can:
- Generate codes in bulk — specify how many codes to generate and optionally a TTL (expiry in days).
- View all codes — see which codes are used, unused, or expired.
- Revoke unused codes — individually or in bulk.
- Set per-user quota — how many codes each non-admin user can generate from their Settings page.
Generating codes via CLI
# Generate 10 invite codes with no expiry
docker compose exec api python -m cleverthis.cli generate-invite-codes --count 10
# Generate 5 codes that expire in 7 days
docker compose exec api python -m cleverthis.cli generate-invite-codes --count 5 --ttl-days 7
The CLI prints the generated codes to stdout. Pipe to a file to distribute them:
docker compose exec api python -m cleverthis.cli generate-invite-codes --count 10 > invite-codes.txt
Audit log
All invite code events (generation, use, revocation) are logged to the audit log table in the database. You can query them via the admin panel or directly in PostgreSQL.
Invite link generation (embeddable URLs) and invite code analytics (conversion rate, time to use) are being added.