feat: Pro limit 2,500/mo, website templating, cleanup
All checks were successful
Deploy to Production / Deploy to Server (push) Successful in 2m24s

- Set Pro tier limit to 2,500 PDFs/month (was unlimited/5000)
- Added Pro limit enforcement in usage middleware
- Updated landing page, JSON-LD, and Stripe product description
- Created build-time HTML templating (partials for nav/footer/styles)
- Source files in public/src/, partials in public/partials/
- Build script: node scripts/build-html.cjs
- Deleted stale backup file
- Fixed index.html nav logo to use <a> tag for consistency
This commit is contained in:
OpenClaw 2026-02-16 18:46:26 +00:00
parent d3015826e5
commit aab6bf3bee
15 changed files with 556 additions and 407 deletions

View file

@ -2,6 +2,7 @@ import { isProKey } from "../services/keys.js";
import logger from "../services/logger.js";
import pool from "../services/db.js";
const FREE_TIER_LIMIT = 100;
const PRO_TIER_LIMIT = 5000;
// In-memory cache, periodically synced to PostgreSQL
let usage = new Map();
function getMonthKey() {
@ -36,6 +37,15 @@ export function usageMiddleware(req, res, next) {
const key = keyInfo?.key || "unknown";
const monthKey = getMonthKey();
if (isProKey(key)) {
const record = usage.get(key);
if (record && record.monthKey === monthKey && record.count >= PRO_TIER_LIMIT) {
res.status(429).json({
error: "Pro tier limit reached (5,000/month). Contact support for higher limits.",
limit: PRO_TIER_LIMIT,
used: record.count,
});
return;
}
trackUsage(key, monthKey);
next();
return;
@ -46,7 +56,7 @@ export function usageMiddleware(req, res, next) {
error: "Free tier limit reached",
limit: FREE_TIER_LIMIT,
used: record.count,
upgrade: "Upgrade to Pro for unlimited conversions: https://docfast.dev/pricing",
upgrade: "Upgrade to Pro for 5,000 PDFs/month: https://docfast.dev/pricing",
});
return;
}

View file

@ -67,7 +67,7 @@ a { color: #4f9; }
<p>Your API key:</p>
<div class="key" style="position:relative">${escapeHtml(keyInfo.key)}<button onclick="navigator.clipboard.writeText('${escapeHtml(keyInfo.key)}');this.textContent='Copied!';setTimeout(()=>this.textContent='Copy',1500)" style="position:absolute;top:8px;right:8px;background:#4f9;color:#0a0a0a;border:none;border-radius:4px;padding:4px 12px;cursor:pointer;font-size:0.8rem;font-family:system-ui">Copy</button></div>
<p><strong>Save this key!</strong> It won't be shown again.</p>
<p>10,000 PDFs/month All endpoints Priority support</p>
<p>5,000 PDFs/month All endpoints Priority support</p>
<p><a href="/docs">View API docs </a></p>
</div></body></html>`);
}
@ -171,7 +171,7 @@ async function getOrCreateProPrice() {
else {
const product = await getStripe().products.create({
name: "DocFast Pro",
description: "Unlimited PDF conversions via API. HTML, Markdown, and URL to PDF.",
description: "5,000 PDFs / month via API. HTML, Markdown, and URL to PDF.",
});
productId = product.id;
}