v0.4.0: Remove free tier, add public demo endpoint with watermark
- Remove free account signup flow entirely - Add POST /v1/demo/html and /v1/demo/markdown (public, no auth) - Demo: 5 requests/hour per IP, 50KB body limit, watermarked PDFs - Landing page: interactive playground replaces 'Get Free API Key' - Pricing: Demo (free) + Pro (€9/mo), no more Free tier - /v1/signup returns 410 Gone with redirect to demo/pro - Keep /v1/recover for existing Pro users - Update JSON-LD, API discovery, verify page text
This commit is contained in:
parent
9095175141
commit
53755d6093
6 changed files with 299 additions and 240 deletions
25
src/index.ts
25
src/index.ts
|
|
@ -13,7 +13,7 @@ import rateLimit from "express-rate-limit";
|
|||
import { convertRouter } from "./routes/convert.js";
|
||||
import { templatesRouter } from "./routes/templates.js";
|
||||
import { healthRouter } from "./routes/health.js";
|
||||
import { signupRouter } from "./routes/signup.js";
|
||||
import { demoRouter } from "./routes/demo.js";
|
||||
import { recoverRouter } from "./routes/recover.js";
|
||||
import { billingRouter } from "./routes/billing.js";
|
||||
import { authMiddleware } from "./middleware/auth.js";
|
||||
|
|
@ -58,7 +58,8 @@ app.use(compressionMiddleware);
|
|||
app.use((req, res, next) => {
|
||||
const isAuthBillingRoute = req.path.startsWith('/v1/signup') ||
|
||||
req.path.startsWith('/v1/recover') ||
|
||||
req.path.startsWith('/v1/billing');
|
||||
req.path.startsWith('/v1/billing') ||
|
||||
req.path.startsWith('/v1/demo');
|
||||
|
||||
if (isAuthBillingRoute) {
|
||||
res.setHeader("Access-Control-Allow-Origin", "https://docfast.dev");
|
||||
|
|
@ -96,7 +97,14 @@ app.use(limiter);
|
|||
|
||||
// Public routes
|
||||
app.use("/health", healthRouter);
|
||||
app.use("/v1/signup", signupRouter);
|
||||
app.use("/v1/demo", express.json({ limit: "50kb" }), pdfRateLimitMiddleware, demoRouter);
|
||||
app.use("/v1/signup", (_req, res) => {
|
||||
res.status(410).json({
|
||||
error: "Free accounts have been discontinued. Try our demo at POST /v1/demo/html or upgrade to Pro at https://docfast.dev",
|
||||
demo_endpoint: "/v1/demo/html",
|
||||
pro_url: "https://docfast.dev/#pricing"
|
||||
});
|
||||
});
|
||||
app.use("/v1/recover", recoverRouter);
|
||||
app.use("/v1/billing", billingRouter);
|
||||
|
||||
|
|
@ -173,7 +181,7 @@ p{color:#7a8194;margin-bottom:24px;line-height:1.6}
|
|||
${apiKey ? `
|
||||
<div class="warning">⚠️ Save your API key securely. You can recover it via email if needed.</div>
|
||||
<div class="key-box" onclick="navigator.clipboard.writeText('${apiKey}');this.style.borderColor='#5eead4';setTimeout(()=>this.style.borderColor='#34d399',1500)">${apiKey}</div>
|
||||
<div class="links">100 free PDFs/month · <a href="/docs">Read the docs →</a></div>
|
||||
<div class="links">Upgrade to Pro for 5,000 PDFs/month · <a href="/docs">Read the docs →</a></div>
|
||||
` : `<div class="links"><a href="/">← Back to DocFast</a></div>`}
|
||||
</div></body></html>`;
|
||||
}
|
||||
|
|
@ -241,10 +249,11 @@ app.get("/api", (_req, res) => {
|
|||
name: "DocFast API",
|
||||
version: APP_VERSION,
|
||||
endpoints: [
|
||||
"POST /v1/signup/free — Get a free API key",
|
||||
"POST /v1/convert/html",
|
||||
"POST /v1/convert/markdown",
|
||||
"POST /v1/convert/url",
|
||||
"POST /v1/demo/html — Try HTML→PDF (no auth, watermarked, 5/hour)",
|
||||
"POST /v1/demo/markdown — Try Markdown→PDF (no auth, watermarked, 5/hour)",
|
||||
"POST /v1/convert/html — HTML→PDF (requires API key)",
|
||||
"POST /v1/convert/markdown — Markdown→PDF (requires API key)",
|
||||
"POST /v1/convert/url — URL→PDF (requires API key)",
|
||||
"POST /v1/templates/:id/render",
|
||||
"GET /v1/templates",
|
||||
"POST /v1/billing/checkout — Start Pro subscription",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue