Self-Hosting
Use this page to run LicenseKit yourself with PostgreSQL and the locksmith CLI.
Who This Is For
- teams evaluating or operating a self-hosted deployment
- developers running LicenseKit locally
- operators who want direct control of state and infrastructure
When To Use This
Use self-hosting when the hosted API is not the target deployment model.
How It Works
The basic local or self-hosted flow is:
- start PostgreSQL
- build the
locksmithbinary - run
locksmith init - run
locksmith migrate up - run
locksmith serve
The repo also includes:
Dockerfiledocker-compose.yml
The compose file starts:
dbon PostgreSQL 16appwithserve --addr :8080 --state-dir /data
Example
Local CLI path:
bash
docker compose up -d db
make build
./bin/locksmith init
./bin/locksmith migrate up
./bin/locksmith serveDocker Compose path:
bash
docker compose up --buildImportant generated local state from locksmith init:
- signing keyset JSON
- bootstrap record JSON
.locksmith/locksmith.env- initial admin API key, shown once
Common Mistakes
- running
servebefore applying migrations - losing the one-time bootstrap admin key output from
init - treating local
.locksmithstate as disposable when it contains active signing material - forgetting that the service still needs a PostgreSQL connection string