Skip to main content

CODITECT License Manager - SaaS License Control System

Production-grade license management for CODITECT SaaS platform with tier-based feature enforcement, usage quota tracking, and JWT-based license key generation.

License Tiers:

  • FREE: Max 5 projects, 10 AI ops/day, community support, single user
  • STARTER: $29/month - 25 projects, 500 AI ops/day, email support, 3 users
  • PRO: $99/month - 100 projects, 5K AI ops/day, priority support, 10 users
  • ENTERPRISE: Custom - Unlimited projects/ops, dedicated support, unlimited users

Features:

  • JWT-based license key generation and validation
  • Tier-based feature enforcement
  • Usage quota tracking and enforcement
  • Expiration checking with grace period (7 days)
  • Multi-user license support
  • Offline validation (cached for 24 hours)
  • Database-backed persistence (SQLite/PostgreSQL)

Usage: from license_manager import LicenseManager, LicenseTier

lm = LicenseManager()

# Generate new license
license_key = lm.generate_license(
tier=LicenseTier.PRO,
user_email="user@example.com",
organization="Acme Corp"
)

# Validate license
is_valid = lm.validate_license(license_key)

# Check quota
can_proceed = lm.check_quota(license_key, operation_type="ai_operation")

# Record usage
lm.record_usage(license_key, operation_type="ai_operation")

Author: AZ1.AI CODITECT Team Sprint: Phase 4 - License Management Implementation Date: 2025-11-22

File: license_manager.py

Classes

LicenseError

Base exception for license management errors.

LicenseValidationError

Raised when license validation fails.

LicenseExpiredError

Raised when license has expired.

QuotaExceededError

Raised when usage quota is exceeded.

LicenseNotFoundError

Raised when license cannot be found.

DatabaseError

Raised when database operation fails.

ConfigurationError

Raised when configuration is invalid.

EncryptionError

Raised when encryption/decryption fails.

LicenseTier

License tier levels.

LicenseStatus

License status states.

Functions

main()

CLI entry point for license management operations.

to_dict()

Convert to dictionary.

to_dict()

Convert to dictionary.

to_dict()

Convert to dictionary.

generate_license(tier, user_email, organization, duration_days)

Generate new license key.

validate_license(license_key)

Validate license key.

check_quota(license_key, operation_type)

Check if operation is within quota limits.

record_usage(license_key, operation_type, count)

Record usage event.

get_license_info(license_key)

Get comprehensive license information and usage stats.

renew_license(license_key, duration_days)

Renew license for additional period.

suspend_license(license_key)

Suspend license temporarily.

activate_license(license_key)

Activate suspended license.

revoke_license(license_key)

Revoke license permanently.

find_git_root()

No description

Usage

python license_manager.py