Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
Update content (#523)
Thibault Le Ouayf78269084a03
diff --git a/apps/web/src/app/status-page/[domain]/_components/actions.ts b/apps/web/src/app/status-page/[domain]/_components/actions.tsindex ead784bb5..2e0604bf1 100644--- a/apps/web/src/app/status-page/[domain]/_components/actions.ts+++ b/apps/web/src/app/status-page/[domain]/_components/actions.ts@@ -2,6 +2,7 @@import { z } from "zod";+import { trackAnalytics } from "@openstatus/analytics";import { and, eq } from "@openstatus/db";import { db } from "@openstatus/db/src/db";import { page, pageSubscriber } from "@openstatus/db/src/schema";@@ -64,7 +65,7 @@ export async function handleSubscribe(formData: FormData) {}),from: "OpenStatus <[email protected]>",to: [validatedFields.data.email],- subject: "Verify your subscription",+ subject: "Verify your subscription to " + pageData.title,});await db@@ -76,4 +77,9 @@ export async function handleSubscribe(formData: FormData) {expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7),}).execute();++ await trackAnalytics({+ event: "Subscribe to Status Page",+ slug: pageData.slug,+ });}diff --git a/apps/web/src/app/status-page/[domain]/subscribe/route.ts b/apps/web/src/app/status-page/[domain]/subscribe/route.tsnew file mode 100644index 000000000..93d8bcfd9--- /dev/null+++ b/apps/web/src/app/status-page/[domain]/subscribe/route.ts@@ -0,0 +1,62 @@+import { z } from "zod";++import { and, eq } from "@openstatus/db";+import { db } from "@openstatus/db/src/db";+import { page, pageSubscriber } from "@openstatus/db/src/schema";+import { sendEmail, SubscribeEmail } from "@openstatus/emails";++export async function POST(+ req: Request,+ { params }: { params: { domain: string } },+) {+ //+ const data = await req.json();+ const result = z.object({ email: z.string().email() }).parse(data);++ const pageData = await db+ .select()+ .from(page)+ .where(eq(page.slug, params.domain))+ .get();+ if (!pageData) {+ return new Response("Not found", { status: 401 });+ }++ const alreadySubscribed = await db+ .select()+ .from(pageSubscriber)+ .where(+ and(+ eq(pageSubscriber.email, data.email),+ eq(pageSubscriber.pageId, pageData?.id),+ ),+ )+ .get();++ if (alreadySubscribed) {+ return new Response("Not found", { status: 401 });+ }++ const token = (Math.random() + 1).toString(36).substring(10);++ await sendEmail({+ react: SubscribeEmail({+ domain: params.domain,+ token: token,+ page: pageData.title,+ }),+ from: "OpenStatus <[email protected]>",+ to: [result.email],+ subject: "Verify your subscription to " + pageData.title,+ });+ await db+ .insert(pageSubscriber)+ .values({+ pageId: pageData.id,+ email: result.email,+ token,+ expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7),+ })+ .execute();+ return Response.json({ message: "Hello world" });+}diff --git a/apps/web/src/components/marketing/faqs.tsx b/apps/web/src/components/marketing/faqs.tsxindex 44c3434f4..0aac1c3fb 100644--- a/apps/web/src/components/marketing/faqs.tsx+++ b/apps/web/src/components/marketing/faqs.tsx@@ -13,7 +13,7 @@ const faqsConfig: Record<"q" | "a", string>[] = [},{q: "Who are we?",- a: "We are <a href='https://twitter.com/thibaultleouay' target='_blank'>Thibault</a> and <a href='https://twitter.com/mxkaske' target='_blank'>Max</a>. We both have a 9-to-5 job and we are doing that project for the purpose of open source and the community. Of course, it would be nice to make that project self sustainable. It's not a sprint, it's a marathon.",+ a: "We are <a href='https://twitter.com/thibaultleouay' target='_blank'>Thibault</a> and <a href='https://twitter.com/mxkaske' target='_blank'>Max</a>.",},{q: "How does it work?",diff --git a/apps/web/src/components/marketing/hero.tsx b/apps/web/src/components/marketing/hero.tsxindex bb03de51a..d59a09ba0 100644--- a/apps/web/src/components/marketing/hero.tsx+++ b/apps/web/src/components/marketing/hero.tsx@@ -12,20 +12,21 @@ export function Hero() {return (<Shell className="text-center"><Link- href="https://twitter.com/mxkaske/status/1685666982786404352?s=20"+ href="https://github.com/openstatusHQ/openstatus/stargazers"target="_blank"rel="noreferrer"><Badge variant="outline">- Announcement Post <ChevronRight className="ml-1 h-3 w-3" />+ Proudly Open Source - Support us on GitHub+ <ChevronRight className="ml-1 h-3 w-3" /></Badge></Link><h1 className="text-foreground font-cal mb-6 mt-2 text-3xl">- Open-source monitoring service+ A better way to monitor your services.</h1><p className="text-muted-foreground mx-auto mb-6 max-w-lg text-lg">- OpenStatus is an open-source monitoring service with incident- management.+ Reduce alert fatigue by triggering only relevant alerts when your+ services experience downtime.</p>{/* much better than using flex without text alignment, text stays center even thought not same length */}<div className="my-4 grid gap-2 sm:grid-cols-2">diff --git a/packages/analytics/src/type.ts b/packages/analytics/src/type.tsindex 908b9ebf4..92bb2813f 100644--- a/packages/analytics/src/type.ts+++ b/packages/analytics/src/type.ts@@ -16,4 +16,5 @@ export type AnalyticsEvents =| { event: "User Upgraded"; email: string }| { event: "User Signed In" }| { event: "User Vercel Beta" }- | { event: "Notification Created"; provider: string };+ | { event: "Notification Created"; provider: string }+ | { event: "Subscribe to Status Page"; slug: string };diff --git a/packages/emails/emails/subscribe.tsx b/packages/emails/emails/subscribe.tsxindex 4e4a55957..916876e22 100644--- a/packages/emails/emails/subscribe.tsx+++ b/packages/emails/emails/subscribe.tsx@@ -15,7 +15,7 @@ const SubscribeEmail = ({<title>Confirm your subscription to {page} Status Page</title><Preview>Confirm your subscription to {page} Status Page</Preview><Body>- <h1>Confirm your subscription to {page} Status Page</h1>+ <p>Confirm your subscription to {page} Status Page</p><p>You are receiving this email because you subscribed to receiveupdates from {page} Status Page.@@ -30,8 +30,7 @@ const SubscribeEmail = ({</a></p><br />- <br />- π Powered by+ π Powered by{" "}<Link href="https://www.openstatus.dev">OpenStatus.dev</Link></Body></Head>