Same model as Invoice Ninja. One codebase, two modes controlled by env var.
Same Torqvoice app runs everywhere. One env var determines the gating logic:
TORQVOICE_MODE=cloud # set on app.torqvoice.com
TORQVOICE_MODE=self-hosted # default if not set
app.torqvoice.com)torqvoice.com/api/license/validateCore features, same limits as cloud free:
Unlocks all features + removes branding:
Purchase page: torqvoice.com/white-label
Same approach as Invoice Ninja. No hardware ID, no domain binding. Simple server-side validation.
invoicing.co/claim_license?license_key={key}&product_id={id}white_label) and expiry date in local databasetorqvoice.com/white-labeltorqvoice.com/api/license/validate with the key{ valid: true, plan: "white-label", expiresAt: "..." }license.key — the key itselflicense.valid — "true" or "false"license.plan — "white-label"license.checkedAt — last validation timestamp{ valid: false }license.valid value so the app keeps workingSelf-hosted Torqvoice torqvoice.com
───────────────────── ─────────────
User enters key
│
▼
POST /api/license/validate ──────────────────► Check key in License table
{ key: "clx..." } - exists?
- status = "active"?
- not expired?
◄──────────────────────────────────────
{ valid: true,
plan: "white-label",
expiresAt: "2027-02-15" }
│
▼
Store in SystemSetting:
license.key = "clx..."
license.valid = "true"
license.plan = "white-label"
license.checkedAt = now()
│
▼
Unlock all features
Remove branding
Self-hosted Torqvoice torqvoice.com
───────────────────── ─────────────
POST /api/license/validate ──────── X ────────► (unreachable)
│
▼
Read cached SystemSetting:
license.valid = "true" (from last check)
│
▼
Keep features unlocked
(will re-validate on next startup)
One shared gating function, two strategies:
// src/lib/features.ts
type Plan = "free" | "pro" | "enterprise" | "white-label";
function getEffectivePlan(): Plan {
if (process.env.TORQVOICE_MODE === "cloud") {
// Read from organization's subscription in database
return orgPlan; // "free" | "pro" | "enterprise"
} else {
// Self-hosted: license valid = white-label, otherwise free
return licenseValid ? "white-label" : "free";
}
}
Feature checks map plan → permissions:
const PLAN_FEATURES = {
free: {
maxCustomers: 5,
maxUsers: 1,
templates: 2,
reports: false,
smtp: false,
api: false,
payments: false,
customFields: false,
brandingRemoved: false,
customPlatformName: false,
},
pro: {
maxCustomers: Infinity,
maxUsers: 5,
templates: Infinity,
reports: true,
smtp: true,
api: true,
payments: true,
customFields: true,
brandingRemoved: false,
customPlatformName: false,
},
enterprise: {
maxCustomers: Infinity,
maxUsers: 50,
templates: Infinity,
reports: true,
smtp: true,
api: true,
payments: true,
customFields: true,
brandingRemoved: false,
customPlatformName: false,
},
"white-label": {
maxCustomers: Infinity,
maxUsers: Infinity,
templates: Infinity,
reports: true,
smtp: true,
api: true,
payments: true,
customFields: true,
brandingRemoved: true,
customPlatformName: true,
},
};
Usage in the app:
// In a server component or action
const plan = await getEffectivePlan();
const features = PLAN_FEATURES[plan];
if (!features.reports) {
// Hide reports nav item / return 403
}
if (customerCount >= features.maxCustomers) {
// Block creating new customers, show upgrade prompt
}
/#pricing): 3-tier cloud plans/white-label): Purchase page for self-hosted usersLicense {
key — unique license key (cuid, e.g. "clx8f7g2k0001...")
email — customer email
status — active | expired | revoked
plan — pro | enterprise | white-label
expiresAt — expiration date (1 year from purchase)
}
plan: "pro" / "enterprise" — cloud subscription licenses (managed by Stripe webhooks)plan: "white-label" — self-hosted white-label licenses| Self-Hosted Free | Self-Hosted Licensed | Cloud Free | Cloud Pro | Cloud Enterprise | |
|---|---|---|---|---|---|
| Price | $0 | $30/yr | $0 | $99/yr | $140/yr |
| Customers | 5 | Unlimited | 5 | Unlimited | Unlimited |
| Vehicles | Unlimited | Unlimited | Unlimited | Unlimited | Unlimited |
| Users | 1 | Unlimited | 1 | 5 | 50 |
| Invoice Templates | 2 | All | 2 | All | All |
| Reports & Analytics | No | Yes | No | Yes | Yes |
| SMTP / Custom Email | No | Yes | No | Yes | Yes |
| API Access | No | Yes | No | Yes | Yes |
| Online Payments | No | Yes | No | Yes | Yes |
| Custom Fields | No | Yes | No | Yes | Yes |
| Branding Removed | No | Yes | No | No | No |
| Custom Platform Name | No | Yes | No | No | No |