Skip to content

Open-source status page, incident response and uptime monitoring

add white label status page (#1695)

Thibault Le Ouay02b26ba04d0d
diff --git a/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx b/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx
index bcbac1d9f..294669ebd 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx
@@ -127,6 +127,8 @@ export function Client() {
if (!workspace) return null;
+ const addons = allPlans[workspace.plan].addons;
+
return (
<SectionGroup>
<Section>
@@ -178,18 +180,27 @@ export function Client() {
</FormCardHeader>
<div className="flex flex-col gap-2 pt-4">
{/* TODO: redirect to stripe product */}
- {allPlans[workspace.plan].addons["email-domain-protection"] ? (
+ {addons["email-domain-protection"] ? (
<BillingAddons
label="Magic Link (Auth)"
description="Only allow user with a given email domain to access the status page."
addon="email-domain-protection"
workspace={workspace}
/>
- ) : (
+ ) : null}
+ {addons["white-label"] ? (
+ <BillingAddons
+ label="White Label"
+ description="Remove the 'powered by openstatus.dev' footer from your status pages."
+ addon="white-label"
+ workspace={workspace}
+ />
+ ) : null}
+ {Object.keys(addons).length === 0 ? (
<EmptyStateContainer>
<EmptyStateTitle>No add-ons available</EmptyStateTitle>
</EmptyStateContainer>
- )}
+ ) : null}
</div>
</FormCardContent>
<FormCardFooter>
diff --git a/apps/dashboard/src/components/content/billing-addons.tsx b/apps/dashboard/src/components/content/billing-addons.tsx
index 5a0ef05bc..9f2d38a2f 100644
--- a/apps/dashboard/src/components/content/billing-addons.tsx
+++ b/apps/dashboard/src/components/content/billing-addons.tsx
@@ -23,11 +23,6 @@ import { Check } from "lucide-react";
import { useState, useTransition } from "react";
import { toast } from "sonner";
-const BASE_URL =
- process.env.NODE_ENV === "production"
- ? "https://app.openstatus.dev"
- : "http://localhost:3000";
-
type Workspace = RouterOutputs["workspace"]["get"];
interface BillingAddonsProps {
@@ -67,8 +62,6 @@ export function BillingAddons({
try {
const promise = checkoutSessionMutation.mutateAsync({
workspaceSlug: workspace.slug,
- successUrl: `${BASE_URL}/settings/billing?success=true`,
- cancelUrl: `${BASE_URL}/settings/billing`,
feature: addon,
remove: value,
});
diff --git a/apps/dashboard/src/data/plans.ts b/apps/dashboard/src/data/plans.ts
index 9c7f3b305..b06c4dc07 100644
--- a/apps/dashboard/src/data/plans.ts
+++ b/apps/dashboard/src/data/plans.ts
@@ -67,6 +67,10 @@ export const config: Record<
value: "custom-domain",
label: "Custom domain",
},
+ {
+ value: "white-label",
+ label: "White Label",
+ },
],
},
"status-page-audience": {
diff --git a/apps/status-page/src/components/nav/footer.tsx b/apps/status-page/src/components/nav/footer.tsx
index 1269c7846..4a2e8c06f 100644
--- a/apps/status-page/src/components/nav/footer.tsx
+++ b/apps/status-page/src/components/nav/footer.tsx
@@ -29,16 +29,18 @@ export function Footer(props: React.ComponentProps<"footer">) {
<footer {...props}>
<div className="mx-auto flex max-w-2xl items-center justify-between gap-4 px-3 py-2">
<div>
- <p className="font-mono text-muted-foreground text-xs leading-none sm:text-sm">
- powered by{" "}
- <Link
- href="https://openstatus.dev"
- target="_blank"
- rel="noreferrer"
- >
- openstatus.dev
- </Link>
- </p>
+ {!page.whiteLabel ? (
+ <p className="font-mono text-muted-foreground text-xs leading-none sm:text-sm">
+ powered by{" "}
+ <Link
+ href="https://openstatus.dev"
+ target="_blank"
+ rel="noreferrer"
+ >
+ openstatus.dev
+ </Link>
+ </p>
+ ) : null}
</div>
<div className="flex items-center gap-4">
<TimestampHoverCard
diff --git a/apps/web/next-env.d.ts b/apps/web/next-env.d.ts
index c4b7818fb..9edff1c7c 100644
--- a/apps/web/next-env.d.ts
+++ b/apps/web/next-env.d.ts
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
-import "./.next/dev/types/routes.d.ts";
+import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/web/src/content/pages/unrelated/pricing.mdx b/apps/web/src/content/pages/unrelated/pricing.mdx
index 55c7b952a..b56ac72e1 100644
--- a/apps/web/src/content/pages/unrelated/pricing.mdx
+++ b/apps/web/src/content/pages/unrelated/pricing.mdx
@@ -32,6 +32,7 @@ category: "Company"
["Toggle numbers visibility", "+", "+", "+"],
["Subscribers", "", "+", "+"],
["Custom domain", "", "+", "+"],
+ ["White Label", "", "add-on $300/mo.", "add-on $300/mo."],
[<strong>Audience</strong>, "", "", ""],
["Password Protection", "", "+", "+"],
["Email Authentification", "", "add-on $100/mo.", "add-on $100/mo."],
diff --git a/packages/api/src/router/statusPage.ts b/packages/api/src/router/statusPage.ts
index 8d3e6bc80..5a62f0349 100644
--- a/packages/api/src/router/statusPage.ts
+++ b/packages/api/src/router/statusPage.ts
@@ -102,6 +102,8 @@ export const statusPageRouter = createTRPCRouter({
if (!_page) return null;
+ const ws = selectWorkspaceSchema.safeParse(_page.workspace);
+
const configuration = pageConfigurationSchema.safeParse(
_page.configuration ?? {},
);
@@ -294,6 +296,8 @@ export const statusPageRouter = createTRPCRouter({
})
.sort((a, b) => a.order - b.order);
+ const whiteLabel = ws.data?.limits["white-label"] ?? false;
+
return selectPublicPageSchemaWithRelation.parse({
..._page,
monitors,
@@ -319,6 +323,7 @@ export const statusPageRouter = createTRPCRouter({
status,
lastEvents,
openEvents,
+ whiteLabel,
});
}),
diff --git a/packages/api/src/router/stripe/index.ts b/packages/api/src/router/stripe/index.ts
index d86cc9546..78b3b74d4 100644
--- a/packages/api/src/router/stripe/index.ts
+++ b/packages/api/src/router/stripe/index.ts
@@ -9,6 +9,7 @@ import {
workspacePlans,
} from "@openstatus/db/src/schema";
+import { addons } from "@openstatus/db/src/schema/plan/schema";
import { updateAddonInLimits } from "@openstatus/db/src/schema/plan/utils";
import { TRPCError } from "@trpc/server";
import type { Stripe } from "stripe";
@@ -174,9 +175,7 @@ export const stripeRouter = createTRPCRouter({
.input(
z.object({
workspaceSlug: z.string(),
- feature: z.enum(["email-domain-protection"]),
- successUrl: z.string().optional(),
- cancelUrl: z.string().optional(),
+ feature: z.enum(addons),
remove: z.boolean().optional(),
}),
)
diff --git a/packages/api/src/router/stripe/utils.ts b/packages/api/src/router/stripe/utils.ts
index eb5dd4227..af8380a8e 100644
--- a/packages/api/src/router/stripe/utils.ts
+++ b/packages/api/src/router/stripe/utils.ts
@@ -23,9 +23,7 @@ export const getPriceIdForPlan = (plan: WorkspacePlan) => {
return PLANS.find((p) => p.plan === plan)?.price.monthly.priceIds[env];
};
-export const getPriceIdForFeature = (
- feature: "email-domain-protection" | "status-pages-whitelabel",
-) => {
+export const getPriceIdForFeature = (feature: keyof Addons) => {
const env =
process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? "production" : "test";
return FEATURES.find((f) => f.feature === feature)?.price.monthly.priceIds[
@@ -75,6 +73,17 @@ export const FEATURES = [
},
},
},
+ {
+ feature: "white-label",
+ price: {
+ monthly: {
+ priceIds: {
+ test: "price_1SlbQsBXJcTfzsyJ1awtpOno",
+ production: "price_1SlbSdBXJcTfzsyJahJiFE8D",
+ },
+ },
+ },
+ },
] satisfies Array<{
feature: keyof Addons;
price: {
diff --git a/packages/db/src/schema/plan/config.ts b/packages/db/src/schema/plan/config.ts
index 770a0e816..02337d9ef 100644
--- a/packages/db/src/schema/plan/config.ts
+++ b/packages/db/src/schema/plan/config.ts
@@ -72,6 +72,13 @@ export const allPlans: Record<WorkspacePlan, PlanConfig> = {
INR: 10_000,
},
},
+ "white-label": {
+ price: {
+ USD: 300,
+ EUR: 300,
+ INR: 30_000,
+ },
+ },
},
limits: {
version: undefined,
@@ -122,6 +129,13 @@ export const allPlans: Record<WorkspacePlan, PlanConfig> = {
INR: 10_000,
},
},
+ "white-label": {
+ price: {
+ USD: 300,
+ EUR: 300,
+ INR: 30_000,
+ },
+ },
},
limits: {
version: undefined,
diff --git a/packages/db/src/schema/plan/schema.ts b/packages/db/src/schema/plan/schema.ts
index 583a4b4d3..11294b4fb 100644
--- a/packages/db/src/schema/plan/schema.ts
+++ b/packages/db/src/schema/plan/schema.ts
@@ -65,9 +65,10 @@ const priceSchema = z.object({
export type Price = z.infer<typeof priceSchema>;
-export const addons = ["email-domain-protection"] as const satisfies Partial<
- keyof Limits
->[];
+export const addons = [
+ "email-domain-protection",
+ "white-label",
+] as const satisfies Partial<keyof Limits>[];
export const addonsSchema = z.partialRecord(
z.enum(addons),
diff --git a/packages/db/src/schema/shared.ts b/packages/db/src/schema/shared.ts
index 035b42c44..43790ff84 100644
--- a/packages/db/src/schema/shared.ts
+++ b/packages/db/src/schema/shared.ts
@@ -152,6 +152,7 @@ export const selectPublicPageSchemaWithRelation = selectPageSchema.extend({
.nullable()
.prefault("free")
.transform((val) => val ?? "free"),
+ whiteLabel: z.boolean().prefault(false),
});
export const selectPublicStatusReportSchemaWithRelation =