Skip to content

Monetization + go-to-market: tiers/Stripe, SSRF guard, landing, funnel analytics, activation, waitlist - #3

Merged
Rebell-Leader merged 3 commits into
mainfrom
claude/elegant-knuth-aI7NB
Jul 2, 2026
Merged

Rebell-Leader merged 3 commits into
mainfrom
claude/elegant-knuth-aI7NB

Conversation

@Rebell-Leader

@Rebell-Leader Rebell-Leader commented Jun 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-up to #2. Turns the production-ready app into a sellable, launch-ready microSaaS, then adds the minimum to validate demand: billing/tiers + Stripe, an SSRF guard, the landing page + launch docs, and the founder validation unblockers (funnel analytics, activation/empty-state, waitlist, one-box deploy topology).

4 commits · suite green (697 tests, 7 live-e2e skipped) · ruff + mypy + bandit clean.

Billing & tiers (feat(billing))

Core invariant: billing never constrains self-hosters — no STRIPE_SECRET_KEY ⇒ everyone is unlimited and all checks are no-ops. With Stripe, no-subscription = Free tier.

Tier table in code (Free 5/2/fast · Pro $12 50/30/detailed · Power $24 200/∞/API), TIER_LIMITS_JSON-overridable. Enforcement rides the existing quota machinery (check_user_quota gates count + tier budget then meters a usage_events row; artifact quota in tailoring; API = Power feature, 402; clamp_model for Free). Stripe (optional [billing] extra, lazy): Checkout, customer portal, signature-verified webhook → subscriptions table. UI "Plan & usage" panel. Migration 9e4b7d21c803. 26 tests.

SSRF guard

utils/security.check_url_allowed: user-supplied URLs (posting ingestion, webhook endpoints) reject private/loopback/link-local/metadata targets at both server-side sinks. SSRF_ALLOW_PRIVATE_URLS=1 opt-out. 10 tests; residuals in docs/HARDENING.md.

Validation unblockers (feat(validation))

The minimum to put it in front of users and measure:

  • Funnel analytics — services/funnel.compute_funnel + worker/funnel_report.py (cron CLI): activation, the aha metric (≥3 analyses in a user's first week), free→paid, est MRR + COGS — all from existing tables, no third-party tool.
  • Activation — anonymous "See a sample verdict" preview on the auth screen (zero LLM cost) + first-run "Try a sample posting" one-click for new users, so time-to-first-verdict is seconds not a blank box.
  • Waitlist — WaitlistEntry + public POST /waitlist (CORS-scoped, rate-limited, dedupe-as-noop) + email form on the landing page. Migration b2f7c9d04a16.
  • Deploy topology — deploy/Caddyfile.fullstack (one box: landing / + app /app + API /api, auto-TLS) + a "Single-box validation deploy" guide.

Launch collateral

landing/ static site (+ Terms/Privacy templates); docs/STRIPE_SETUP.md (KYC, 12-step test-mode dry run, MoR alternatives); docs/HARDENING.md (threat model + priority order); docs/GTM.md (channels, funnel targets + 60-day gate, ≤$40/mo architecture).

Migrations

9e4b7d21c803 (billing) + b2f7c9d04a16 (waitlist) — CI runs up → down → up on Postgres; schema-drift guard asserts models match.

Test plan

  • python -m unittest discover -s tests → 697 pass (7 live-e2e skipped)
  • ruff check . / mypy / bandit -r . -ll → clean
  • Stripe lifecycle: 26 mocked tests + the documented 12-step dry run

https://claude.ai/code/session_01Vpu7T5ezA2RAJhfpPxBzQd

claude added 3 commits June 10, 2026 12:33
…ng page

MicroSaaS monetization layer on top of the existing quota/budget machinery.

Core invariant: billing NEVER constrains self-hosters — with no
STRIPE_SECRET_KEY every user is on the "unlimited" tier and all checks are
no-ops (the entire pre-existing suite passes unchanged). With Stripe
configured, no-subscription = Free tier.

- services/billing.py: tier table in code (Free 5 analyses/2 docs/fast model;
  Pro $12 50/30/detailed; Power $24 200/unlimited/API), env-overridable via
  TIER_LIMITS_JSON over a rolling TIER_WINDOW_DAYS window. get_tier reads the
  subscriptions row (mirrored from Stripe). check_and_record_analysis gates
  count + tier LLM budget then meters one usage_events row (metering is
  best-effort/fail-open; the check is fail-closed). check_artifact_quota
  counts existing application_artifacts. clamp_model downgrades detailed->fast
  for Free. Stripe (optional [billing] extra, lazy import): Checkout session,
  customer portal, signature-verified webhook mirroring
  (checkout.completed / subscription.updated / deleted) into subscriptions.
- db: subscriptions + usage_events tables (migration 9e4b7d21c803,
  up/down/up verified); billing.* audit kinds.
- Enforcement wiring: analysis_runner.check_user_quota (all entry points),
  tailoring.generate_* (artifact quota), api/auth.require_user (API = Power
  feature, 402), api/routes.post_analyze (clamp + 402 on tier limit).
- api/billing.py: POST /v1/billing/webhook (unauthenticated, signature-
  verified, 503 when unconfigured) + GET /v1/billing/plan.
- app.py: "Plan & usage" sidebar panel (usage meters, upgrade -> Checkout,
  manage -> customer portal), tier errors caught in analyze + artifact flows,
  model clamping with a friendly notice.
- landing/: self-contained static landing page (verdict-demo hero, no-
  fabrication guarantee, pricing mirroring the tier table) + deploy README.
- CI: subscriptions/usage_events in the Postgres table assertion. CLAUDE.md
  documents the billing invariant. uv.lock: + stripe.
- tests: 26 new (tier resolution incl. disabled=unlimited, TIER_LIMITS_JSON
  merge, analysis/artifact/budget quotas, clamp, webhook lifecycle, checkout,
  API 402 gate, webhook 503/400, tailoring integration).

Full suite green (673), ruff/mypy (80 files)/bandit clean.

https://claude.ai/code/session_01Vpu7T5ezA2RAJhfpPxBzQd
…docs; legal templates

Hardening (implemented):
- utils/security.check_url_allowed: SSRF policy for user-supplied URLs —
  http/https only; IP-literal or DNS-resolved private/loopback/link-local/
  reserved targets rejected (cloud metadata, localhost services, RFC-1918).
  Unresolvable hostnames pass (the fetch fails identically; the attack needs
  resolution to a private IP). SSRF_ALLOW_PRIVATE_URLS=1 opt-out for
  self-hosted/dev. Wired into the two user-controlled sinks:
  url_ingest.fetch_job_posting and webhooks.register_webhook. 10 new tests.
  DNS-rebinding/redirect residuals documented as planned work.

Launch collateral (docs):
- docs/STRIPE_SETUP.md: account registration + KYC (sole proprietor, SSN/EIN),
  dashboard config (products/prices, webhook events, customer portal), a
  12-step test-mode dry run, go-live checklist, and the Merchant-of-Record
  decision (Stripe vs Lemon Squeezy/Paddle) with a revisit-at-MRR rule.
- docs/HARDENING.md: threat-model inventory for the hosted multi-tenant
  deployment (prompt injection, SSRF, uploads, rendered output, tenant
  data/process isolation, abuse/cost) with shipped/partial/planned status and
  a priority order for launch.
- docs/GTM.md: positioning, zero-CAC channel plan, product-analytics design
  on existing tables (usage_events/subscriptions/llm_usage) + funnel targets
  with a 60-day decision gate, and a <=$40/mo single-box validation
  architecture mapped to existing repo pieces.
- landing/terms.html + landing/privacy.html: ToS + privacy-policy templates
  (marked for legal review; match the app's real data practices — export/
  delete, encrypted TOTP, no model training on user content).

Full suite green (683), ruff/mypy/bandit clean.

https://claude.ai/code/session_01Vpu7T5ezA2RAJhfpPxBzQd
… deploy topology

The minimum to put it in front of real users and measure demand — then stop
building and go sell.

Funnel analytics (decide with data, no third-party tool):
- services/funnel.compute_funnel: cross-user operator metrics from existing
  tables — signups, activation (signup->first analysis), the aha metric
  (>=3 analyses in a user's first week), engagement, free->paid, est MRR + COGS.
- worker/funnel_report.py: cron-friendly CLI (--days/--json). Read-only.

Activation / time-to-first-verdict:
- app.py: anonymous "See a sample verdict" preview on the auth screen (zero
  cost, no LLM call) so visitors grasp the value before signing up; and a
  first-run "Try a sample posting" one-click for new users (no saved apps yet)
  that pre-fills a realistic posting so the first verdict is seconds, not a
  blank textarea.

Waitlist (capture leads not ready to sign up):
- WaitlistEntry model + migration b2f7c9d04a16; services/waitlist (validate,
  normalise, rate-limit, dedupe-as-noop); public POST /waitlist (CORS scoped
  to LANDING_ORIGIN); email-capture form wired into landing/index.html.

Deploy topology (cheapest path to live):
- deploy/Caddyfile.fullstack: one box, landing at / + Streamlit at /app +
  API at /api, auto-TLS; deploy/README "Single-box validation deploy" +
  "Funnel report" sections.

CI: waitlist_entries in the Postgres table assertion. CLAUDE.md + .env.example
updated. uv.lock unchanged (no new deps). 14 new tests.

Full suite green (697), ruff/mypy(84 files)/bandit clean.

https://claude.ai/code/session_01Vpu7T5ezA2RAJhfpPxBzQd
@Rebell-Leader Rebell-Leader changed the title Monetization layer: tiers + Stripe, SSRF guard, landing page + launch docs Monetization + go-to-market: tiers/Stripe, SSRF guard, landing, funnel analytics, activation, waitlist Jun 10, 2026
@Rebell-Leader
Rebell-Leader merged commit 9862816 into main Jul 2, 2026
7 checks passed
@Rebell-Leader
Rebell-Leader deleted the claude/elegant-knuth-aI7NB branch October 19, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants