---
title: "SaaS Metrics & MRR Dashboard Template for Next.js"
description: "Self-hosted Next.js SaaS metrics dashboard template with Stripe MRR, ARR, and revenue per visitor. $59 once. You host it. Open the live demo."
canonical: https://datalighthouse.dev/saas-metrics-dashboard-template
---

# SaaS metrics dashboard template (Next.js + Stripe MRR)
Self-hosted Next.js SaaS metrics dashboard template with Stripe MRR, ARR, and revenue per visitor. $59 once. You host it. Open the live demo.
Data Lighthouse is a self-hosted Next.js template for a SaaS metrics dashboard. The signed-in overview reads optional Stripe revenue next to traffic from your own app. Monthly recurring revenue is active subscriptions normalized to one month. Annual recurring revenue is that MRR multiplied by 12. The license is $59 once. You host the source. Buying the template uses Polar, not Stripe.

## What the overview shows

These are the cards on the signed-in overview. Revenue numbers come from the Stripe account whose secret key you set on your deployment. Traffic numbers come from the tracking component in your Next.js app. The public demo uses a seeded sample for both series and labels that sample in the chart subtitle. It does not call Stripe.

| Card | What it is |
| --- | --- |
| Revenue (7, 14, or 30 days) | Sum of succeeded Stripe charges in the window, in the dashboard currency, compared with the previous window of the same length. amount_refunded is not subtracted. |
| Average daily revenue | That revenue total divided by the number of days in the range. |
| Monthly recurring revenue | Active subscriptions normalized to one month. Trialing subscriptions are not in the list. The card does not show a percent change, because the route does not store a starting snapshot. |
| Annual recurring revenue | The rounded MRR multiplied by 12. |
| Revenue per visitor | Period revenue divided by distinct Postgres visitors for the same dates. Without Postgres the card asks you to connect the database. |
| Visitor conversion rate | Shown after Postgres customer tables are configured. Otherwise the card says Configure Drizzle. |
| Visitors online | Live count from the template session tracker, not from Stripe. |

The chart is titled Revenue vs. visitors. Revenue bars are daily succeeded charges. The visitor line is distinct visitors from Postgres for those days. Referrer and country tables use tracked sessions. A realtime page shows a world map. None of those traffic views are subscription metrics.

Churn, average revenue per user, and customer lifetime value are not overview cards. The revenue route does not keep the starting snapshot those rates need, and it does not divide MRR by paying customers. You can run those formulas in the browser on the [SaaS metrics calculator](https://datalighthouse.dev/tools/saas-metrics-calculator), which takes plans and churn inputs you type. Logo churn there is logos lost divided by logos at the start. Revenue churn is churned MRR divided by starting MRR. Simple LTV is ARPU divided by the logo-churn fraction, and it is undefined when logo churn is zero. That calculator is not the dashboard, and it does not call Stripe. The glossary defines [churn rate](https://datalighthouse.dev/glossary/churn-rate), [ARPU](https://datalighthouse.dev/glossary/average-revenue-per-user), and [LTV](https://datalighthouse.dev/glossary/customer-lifetime-value) the same way: formulas you can compute yourself, not cards this template fills in.

Revenue per visitor is on the overview. It is succeeded charges divided by distinct visitor_id values on dl_user_sessions whose first_seen falls in the window, for site id default unless the request passes another siteId. It is not MRR divided by visitors. Visitor conversion rate, once Postgres customer tables are connected, is the higher of distinct checkout_completed users and distinct customers with status paid, divided by distinct signed_in users in the window. Paid customers are rows in the template customers table, not the subscriber count in the connected Stripe account. The rate is not divided by anonymous visitors.

## How MRR is computed from Stripe

Stripe does not return an MRR field on the Subscription object. The signed-in page calls GET /api/datalighthouse/revenue?days=7, 14, or 30. That route requires a Clerk session. It lists subscriptions with status active through Stripe auto-pagination, so trialing, past_due, canceled, unpaid, incomplete, and paused subscriptions are not requested. The loader stops with a warning in the server log if a list reaches 100,000 records. The [Next.js Stripe analytics dashboard](https://datalighthouse.dev/nextjs-stripe-analytics-dashboard) page is the integration write-up for that key and that route. This section is the normalization the MRR card uses.

For each subscription item the route reads price.unit_amount (or unit_amount_decimal), price.currency, price.recurring.interval, price.recurring.interval_count, and quantity. A missing quantity is treated as 1. Minor units follow the currency: zero-decimal currencies such as JPY are not divided by 100, BHD, JOD, KWD, OMR, and TND are divided by 1000, and other currencies are divided by 100. Prices with no unit_amount, such as many tiered or metered prices, are skipped. The route does not read price.transform_quantity. The factors below are a run-rate convention. Stripe does not store them.

| Stripe interval | Monthly amount |
| --- | --- |
| Month, interval_count n | (unit amount × quantity) / n |
| Year, interval_count n | (unit amount × quantity) / (12 × n) |
| Week, interval_count n | (unit amount × quantity) × 52 / 12 / n |
| Day, interval_count n | (unit amount × quantity) × 365 / 12 / n |
| Quarter | Not a Stripe interval. A quarter is month with interval_count 3, so the amount is divided by 3. |

A $120 price billed every year is $10 of MRR. The same $120 billed every two years is interval year with interval_count 2, so it is divided by 24. A $90 price every three months is $30 of MRR. A $10 price every week contributes 10 × 52 / 12. Using 4, or using 30 days as a month, is a different convention, and this template does not use it.

Annual plans stay in MRR as one twelfth of the yearly price (and one twelfth again when interval_count is 2). They are not added as the full prepayment. Cash collected in the revenue card is a different number: it sums charge.amount for status succeeded in the selected window and can include a yearly charge on the day it succeeds. That cash total is not MRR, and it does not subtract amount_refunded.

Trials. The list filter is status active, so a subscription Stripe still marks trialing is excluded until it becomes active. The route does not read trial_end, and it does not prorate a remaining trial. A subscription that has finished its trial and is active is counted at the normalized price.

past_due and canceled. past_due is a Stripe status in which the latest invoice failed and Stripe can keep retrying. This template leaves past_due out. That is a policy choice, not a field Stripe calculates for you. Canceled subscriptions are not in the active list. cancel_at_period_end does not by itself change the status to canceled. Stripe keeps those subscriptions active until the current period ends, so they stay in this MRR until the status changes. The route does not read cancel_at_period_end or pause_collection. An active subscription with collection paused is still active, and this route will include its price.

Coupons. Item discounts are applied to that item, then subscription discounts are applied to the subscription total. A percent-off coupon multiplies the amount. Two percent-off coupons multiply in sequence. They are not added into one percentage. An amount-off coupon is in minor units for that billing period and is then normalized with the same interval factor: the item interval for an item coupon, or the first priced item interval for a subscription-level amount-off. Duration forever always applies. Duration repeating applies while the discount end is null or still in the future. Duration once does not change MRR, because it does not recur. The loader expands discount coupons and retrieves a coupon when the payload only contains an id. A coupon that lives only on the Stripe Customer is not applied. A failed coupon retrieve is skipped and logged.

Currency. The first priced active item chooses the dashboard currency. Later items in any other currency are skipped, a warning is logged, and nothing is converted. Charge totals use that same currency when it is known. There is no FX table in this template. If you need a separate total per currency from a file, use the [Stripe MRR CSV calculator](https://datalighthouse.dev/tools/stripe-mrr-csv-calculator). That tool does not upload the file and does not replace the overview.

Worked example. Every figure here is hypothetical. It is not the public demo and not a customer account. Four active USD prices, no coupons: $49 every month, $120 every year, $90 every 3 months, and $10 every week. In minor units that is 4900, 12000/12, 9000/3, and 1000 × 52/12. The route sums those minor units and rounds once to cents: $132.33 of MRR. ARR is that rounded MRR times 12, which is $1,587.96. A forever 10 percent coupon on the $49 price changes the same book to $127.43 of MRR. The same 10 percent with duration once leaves the $49 price at $49. A forever $20 amount-off on the $120 yearly price is ($120 − $20) / 12, which is $8.33 of MRR and $99.96 of ARR for that subscription alone. A trialing $49 subscription adds nothing. A past_due subscription adds nothing. A EUR price beside the USD prices is skipped.

The same interval factors, including quantity and coupon duration, are written out as TypeScript in [How to calculate MRR from the Stripe API](https://datalighthouse.dev/guides/calculate-mrr-from-stripe-api). The definition, with a separate hypothetical book, is the [monthly recurring revenue](https://datalighthouse.dev/glossary/monthly-recurring-revenue) glossary entry. ARR on this template is always normalized MRR times 12, which the [annual recurring revenue](https://datalighthouse.dev/glossary/annual-recurring-revenue) glossary entry describes.

## Stack and architecture

The template is a Next.js 16 App Router project in TypeScript and React 19. The dashboard UI uses shadcn/ui (new-york) and Tailwind. The overview chart is titled Revenue vs. visitors. It is an SVG in the overview component: bars for daily succeeded charges and a line for visitors, with 7, 14, and 30 day ranges. It is not a Recharts composed chart. The realtime traffic card is a Recharts area chart. The location view is a zoomable SVG map from react-simple-maps. The shared feature list calls that view a 3D globe. The component in this repository is the SVG map, not a separate WebGL globe package. Sign-in is Clerk. The revenue route calls currentUser() and returns 401 without a session.

Persistence is Postgres through Drizzle ORM and the postgres driver. getDb() reads POSTGRES_URL, then DATABASE_URL, and sets prepare: false so a transaction pooler works. A Supabase Postgres URL, including the transaction pooler, is a valid DATABASE_URL. The repository does not depend on supabase-js, and it does not use Supabase Auth. The Drizzle schema defines dl_user_sessions, customers, customer_journey_events, and blog_posts. Each table calls enableRLS(). There are no anon or authenticated policies. Server code uses the connection string, which bypasses row level security. Visitors for the revenue-per-visitor card come from dl_user_sessions. Conversion counts come from customers and customer_journey_events.

- TrackingComponent in the root layout records sessions. Visitors online, referrers, and countries come from that tracker.
- GET /api/datalighthouse/revenue reads STRIPE_SECRET_KEY on the app you deploy. If the key is missing, the API returns an error and the overview says it could not load Stripe revenue. Traffic cards still use the tracker.
- The Stripe Node SDK lists succeeded charges for the window and the previous window, and lists active subscriptions. MRR does not change when you switch 7D, 14D, and 30D. The revenue and visitor cards do.
- Checkout on this site is Polar, after GitHub sign-in, so the buyer can be invited to the private repository. Stripe is not the processor for the $59 license.
- This repository has no Dockerfile and no ClickHouse service. Hosting, Postgres, and Clerk are a separate bill from the license.

Public setup steps, including the tracking component snippet, are on the [quickstart](https://datalighthouse.dev/quickstart). Deeper notes ship in the private repository after purchase. The signed-in guide at /docs is not a public URL.

## Who it is for

It is for a Next.js team that already sells subscriptions in Stripe and wants MRR, ARR, and cash collected in the same dashboard as its own pageviews, in source it deploys. It is also for a founder who wants to read the normalization: which statuses count, how a yearly price becomes a month, and what a coupon does to the run-rate.

It is a poor fit when the job is a hosted analytics subscription, a ClickHouse events cluster, or a Docker Compose analytics server. It is a poor fit when the overview must show logo churn, revenue churn, or LTV. Those need a starting snapshot this route does not keep. It is a poor fit when you need one MRR figure that converts several currencies. The dashboard keeps a single currency and skips the rest. It is a poor fit when metered usage, with no unit_amount on the price, is the revenue you need to report. Those prices are skipped rather than priced from usage.

If you only want to check a subscriptions export before you decide, the CSV calculator and the SaaS metrics calculator run in the browser. If you want to implement the list call yourself, the API guide is the walkthrough. This page is the decision page for buying the dashboard that already does the overview.

## Build versus buy

After the source is in your app, the quickstart describes three steps: add the tracking component, optionally set the Stripe key, and open the dashboard. The quickstart says most teams are live in under 5 minutes once that source is in the app. That sentence is about wiring the included component. It is not a measured time for writing a Stripe normalizer from scratch.

Building the MRR card yourself means listing subscriptions with auto-pagination, deciding which statuses count, normalizing day, week, month, and year by interval_count, applying percent-off and amount-off coupons by duration, skipping empty unit amounts, and refusing to add a second currency. Joining that number to visitors means a session table and a date window that matches the charge query. An estimate for an engineer who already knows the Stripe Node SDK and the Next.js App Router is several days for a first MRR card, and longer once coupons, interval_count, and mixed currencies are handled the way this template handles them. That is an estimate. This site does not publish a measured build time.

The public [guide to building a self-hosted Next.js analytics dashboard](https://datalighthouse.dev/guides/build-self-hosted-nextjs-analytics-dashboard) walks through pageview ingest, a Drizzle session table, a chart, and Clerk on the read API. It does not claim a duration, and it does not replace the Stripe revenue route. Buy the template when you want that route, the overview cards, and the realtime map in source you host. Build it when you want a smaller tracker and you will write billing yourself. The longer evaluation, with hosted tools and a worked cost example, is [build vs buy a SaaS metrics dashboard](https://datalighthouse.dev/guides/build-vs-buy-saas-metrics-dashboard). If you already pay Baremetrics or ChartMogul and want a self-hosted Stripe MRR screen, the [Baremetrics and ChartMogul alternatives](https://datalighthouse.dev/alternatives/baremetrics-chartmogul-alternatives) page is the comparison.

## What you get for $59

The license is one payment of $59. The [pricing page](https://datalighthouse.dev/pricing) also shows $99 as a compare-at price. You get the Next.js and TypeScript source, the realtime visitor map and traffic view, the Stripe revenue dashboard described on this page, the Supabase-compatible Postgres setup through Drizzle, automated GitHub repository invites after checkout, lifetime updates, developer documentation, and use in unlimited projects. You still pay for hosting, the database, and Clerk.

Open the [live demo](https://datalighthouse.dev/demo) before you pay. It renders the overview with sample data and does not call Stripe, Clerk, Polar, or Postgres. Checkout is the buy button on this page. GitHub sign-in happens before Polar payment. The refund is 7 days, no questions, requested through the purchase contact on the [contact page](https://datalighthouse.dev/contact).

Read the integration details on the Next.js Stripe analytics dashboard page, the Drizzle and shadcn setup on the Supabase template page, and the source comparison on the best-templates page. The links under the buy button go to the quickstart, both calculators, the API guide, and the MRR glossary.

## FAQ
### What is the SaaS metrics dashboard template?

Data Lighthouse is a self-hosted Next.js and TypeScript template. The signed-in overview shows Stripe revenue, average daily revenue, monthly recurring revenue, annual recurring revenue, and revenue per visitor beside first-party traffic. The license is $59 once. You deploy the source yourself. Checkout for that license uses Polar, not Stripe.

### Which metrics does the overview show, and which does it leave out?

The overview cards are revenue for 7, 14, or 30 days, average daily revenue, monthly recurring revenue, annual recurring revenue, revenue per visitor, visitor conversion rate, and visitors online. The overview does not compute churn, average revenue per user, or customer lifetime value. Those three are on the browser SaaS metrics calculator, which uses numbers you type. They are not Stripe cards.

### How is MRR calculated from Stripe yearly, quarterly, and weekly plans?

Stripe does not return an MRR field. The revenue route lists subscriptions with status active and normalizes each priced item to one month. A month is divided by interval_count. A year is divided by 12 times interval_count. A week is multiplied by 52/12 and then divided by interval_count. A day is multiplied by 365/12 and then divided by interval_count. A quarterly price is a month interval with interval_count 3, so it is divided by 3. Quantity multiplies the unit amount. ARR is that rounded MRR multiplied by 12.

### Are trials, past_due subscriptions, canceled subscriptions, and coupons included?

Trialing, past_due, canceled, unpaid, incomplete, and paused subscriptions are not in the MRR list, because the route requests status active. A subscription set to cancel at period end stays active in Stripe until the period ends, so it stays in the total until the status changes. Forever coupons apply. Repeating coupons apply while the discount end is empty or still in the future. A coupon with duration once does not change MRR. Coupons that live only on the Stripe Customer are not applied.

### Does the dashboard convert multiple currencies into one MRR number?

No. The route assumes one currency, the currency of the first priced active subscription item. Later items in another currency are left out of the sum and are not converted. There is no exchange rate in this template. The Stripe MRR CSV calculator is separate: it prints one total per currency and still does not convert.

### How is this page different from the Next.js Stripe analytics dashboard page?

This page is the SaaS-metrics use case: which overview numbers are MRR and ARR, how a subscription is normalized to one month, and what is not on the dashboard. The Next.js Stripe analytics dashboard page is the integration page: STRIPE_SECRET_KEY, the signed-in revenue route, and how charges and visitors are joined. Both describe the same $59 template.

### What does the $59 license include, and does the live demo call Stripe?

One-time purchase of the source, with lifetime updates and use in unlimited projects. Hosting, Postgres, and Clerk are a separate bill. The public demo renders sample data and does not call Stripe, Clerk, Polar, or the database. The refund is 7 days, no questions, requested through the purchase contact on the contact page.
