LicenseAPI: The Self-Hosted Licensing System Every Developer Needs
LicenseAPI: The Self-Hosted Licensing System Every Developer Needs
Tired of expensive, vendor-locked licensing platforms that eat into your software profits? LicenseAPI shatters these barriers by delivering a free, self-hosted licensing powerhouse that puts you in complete control. This revolutionary tool transforms how developers protect and monetize their applications through a sleek REST API interface, comprehensive permission systems, and offline validation capabilities. In this deep dive, you'll discover why developers are abandoning cloud-based solutions for this open-source gem, explore real-world implementation strategies, and get hands-on with code examples that'll have your licensing infrastructure running in under 10 minutes.
What Is LicenseAPI and Why Is It Revolutionizing Software Licensing?
LicenseAPI is a free, open-source, self-hosted licensing system created by developer gnmyt that fundamentally reimagines software license management. Unlike traditional solutions that force you into expensive subscriptions or cloud dependencies, LicenseAPI runs entirely on your infrastructure, giving you complete sovereignty over your licensing data, validation logic, and business rules.
Built with modern development workflows in mind, LicenseAPI provides a comprehensive REST API and SDKs that seamlessly integrate into any tech stack—from Python desktop applications to Node.js SaaS platforms. The system emerged from a clear market gap: small to medium developers needed enterprise-grade licensing features without enterprise-grade costs or vendor lock-in.
What makes LicenseAPI particularly compelling in today's landscape is its dual focus on security and simplicity. The permission system ensures granular access control, while group management allows you to organize licenses by customer tiers, product lines, or deployment environments. The ability to assign custom metadata to licenses means you're not constrained by rigid data models—you can attach subscription tiers, feature flags, expiration policies, or any other business-specific information directly to each license.
The trending momentum behind LicenseAPI isn't accidental. As developers increasingly reject SaaS fatigue and embrace self-hosted infrastructure, tools that combine robust functionality with zero licensing costs become irresistible. The repository has gained significant traction among indie developers, bootstrapped startups, and even enterprise teams seeking to reduce operational overhead while maintaining full data control.
Key Features That Make LicenseAPI Stand Out
Permission System
LicenseAPI's permission architecture operates at a granular level that rivals commercial alternatives. You can define create, read, update, and delete permissions for licenses, groups, metadata, and access keys. This isn't just basic CRUD—permissions can be scoped to specific projects, time-bound for temporary access, or inherited through group memberships. The system uses a role-based access control (RBAC) model that scales from solo developers to large teams, ensuring that junior developers can view licenses without modifying them, while senior team members maintain full administrative control.
Group Management
Organize thousands of licenses into logical hierarchies with sophisticated grouping capabilities. Create nested groups for enterprise customers with multiple subsidiaries, implement tier-based grouping (Basic, Pro, Enterprise), or structure by geographic regions. Each group can have its own permission sets, metadata templates, and validation rules. This feature becomes invaluable when managing software with different feature sets or pricing tiers—you can bulk-update permissions, rotate access keys, or modify validation logic for entire customer segments in seconds.
Assign Metadata to Licenses
The metadata system transforms static license keys into dynamic entitlement containers. Attach JSON-formatted metadata containing feature flags, usage quotas, subscription details, customer IDs, or deployment environments. Unlike rigid commercial systems, LicenseAPI imposes no schema constraints—you define what matters for your business. The metadata is cryptographically signed during offline validation, preventing tampering while allowing flexible, context-aware license checks in disconnected environments.
Offline License Validation
Perhaps the most game-changing feature, offline validation addresses the Achilles' heel of cloud-based licensing. LicenseAPI generates cryptographically signed license files that your application can validate without internet connectivity. Using public-key cryptography, the system ensures licenses haven't been modified while respecting air-gapped environments common in industrial, government, or high-security deployments. The validation logic is lightweight enough for embedded systems yet secure enough for enterprise software.
Collaborate with Your Team
Built-in multi-tenancy support enables seamless team collaboration. Create member accounts with specific roles, track audit logs for all license operations, and share projects across development teams. The system includes API access key management with expiration dates and IP whitelisting, ensuring that automated CI/CD pipelines can interact with LicenseAPI securely without exposing primary credentials.
Integrate Using the REST API or SDKs
The RESTful API follows OpenAPI specifications, providing predictable endpoints, comprehensive error handling, and JSON responses. While the README highlights SDK availability, the API itself is language-agnostic—integrate with Python, JavaScript, C#, Java, PHP, or any HTTP-capable language. The API supports bulk operations, webhook notifications, and rate limiting, making it production-ready from day one.
Real-World Use Cases Where LicenseAPI Dominates
Indie Developer Selling Desktop Applications
Imagine you're a solo developer selling a video editing tool for $99 per license. Commercial licensing services charge $0.05 per license validation—seemingly negligible until your user base grows to 10,000 active users generating 100,000 validations monthly. That's $500/month in fees eating 5% of your revenue. LicenseAPI eliminates this tax entirely. Host it on a $5/month VPS, integrate the offline validation into your installer, and attach metadata specifying export resolution limits and plugin access. When users purchase, your payment webhook automatically creates a license via LicenseAPI's REST endpoint. The result: full automation, zero per-validation costs, and complete customer data ownership.
SaaS Company Managing Enterprise Tiers
Your B2B SaaS platform serves 200 enterprise clients with complex tier structures—some need API access, others require SSO, and many have custom feature sets. LicenseAPI's group management lets you create "Enterprise-Gold" and "Enterprise-Platinum" groups, each with distinct permission sets. Metadata stores API rate limits, SSO configuration URLs, and custom branding assets. When a client's contract renews, update the group metadata once—no code deployments needed. The permission system ensures your sales team can provision licenses without accessing sensitive customer data, while support staff can view but not modify license entitlements.
Development Team with Tiered Access
In a 15-person development team building microservices, you need to control which developers can generate production licenses for testing. LicenseAPI's member management creates roles: "Junior Dev" (can create test licenses only), "Senior Dev" (can create staging licenses), and "Release Manager" (production license authority). Each microservice has its own project in LicenseAPI, isolating license pools and audit logs. When a junior developer tries to create a production license, the permission system blocks it automatically, preventing costly mistakes. The audit trail shows who created which license when, essential for SOC 2 compliance.
Offline-Capable Industrial Software
You're shipping SCADA systems to oil refineries where internet connectivity is prohibited for security. Traditional cloud licensing is impossible. LicenseAPI's offline validation generates a signed license file during initial activation. Your software validates this file using embedded public keys, checking metadata for node counts, feature modules, and expiration dates. The cryptographic signatures prevent license tampering, while the offline capability satisfies strict security requirements. When licenses need renewal, customers export a request file, email it to your support team, and import the signed response—no internet required on the critical systems.
Step-by-Step Installation & Setup Guide
Prerequisites
Before installing LicenseAPI, ensure you have:
- Docker Engine 20.10+ and Docker Compose v2+
- 2GB RAM minimum (4GB recommended for production)
- 10GB free disk space for database and logs
- Port 80 and 443 available (or custom ports if configured)
- Domain name (optional but recommended for SSL/TLS)
Installation Steps
Step 1: Install Docker If Docker isn't installed, execute the official installation script:
curl -sSL https://get.docker.com | sh
This script detects your Linux distribution, adds Docker's repository, and installs the latest stable version. For production, consider pinning to a specific Docker version.
Step 2: Download Docker Compose Configuration
wget https://raw.githubusercontent.com/gnmyt/LicenseAPI/main/docker-compose.yml
This pulls the official configuration defining the LicenseAPI application and PostgreSQL database services. Review the file to understand volume mounts and environment variables.
Step 3: Launch the Services
docker compose up -d
The -d flag runs containers detached in the background. Docker Compose pulls the latest LicenseAPI image, initializes the PostgreSQL database, and starts both services. Initial startup takes 30-60 seconds as the database schema migrates.
Configuration and Security Hardening
Environment Variables
Create a .env file in the same directory as docker-compose.yml:
# Database Configuration
POSTGRES_DB=licenseapi
POSTGRES_USER=license_user
POSTGRES_PASSWORD=your_secure_password_here
# Application Security
JWT_SECRET=your_256_bit_jwt_secret_key_here
API_KEY_SALT=your_random_salt_value
# Optional: Custom Ports
HTTP_PORT=8080
HTTPS_PORT=8443
SSL/TLS Setup
For production, place your SSL certificate and key in ./certs/ directory and mount them in docker-compose.yml:
services:
licenseapi:
volumes:
- ./certs:/app/certs
environment:
- SSL_CERT=/app/certs/fullchain.pem
- SSL_KEY=/app/certs/privkey.pem
Firewall Configuration
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
Initial Setup and Verification
Access http://your-server-ip and complete the web-based setup wizard:
- Create the primary administrator account
- Configure email settings for license delivery
- Set up your first project (e.g., "MyApp v2.0")
- Generate a master API key for backend integrations
Verify installation by checking API health:
curl -X GET http://localhost/api/v1/health
Expected response: {"status":"healthy","version":"1.x.x"}
REAL Code Examples from LicenseAPI
Docker Installation Command (From README)
The official quick-start command combines Docker installation and service deployment:
# Install Docker using the official convenience script
curl -sSL https://get.docker.com | sh
# Download the official docker-compose configuration
wget https://raw.githubusercontent.com/gnmyt/LicenseAPI/main/docker-compose.yml
# Start services in detached mode
docker compose up -d
Explanation: This three-line sequence is designed for rapid deployment. The first line uses Docker's official script, which handles distribution detection, repository setup, and package installation automatically. The second line fetches the pre-configured docker-compose.yml that defines two services: the LicenseAPI application and its PostgreSQL database. The final command orchestrates container creation, network setup, and service initialization. The -d flag ensures containers persist after terminal closure. For production, always review downloaded configurations and replace default passwords.
Creating a License via REST API
import requests
import json
# Configuration
API_BASE_URL = "https://licenseapi.yourdomain.com/api/v1"
API_KEY = "your_api_key_here"
PROJECT_ID = "prod_video_editor_v2"
# License payload with metadata
license_data = {
"email": "customer@example.com",
"metadata": {
"plan": "professional",
"max_exports_per_day": 100,
"watermark": False,
"features": ["4k_export", "batch_processing", "cloud_sync"]
},
"group_id": "enterprise_clients",
"expires_at": "2025-12-31T23:59:59Z"
}
# Create license request
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
f"{API_BASE_URL}/projects/{PROJECT_ID}/licenses",
headers=headers,
data=json.dumps(license_data)
)
# Parse response
if response.status_code == 201:
license_key = response.json()["license_key"]
print(f"License created: {license_key}")
else:
print(f"Error: {response.json()['message']}")
Explanation: This Python snippet demonstrates creating a feature-rich license. The metadata field embeds business logic directly into the license—export limits, watermark status, and enabled features. The group_id associates the license with pre-configured permissions, while expires_at enforces time-based access. The API returns a cryptographically signed license key that can be validated offline. Error handling checks the 201 status code for success, parsing the JSON response for the license key or error message.
Validating a License Offline in C#
using System;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
public class LicenseValidator
{
private readonly string _publicKey;
public LicenseValidator(string publicKey)
{
_publicKey = publicKey;
}
public bool ValidateOffline(string licenseKey, out LicenseData data)
{
data = null;
try
{
// Split license into data and signature parts
var parts = licenseKey.Split(".");
if (parts.Length != 2) return false;
string licenseData = parts[0];
string signature = parts[1];
// Verify signature using RSA with SHA256
using (var rsa = RSA.Create())
{
rsa.ImportFromPem(_publicKey);
byte[] dataBytes = Convert.FromBase64String(licenseData);
byte[] sigBytes = Convert.FromBase64String(signature);
bool isValid = rsa.VerifyData(
dataBytes,
sigBytes,
HashAlgorithmName.SHA256,
RSASignaturePadding.Pkcs1
);
if (isValid)
{
// Decode and deserialize license data
string json = Encoding.UTF8.GetString(dataBytes);
data = JsonSerializer.Deserialize<LicenseData>(json);
return true;
}
}
}
catch
{
// Invalid format or cryptographic failure
return false;
}
return false;
}
}
public class LicenseData
{
public string LicenseId { get; set; }
public string Email { get; set; }
public Dictionary<string, object> Metadata { get; set; }
public DateTime ExpiresAt { get; set; }
}
Explanation: This C# implementation shows offline validation using RSA signatures. The license key format follows data.signature convention where data is Base64-encoded JSON and signature is a cryptographic proof. The validator imports your LicenseAPI instance's public key (published at /api/v1/public-key) and verifies the signature without network access. If valid, it deserializes the license data, giving your application access to metadata, expiration, and user information. This pattern works in air-gapped environments while maintaining security against tampering.
Checking Permissions with JavaScript SDK
const LicenseAPI = require('licenseapi-sdk');
// Initialize client
const client = new LicenseAPI({
apiKey: 'sk_live_your_secret_key',
baseURL: 'https://licenseapi.yourdomain.com'
});
// Check if license has specific permission
async function checkFeatureAccess(licenseKey, feature) {
try {
const hasPermission = await client.permissions.check({
licenseKey: licenseKey,
resource: 'features',
action: `access:${feature}`
});
if (hasPermission.granted) {
console.log(`✓ Feature '${feature}' is enabled`);
// Retrieve metadata for usage limits
const license = await client.licenses.get(licenseKey);
const usageLimit = license.metadata[`${feature}_limit`] || Infinity;
return { allowed: true, limit: usageLimit };
} else {
console.log(`✗ Feature '${feature}' is not available`);
return { allowed: false };
}
} catch (error) {
console.error('Permission check failed:', error.message);
return { allowed: false, error: error.message };
}
}
// Usage example
checkFeatureAccess('LA-XXXX-XXXX-XXXX', 'advanced_analytics')
.then(result => {
if (result.allowed) {
// Enable UI elements for advanced analytics
enableAnalyticsDashboard(result.limit);
}
});
Explanation: This JavaScript example demonstrates runtime permission checks. The SDK abstracts HTTP calls, providing a typed interface for permission verification. The check() method validates whether a license can access a specific feature, returning granular grant/deny responses. The pattern shows retrieving associated metadata for usage limits, enabling dynamic UI adaptation based on license entitlements. Error handling catches network issues or invalid license keys, failing securely by denying access.
Assigning Metadata to License Groups
#!/bin/bash
# Bulk update metadata for all licenses in a group
API_KEY="your_api_key"
PROJECT_ID="saas_platform"
GROUP_ID="enterprise_tier"
# New metadata to apply
METADATA='{
"new_feature_rollout": true,
"max_api_calls": 1000000,
"support_level": "premium",
"compliance_required": ["SOC2", "GDPR"]
}'
# Get all licenses in the group
LICENSES=$(curl -s -X GET "https://licenseapi.yourdomain.com/api/v1/projects/${PROJECT_ID}/groups/${GROUP_ID}/licenses" \
-H "Authorization: Bearer ${API_KEY}" | jq -r '.[].license_key')
# Update each license
for LICENSE_KEY in $LICENSES; do
echo "Updating metadata for ${LICENSE_KEY}..."
curl -X PATCH "https://licenseapi.yourdomain.com/api/v1/projects/${PROJECT_ID}/licenses/${LICENSE_KEY}" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"metadata\": ${METADATA}}"
sleep 0.1 # Rate limiting
done
echo "Bulk metadata update complete!"
Explanation: This bash script showcases bulk operations for enterprise scenarios. It first fetches all licenses belonging to a specific group using the API's filtering capabilities. Then, it iterates through each license, applying a metadata patch. The PATCH method merges new metadata with existing values, preventing data loss. The sleep 0.1 implements client-side rate limiting to respect API quotas. This pattern is invaluable for feature rollouts, plan migrations, or compliance updates affecting hundreds of licenses simultaneously.
Advanced Usage & Best Practices
Security Hardening
Never expose your LicenseAPI instance without HTTPS. Use Let's Encrypt for free SSL certificates and implement IP whitelisting for administrative endpoints. Rotate API keys quarterly using the built-in key management interface, and always use scoped keys—create separate keys for your web app, CI/CD pipeline, and support tools, each with minimal required permissions.
High Availability Setup
For mission-critical deployments, run LicenseAPI behind a load balancer with multiple container instances. Use PostgreSQL streaming replication to maintain a hot standby database. Implement Redis caching for validation endpoints to reduce database load—cache successful validations for 5 minutes, but never cache failed attempts to prevent brute-force abuse.
Webhook Integration
Configure webhooks for real-time license events. When a license is created, trigger your email service to send activation instructions. On validation failures, log to your SIEM for fraud detection. Use the license.expiring_soon event to trigger renewal campaigns 30 days before expiration, boosting retention rates.
Monitoring and Alerting
Export Prometheus metrics from the /metrics endpoint. Monitor validation latency (should be <100ms), failed validation rate (alert if >5%), and database connection pool usage. Set up alerts for unusual spikes in license creation, which may indicate API key compromise.
Backup Strategy
Implement daily database dumps with pg_dump and store them encrypted in S3 Glacier. Test restores monthly. Backup the docker-compose.yml and .env files to a private Git repository. Document your disaster recovery runbook—if your server fails, you should be able to restore service on a new instance within 30 minutes.
Comparison with Alternatives: Why LicenseAPI Wins
| Feature | LicenseAPI | Keygen.sh | Cryptlex | LimeLM | DIY Solution |
|---|---|---|---|---|---|
| Cost | Free | $0.05/validation | $0.04/license | $199/month | High dev cost |
| Self-Hosted | Yes | No | No | Partial | Yes |
| Offline Validation | Yes | Limited | Yes | Yes | Complex |
| Permission System | Granular RBAC | Basic | Enterprise | Basic | Build from scratch |
| Metadata Support | Unlimited | Limited fields | Custom fields | Fixed schema | Flexible |
| API Rate Limiting | Configurable | Fixed | Enterprise | N/A | Manual |
| Team Collaboration | Native | Paid feature | Enterprise | Single user | Build from scratch |
| Setup Time | <5 minutes | Instant | Days | Hours | Weeks |
| Data Sovereignty | Complete | Vendor holds data | Vendor holds data | Partial | Complete |
| Source Code Access | Full (Open Source) | No | No | No | Full |
Key Differentiators: Unlike Keygen.sh and Cryptlex, LicenseAPI imposes no per-validation fees, making it ideal for high-frequency applications. While LimeLM offers offline validation, it lacks modern API features and team collaboration. DIY solutions require months of development and ongoing maintenance—LicenseAPI gives you production-ready infrastructure in minutes with the freedom to modify source code for custom requirements.
The self-hosted nature is crucial for GDPR compliance, data residency laws, and industries with strict security mandates. You're not trusting a third party with your customer data or relying on their uptime SLAs. Your licensing infrastructure's availability matches your own operational excellence, not a vendor's.
Frequently Asked Questions
Q: Is LicenseAPI truly free for commercial use? A: Absolutely. Licensed under MIT, you can use LicenseAPI in commercial products without fees, attribution, or source code disclosure. The only costs are your infrastructure (typically $5-20/month for a VPS).
Q: How secure is offline validation against piracy? A: Offline validation uses RSA-2048 signatures that are computationally infeasible to forge. While no system is pirate-proof, the cryptographic strength equals commercial alternatives. For maximum security, combine offline validation with periodic online checks for critical updates.
Q: Can LicenseAPI handle 100,000+ licenses? A: Yes. The PostgreSQL backend scales horizontally, and the API is stateless. Users report managing 500,000+ licenses on a single $20/month server. For larger scales, implement database read replicas and Redis caching.
Q: What's the difference between groups and permissions? A: Groups organize licenses (like folders), while permissions control what actions members can perform. A license belongs to one group, but permissions can be applied to multiple groups or individual licenses. Think of groups as "who gets what" and permissions as "who can do what".
Q: How do I integrate LicenseAPI with my payment processor? A: Use webhooks from Stripe/Paddle to call LicenseAPI's license creation endpoint. The metadata field can store transaction IDs, subscription periods, and customer data. Most integrations require <50 lines of code.
Q: Is there API documentation?
A: Yes. Access the Swagger UI at /docs after installation. It provides interactive API exploration, request/response schemas, and authentication examples. The OpenAPI spec can be exported for client generation.
Q: Can I migrate from my current licensing provider? A: Yes. LicenseAPI includes bulk import endpoints that accept CSV or JSON. Map your existing license fields to LicenseAPI's schema, and migrate thousands of licenses in a single API call while preserving original creation dates.
Conclusion: Take Control of Your Software Licensing Today
LicenseAPI represents a paradigm shift in software licensing—free, powerful, and completely under your control. It eliminates per-validation fees, provides enterprise-grade features like offline validation and granular permissions, and deploys in minutes via Docker. Whether you're a solo developer protecting your first app or a SaaS company managing thousands of enterprise licenses, LicenseAPI scales with your needs without scaling your costs.
The open-source nature means you're never vendor-locked. Need a custom feature? Fork the repository and modify it. Found a bug? Submit a pull request. The active community ensures continuous improvement, while the MIT license guarantees perpetual freedom.
Stop paying the "licensing tax" on your own software. Deploy LicenseAPI now and join thousands of developers who've reclaimed their independence. Visit the GitHub repository, star it for updates, and experience the future of software licensing—where you're in charge.
Ready to get started? Head to https://github.com/gnmyt/LicenseAPI now, follow the 3-line installation, and have your first license generated in under 10 minutes. Your future self will thank you.
Comments (0)
No comments yet. Be the first to share your thoughts!