Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
7.2 KiB
Deploying Menivor (menivor.com)
Single entry point for taking the stack live. Two independent deploy surfaces:
| Surface | What | How | Runbook |
|---|---|---|---|
| API + workers | FastAPI + Celery + Postgres/Redis/R2 on k8s | Tag-triggered pipeline (deploy.yml) |
docs/runbooks/deploy-oneshot.md |
| Web | Next.js 15 on Cloudflare Workers (OpenNext) | npm run cf:deploy from apps/web |
This file, below — not covered by the runbooks |
1. API path (fully documented elsewhere — start here, then follow links)
The API/k8s side is complete and runbook-covered; do not duplicate it here:
docs/runbooks/deploy-credentials.md— the owner key checklist per phase: Phase 0 Neon/Upstash/R2/Sentry, Phase 1 Anthropic/ElevenLabs/HeyGen, Phase 2 Clerk, Phase 3 payments (Creem/Stripe/iyzico/Polar + RevenueCat), Phase 4 social OAuth.docs/runbooks/deploy-oneshot.md— the creds-in-hand → live-pilot flow (env → preflight → migrate → deploy → golden smoke), including the launch-flag flip table (§5): keepinternal_pilot→SIGNUP_ENABLEDafter Phase 2 →LAUNCH_MODE=public+PUBLIC_LAUNCH_APPROVED→CHECKOUT_ENABLEDafter one real paid webhook →PUBLISHING_ENABLEDafter Phase 4 OAuth approval.docs/runbooks/deploy.md— CI/CD mechanics + rollback.
Gate before anything ships:
python3 scripts/deploy-preflight.py --env-file .env.reelforge # must exit 0
Phased, shape-validating, secret-free. The same checks now also run at API
startup (app/core/launch_preflight.py, wired into the FastAPI lifespan):
under a public launch posture (REELFORGE_LAUNCH_MODE=public or any launch
flag enabled) a missing required var aborts startup listing every problem;
in internal_pilot/dev it only warns. A misconfigured public deploy can no
longer serve traffic quietly.
2. Web path (Cloudflare Workers) — the part the runbooks do not cover
apps/web deploys to Cloudflare Workers via @opennextjs/cloudflare.
apps/web/wrangler.jsonc is already configured: account id, menivor.com +
www.menivor.com custom domains, production Clerk publishable key,
NEXT_PUBLIC_API_BASE=https://api.menivor.com/api/v1, observability enabled.
2.1 Build-time env — read this first
NEXT_PUBLIC_* vars are inlined AT BUILD TIME from apps/web/.env.local
(see the comment in wrangler.jsonc). The vars block in wrangler.jsonc
documents the intended values, but a runtime var can never fix a wrong build —
if the bundle was built with a placeholder Clerk key, redeploying with correct
vars changes nothing. Before building, make sure apps/web/.env.local
contains the same values as the vars block (template: apps/web/.env.example):
NEXT_PUBLIC_API_BASE=https://api.menivor.com/api/v1
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_Y2xlcmsubWVuaXZvci5jb20k
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/dashboard
No real Clerk key yet? Leave the placeholder — the marketing site renders
fully keyless (lib/clerk.ts hasRealClerkKey + components/auth/clerk-safe.tsx
- middleware bypass) and auth re-engages automatically once a real key is built in.
2.2 One-time setup
cd apps/web
npx wrangler login # authenticate the Cloudflare account
# Waitlist storage (app/api/waitlist/route.ts). Create the namespace and paste
# the returned id over the REPLACE_WITH_WAITLIST_KV_NAMESPACE_ID placeholder in
# wrangler.jsonc → kv_namespaces → WAITLIST:
npx wrangler kv namespace create WAITLIST
# Server-side Clerk secret (matches the pk_live_… publishable key; Phase 2 of
# deploy-credentials.md). Stored as a Worker secret, never in wrangler.jsonc:
npx wrangler secret put CLERK_SECRET_KEY
Until the KV id is pasted, /api/waitlist degrades cleanly: the form shows a
mailto: fallback instead of erroring.
2.3 Build + deploy
# From the repo root — full gate first:
npm run web:typecheck && npm --workspace reelforge-web run test && npm run web:build
cd apps/web
npm run cf:build # opennextjs-cloudflare build → .open-next/worker.js
npm run cf:deploy # deploy worker + assets + custom-domain routes, then
# IndexNow-pings every sitemap URL (Bing/Yandex/Seznam/
# Naver) via scripts/indexnow-ping.mjs — see §2.5a.
Optional local check of the built worker before deploying: npm run cf:preview.
2.4 Custom-domain DNS
routes in wrangler.jsonc declares menivor.com and www.menivor.com as
custom_domain: true. The zone must live in the same Cloudflare account
(account_id in wrangler.jsonc); on first deploy Cloudflare creates the
worker DNS records automatically. If the apex already has conflicting A/
CNAME records, delete them and redeploy. api.menivor.com is NOT part of
this worker — it points at the k8s ingress from the API path above.
2.5 Analytics & observability (no new vendors)
- Worker observability is already on (
wrangler.jsonc→observability,head_sampling_rate: 1): every request is logged — Cloudflare dash → Workers → menivor → Logs. - Waitlist signups are counted there too: the route logs a PII-free
structured event per stored signup — filter on
waitlist_signup(waitlist_signup_failedfor KV write failures). Raw entries live in theWAITLISTKV namespace keyedwaitlist:<email>. - Page analytics: Cloudflare Web Analytics is the one-click option — same
vendor, dashboard toggle on the
menivor.comcustom domain, zero code change. No client-side analytics vendor is (or should be) added to the app.
2.5a IndexNow (Bing/Yandex/Seznam/Naver)
apps/web/scripts/indexnow-ping.mjs reads the live sitemap and POSTs every
URL to https://api.indexnow.org/indexnow, keyed by the key file already
live at https://menivor.com/<key>.txt. It now runs automatically as the
last step of npm run cf:deploy (above), so every deploy that changes a
page or adds a new one gets submitted the same day instead of waiting on
organic re-crawl. Run it by hand any time with
node apps/web/scripts/indexnow-ping.mjs (--dry-run to just list URLs).
Bing Webmaster Tools itself is not registered for menivor.com (no
msvalidate.01 meta tag or DNS TXT token found, unlike Google's which is
DNS-verified) — that's an owner-only dashboard-login step, noted here, not
blocking IndexNow pings.
3. Order of operations for a cold start
- Phase 0 + 1 keys →
.env.reelforge→scripts/deploy-preflight.pyexits 0. - API live per
deploy-oneshot.md(migrate → tag → golden smoke) onapi.menivor.com, modeinternal_pilot. - Web: §2.1 env → §2.2 one-time setup → §2.3
cf:build+cf:deploy→ menivor.com serves; waitlist collects emails even while generation is pilot-gated. - Flip launch flags stage-by-stage per the table in
deploy-oneshot.md§5, re-running preflight after each flip (startup now enforces the same rules).