Repository navigation
feat(dashboard): add billing usage metrics - #4888
Merged
Merged
Conversation
Contributor
Vercel Deployment Info - dashboard
|
dbm03
force-pushed
the
feat/billing-metrics
branch
3 times, most recently
from
October 1, 2026 16:25
994290e to
52c1017
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 5, 2026 08:48
52c1017 to
3fb4066
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 20, 2026 09:07
05d6580 to
3b62d7c
Compare
This was referenced Oct 20, 2026
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 20, 2026 10:34
3b62d7c to
c7757a8
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 20, 2026 13:50
c7757a8 to
e224b62
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 20, 2026 13:59
e224b62 to
4238782
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 21, 2026 07:48
4238782 to
af8f6dc
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 21, 2026 13:23
af8f6dc to
3e8b23c
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
2 times, most recently
from
October 21, 2026 15:24
9416865 to
428419e
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 21, 2026 15:41
428419e to
2aab7b5
Compare
5 tasks done
dbm03
changed the base branch from
fix/metrics-chart-legend-tooltips
to
feat/stacked-bar-metric-chart
October 21, 2026 15:48
dbm03
added a commit
that referenced
this pull request
Oct 21, 2026
StackedBarMetricChart draws metric series as stacked bars and reuses the legend, pinned tooltip and drag-to-zoom hooks of MetricChart. The billing usage chart (#4888) is its first user. - The value axis counts in whole numbers with headroom above the tallest stack, and grows to show a reference line once the bars reach half of it (buildValueTicks, buildStackedValueTicks). - The shared tooltip gains a label formatter, a footer, an option to list rows top to bottom like the stacked bars, and a cap that sums the smallest rows into one "+N more" row, so the footer stays visible with many series. - The legend can render an addon next to each item, such as an info tooltip, kept apart from the chart's click, double-click and keyboard handlers. The stacked chart's legend lists items in the order of the bars instead of letting Recharts sort them by series key. - MetricTable column labels accept any React node. MetricChart renders and behaves as before. The dashboard notes mention the new chart.
dbm03
force-pushed
the
feat/billing-metrics
branch
2 times, most recently
from
October 22, 2026 09:08
b909a70 to
32243df
Compare
dbm03
marked this pull request as ready for review
October 22, 2026 10:33
dbm03
force-pushed
the
feat/billing-metrics
branch
2 times, most recently
from
October 22, 2026 10:41
7be7c30 to
78368cb
Compare
robertkasza
force-pushed
the
feat/billing-metrics
branch
from
October 27, 2026 14:21
78368cb to
41931bc
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
2 times, most recently
from
October 27, 2026 16:29
c076378 to
198d739
Compare
dbm03
force-pushed
the
feat/billing-metrics
branch
from
October 27, 2026 16:36
198d739 to
44b6c01
Compare
robertkasza
reviewed
Oct 29, 2026
dbm03
marked this pull request as draft
November 11, 2026 21:11
dbm03
force-pushed
the
feat/billing-metrics
branch
2 times, most recently
from
November 11, 2026 22:51
9c5cc3f to
cc12240
Compare
dbm03
marked this pull request as ready for review
November 11, 2026 23:02
dbm03
marked this pull request as draft
November 12, 2026 08:29
dbm03
force-pushed
the
feat/billing-metrics
branch
from
November 12, 2026 10:13
cc12240 to
50da661
Compare
dbm03
marked this pull request as ready for review
November 12, 2026 10:15
robertkasza
approved these changes
Nov 13, 2026
robertkasza
left a comment
Member
There was a problem hiding this comment.
LGTM, just had the one comment about the alert in the billing page. But I am fine if you want to leave it.
Administrators of paid organizations can now see what drives their bill before the invoice arrives. - Organization billing is split into Plan and Usage tabs, plus an Invoices button that opens the Stripe customer portal. Usage and Invoices are for paid organizations, and usage data for org admins. The active tab is kept in the URL. - The Usage tab charts the last 60 days of per-project usage (egress, function duration, compute) as stacked month-to-date bars with StackedBarMetricChart. It has a time range filter (billing cycle and rolling presets, an absolute range, drag-to-zoom and double-click to zoom out), summary cards and a table of the resources tracked now. - Deleted projects are labelled by a shortened ID with a tooltip, and more than five of them are grouped into one "Deleted projects" series. - Enterprise plans hide the included-usage lines and pricing hints. - "Update payment details" and Invoices share the customer portal logic through useCustomerPortal. - useSeriesVisibility ignores hidden series that are no longer in the chart, and shows every series when all of the remaining ones would be hidden, so a legend filter can't leave a chart empty after a range change. - The command palette finds the billing page by "usage" and "invoices". Checked with Biome, tsc and the billing, metrics and serverless functions tests.
dbm03
force-pushed
the
feat/billing-metrics
branch
from
November 20, 2026 07:59
50da661 to
555e4c7
Compare
dbm03
enabled stacked auto-merge (squash)
November 20, 2026 08:11
dbm03
disabled stacked auto-merge
November 20, 2026 08:11
dbm03
enabled stacked auto-merge (squash)
November 20, 2026 08:13
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.
Checklist
Goal
Give administrators of paid Nhost organizations visibility into what drives their bill before the invoice arrives. The existing billing page provides plan management and a cost estimate, but no per-project usage history or inventory of tracked billable resources. This adds a Usage page alongside Plan, plus an Invoices action opening the Stripe customer portal, while preserving the existing plan and payment-details flows.
Type: Enhancement
Changes
/orgs/[orgSlug]/billingremains the Plan page;/orgs/[orgSlug]/billing/usageshows Usage. Both use a shared frame with route navigation, an Invoices button, and independently scrolling content. Usage and Invoices are disabled for free organizations, and a direct visit to Usage on a free plan explains that an upgrade is required. The existing organization scope supplies loading and access protection.useCustomerPortalserves both Invoices and the existing payment-details action. It requests a portal URL for the current organization, retains the loading/success/error toasts, and navigates the current window if opening a new window is blocked.useBillingMetricsqueries reports from the last 96 days, newest first, alongsidebillingResourcesand dedicated-computebillingTimeBasedUsages. It gets the current cycle frombillingGetNextInvoice.PeriodEnd, subtracting one UTC calendar month for the start; without an invoice it falls back to the current UTC calendar month. Both queries are skipped for non-admins. The page handles restricted, error/retry, initial loading, and loaded states; refreshes keep existing data visible.usageRangestores current/previous-cycle or rolling 7/30/60-day presets;usageFrom/usageTostore absolute days. Browser time is the default, withusageTz=utcselecting UTC. A popover offers presets, a range calendar, and time-zone selection; date edits apply only on Apply. Invalid or expired URL ranges fall back to the current cycle. Dragging writes a clipped absolute range, but selections containing no retained reports leave the URL unchanged. Double-click widens the range within retained bounds. Daily versus Month to date is saved in browser storage; changing meter or view resets chart interaction state.billing-usageentry opens the new Usage route and matches usage, metrics, egress, function duration, and compute. The existing Billing entry also matches invoices.Flow
Key files
dashboard/src/pages/orgs/[orgSlug]/billing/(+43/-12; 2 routes) anddashboard/src/features/orgs/components/billing/layout/(+153; 4 files including tests) — Plan/Usage routing, shared frame, and Invoices action.dashboard/src/features/orgs/components/billing/BillingUsage/(+4,089; 111 files including tests) — data loading, charts, resources table, time-range controls, cycle/bucket arithmetic, and regression coverage.dashboard/src/features/orgs/components/billing/hooks/useCustomerPortal/andSubscriptionPlan/SubscriptionPlan.tsx(+52/-33; 3 files) — shared Stripe portal flow.dashboard/src/features/orgs/projects/common/metrics/(+198/-20; 12 files including tests) — legend visibility, stacked-chart padding, tooltip behavior, and formatting.dashboard/src/features/command-palette/{catalog.tsx,catalog.test.ts,tree.tsx}(+12/-1) — Usage route registration and search metadata.dashboard/src/utils/__generated__/graphql.ts(+66; generated) — billing operation types and hooks.