Electron License Starter
Clone-and-run Electron app with Keymint license activation pre-configured. Machine binding, activation UI, and license health checks included.
Quick Start
bash
git clone https://github.com/keymint-dev/keymint-electron-starter.git
cd keymint-electron-starter
npm install
cp .env.example .env
# Fill in KEYMINT_CLIENT_API_KEY and KEYMINT_PRODUCT_ID
npm run devOpens an Electron window with an activation dialog. Enter a valid Keymint license key, and the main app unlocks.
What's Included
- License activation — calls
POST /key/activatewithnode-machine-idhost binding - Activation UI — clean dialog with key entry and status feedback
- Persistent storage — license key and activation state saved via
electron-store - Health checks — periodic re-validation to catch revocations
- Deactivation — frees the activation seat on app quit
- Preload + IPC — secure bridge between renderer and main process
Configuration
Create a .env file:
text
KEYMINT_CLIENT_API_KEY=km_client_your_key
KEYMINT_PRODUCT_ID=prod_Nx8K2mLpQ4rVtW9sBc| Variable | Where to Find It |
|---|---|
KEYMINT_CLIENT_API_KEY | Keymint Dashboard → Developer → API Keys (create a client scope key) |
KEYMINT_PRODUCT_ID | Keymint Dashboard → Products → your product |
Project Structure
text
src/
├── main/
│ ├── index.ts # Electron main process, gates app on license
│ ├── license.ts # Keymint SDK wrapper (activate, deactivate, health check)
│ └── ipc.ts # IPC handlers for renderer ↔ main communication
├── preload/
│ └── index.ts # contextBridge exposing licenseAPI to renderer
├── renderer/
│ ├── activation.html # Activation dialog
│ └── app.html # Main app (shown after successful activation)
└── env.d.ts # Type declarations for env varsSDK Methods Used
| Method | Where | Purpose |
|---|---|---|
client.activateKey() | license.ts | Validate and bind license to machine |
client.deactivateKey() | license.ts | Free activation seat on quit |
machineIdSync() | license.ts | Hardware fingerprint for hostId |
Build & Package
bash
npm run build # Compile TypeScript
npm run package # Package with electron-builderThe client API key is compiled into the binary. It has client scope — it can activate, deactivate, and manage floating sessions. It cannot read customer data or modify other licenses.
Next Steps
- Add floating license support for concurrent seat licensing
- Add offline license verification for air-gapped deployments
- Wire up Stripe subscription licensing
- Customize the activation UI with your brand colors and logo