feat(revenue): plan price on RapidAPI snapshots with est. MRR tiles - #44
Merged
Conversation
RapidAPI marketplace subscriptions are recurring revenue, but the snapshots only stored subscriber counts, so nothing could be turned into dollars. Snapshots now take an optional monthly plan price (USD cents - RapidAPI bills in USD only), and the report derives est. gross MRR (paying x price) and est. net MRR after RapidAPI's flat 25% marketplace fee, both from the latest snapshot only. The panel gains a "Plan price $/mo" form field (prefilled from the latest snapshot since the price rarely changes, kept after logging), two MRR tiles with the working shown as hints, and a Plan price history column. formatMoney takes optional fraction digits so $5.99-style plan prices don't round to whole dollars. Additive nullable column on both SQLite and Postgres; migrations generated and applied locally. 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.
What
Makes RapidAPI subscriptions count as recurring revenue: snapshots now take an optional monthly plan price, and the panel derives estimated MRR from it.
plan_price_usd_minor(USD cents — RapidAPI bills in USD only) onrapidapi_snapshots, both SQLite and Postgres; additive migrations generated, no backfill needed.grossMrrUsdMinor= latest paying × latest price;netMrrUsdMinordeducts RapidAPI's flat 25% marketplace fee (RAPIDAPI_FEE_RATE), rounded to the cent. Both null when the latest snapshot lacks either input — an older snapshot's price is deliberately not carried forward.formatMoneynow takes optional fraction digits so $5.99-style prices don't render as $6; existing call sites are unchanged (default stays 0).Verification
RapidapiServicetests pass (4 new: gross/net math incl. cent rounding, missing-input cases, no price carry-forward)tsc --noEmitandoxlint --type-awareclean🤖 Generated with Claude Code