feat(revenue): Revenue page with RapidAPI subscriptions and Stripe metrics - #32
Merged
Conversation
…e metrics A per-project Revenue page with two independent panels, mirroring the Vercel Web Analytics integration pattern (specs/0013): - RapidAPI: subscriber counts for a provided API listing id via the GraphQL Platform API (per-hub endpoint), with active/paying counts and 30-day new/churn vs the prior 30 days. Plan-aware query falls back to the documented basic shape when the hub's schema lacks billingPlanVersion. - Stripe: active subscribers, estimated MRR, and 30-day new/churn for a mapped subscription product, plus purchase count and revenue for a mapped one-off product (paid Checkout Sessions). - Credentials are instance-level env secrets (STRIPE_SECRET_KEY, RAPIDAPI_KEY, RAPIDAPI_GRAPHQL_URL); the DB stores identifier mappings only. - No PII by construction: the RapidAPI query never requests subscriber names or emails (opaque entity ids only), and the Stripe client parses no customer fields. - MCP tools: get_rapidapi_subscriptions, get_stripe_revenue. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a per-project Revenue page (
/p/$projectId/revenue) with two independent panels, following the Vercel Web Analytics integration pattern (design record inspecs/0013-revenue-rapidapi-stripe.md):RapidAPI panel
api_…id (verified against the GraphQL Platform API on save — there is no usable "list my APIs" query).RAPIDAPI_GRAPHQL_URL+RAPIDAPI_KEY. The plan-aware query (billingPlanVersion { name price }) falls back to the documented basic shape if the hub's schema rejects it; "paying" shows as unknown rather than guessed.Stripe panel
/v1/products.active|trialing|past_due), estimated MRR (normalized across day/week/month/year intervals), 30-day new/churn vs prior 30.mode=paymentCheckout Sessions (last 30 vs prior 30).STRIPE_SECRET_KEY(restricted read key recommended: Products, Subscriptions, Checkout Sessions).No PII, by construction
The RapidAPI GraphQL query never requests
entity.name/entity.email— subscribers are opaque entity ids only. The Stripe client parses no customer fields (nocustomer,customer_details).Plumbing
rapidapi_connections/stripe_connections(identifier mappings only; secrets stay env-level) with SQLite + Postgres migrations and schema-parity coverage.get_rapidapi_subscriptions,get_stripe_revenue(read-only, no credits)..env.example, typing insrc/env.d.ts, AlchemydataEnvwiring.Testing
tsc --noEmit,oxlint, and Prettier clean.STRIPE_SECRET_KEY/RAPIDAPI_*secrets) — please verify against your accounts after setting the env vars.🤖 Generated with Claude Code