Deploy keygen

Add license key, entitlements, and activation to desktop apps, software

Deploy keygen

/var/lib/postgresql/data

Just deployed

Just deployed

/data

keygen-worker

khakra/keygen-api

Just deployed

Deploy and Host keygen on Railway

Keygen is a fair source JSON HTTP API for software licensing and distribution. It supports license key management, activations, entitlements, concurrency and usage tracking, as well as secure artifact distribution with automatic upgrades.

About Hosting keygen

Self-hosting Keygen gives you complete control over your software licensing infrastructure. The deployment involves running a Ruby on Rails application backed by PostgreSQL for data persistence and Redis for caching and background jobs. Keygen provides a comprehensive JSON HTTP API for license key management, machine activations, entitlements, usage tracking, and secure artifact distribution with automatic upgrades. The API follows JSON:API conventions with some developer-friendly deviations. You'll need to configure environment variables for database connections, Redis, secret keys, and optional integrations. The platform supports role-based access control, rate limiting, and cryptographic signature verification for secure offline licensing.

Common Use Cases

  • Software licensing - Issue and validate license keys for desktop apps, server applications, and on-premise software
  • Machine activation tracking - Enforce per-device licensing with fingerprint-based machine management and heartbeat monitoring
  • Feature entitlements - Control access to specific features and capabilities within your software products
  • Usage metering - Track concurrent usage, enforce limits, and monitor license consumption patterns

Dependencies for keygen Hosting

  • PostgreSQL (included in this template)
  • Redis (included in this template)

Deployment Dependencies

Main configuration requirements:

  • KEYGEN_ADMIN_EMAIL - Admin email for the Keygen instance
  • KEYGEN_ADMIN_PASSWORD - Admin password for the Keygen instance, will be auto-generated if not set

Full self-hosting documentation: https://keygen.sh/docs/self-hosting/

Environment Setup:

After the service is deployed, send the below requests -

1. Create API Token -

POST https:///v1/accounts//tokens
-H 'Accept: application/vnd.api+json'
-u "KEYGEN_ADMIN_EMAIL:KEYGEN_ADMIN_PASSWORD"

2. Get Public Keys associated with the account

GET https:///v1/accounts/
-H 'Accept: application/vnd.api+json'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer '

The public key is in base64 format, to get the raw bytes you can decode base64 format

RAILWAY_PUBLIC_DOMAIN is the public URL of your Railway deployment for the keygen-api service ACCOUNT_ID is same as the Railway Project ID. You can find this in the keygen-api service variable KEYGEN_ACCOUNT_ID KEYGEN_ADMIN_EMAIL is the admin email you set during deployment KEYGEN_ADMIN_PASSWORD is the admin password you set during deployment

The API token is generated with admin privileges and provides full access to the Keygen API. The token can be found in the response of the API call above as "token": "admin-somehexnumber". This API Token can then be used with https://keymana.com/ to manage your products, licenses, and users, etc.

Why Deploy keygen on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying keygen on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

View Template
(v1) Simple Medusa Backend
Deploy an ecommerce backend and admin using Medusa

View Template
peppermint
Docker-compose port for peppermint.sh