Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
Add click-to-play YouTube embeds with lazy-loaded thumbnails (#3022)
Maximilian Kaske8a525d8acc74
diff --git a/apps/web/src/content/convert.test.ts b/apps/web/src/content/convert.test.tsindex 410b77339..f142c42f4 100644--- a/apps/web/src/content/convert.test.ts+++ b/apps/web/src/content/convert.test.ts@@ -16,6 +16,29 @@ describe("convertMdxToMarkdown", () => {expect(markdown).toContain("Answer.");});+ test("turns ShowcaseYouTube into links, unwrapping a Grid of videos", () => {+ const markdown = convertMdxToMarkdown({+ metadata: { title: "t" },+ content: [+ '<ShowcaseYouTube href="https://www.youtube.com/watch?v=a" title="One" />',+ "",+ '<Grid cols={2} variant="borderless">',+ '<ShowcaseYouTube href="https://www.youtube.com/watch?v=b" title="Two" />',+ '<ShowcaseYouTube href="https://www.youtube.com/watch?v=c" />',+ "</Grid>",+ ].join("\n"),+ slug: "t",+ href: "/t",+ } as Parameters<typeof convertMdxToMarkdown>[0]);+ expect(markdown).toContain("- [One](https://www.youtube.com/watch?v=a)");+ expect(markdown).toContain("- [Two](https://www.youtube.com/watch?v=b)");+ expect(markdown).toContain(+ "- [YouTube video](https://www.youtube.com/watch?v=c)",+ );+ expect(markdown).not.toContain("ShowcaseYouTube");+ expect(markdown).not.toContain("<Grid");+ });+test("frontmatter carries an absolute url, ISO dates and escaped quotes", () => {const markdown = convertMdxToMarkdown({metadata: {diff --git a/apps/web/src/content/convert.ts b/apps/web/src/content/convert.tsindex efb116ddf..ff342badc 100644--- a/apps/web/src/content/convert.ts+++ b/apps/web/src/content/convert.ts@@ -99,16 +99,15 @@ export function convertMdxToMarkdown(data: MDXData): string {},);- // Step 8: Convert <ShowcaseYouTube entries={[...]}> to a list of links- markdown = markdown.replace(/<ShowcaseYouTube\b[\s\S]*?\/>/g, (match) => {- const items: string[] = [];- for (const entry of match.matchAll(/\{[^{}]*href:[^{}]*\}/g)) {- const href = entry[0].match(/href:\s*['"]([^'"]+)['"]/)?.[1];- const title = entry[0].match(/title:\s*['"]([^'"]+)['"]/)?.[1];- if (href) items.push(`- [${title ?? "YouTube video"}](${href})`);- }- return items.join("\n");- });+ // Step 8: Convert <ShowcaseYouTube href="…" title="…" /> to a link list item+ markdown = markdown.replace(+ /<ShowcaseYouTube\b([^>]*?)\/>/g,+ (_match, attrs: string) => {+ const href = attrs.match(/href=["']([^"']+)["']/)?.[1];+ const title = attrs.match(/title=["']([^"']+)["']/)?.[1];+ return href ? `- [${title ?? "YouTube video"}](${href})` : "";+ },+ );// Step 9: Convert card components (unwrap grid, then serialize each card)markdown = markdown.replace(diff --git a/apps/web/src/content/mdx-components/youtube-facade.tsx b/apps/web/src/content/mdx-components/youtube-facade.tsxnew file mode 100644index 000000000..1bf5e984c--- /dev/null+++ b/apps/web/src/content/mdx-components/youtube-facade.tsx@@ -0,0 +1,55 @@+"use client";++import { Play } from "lucide-react";+import { useState } from "react";++/**+ * Click-to-play YouTube embed: shows the thumbnail until the visitor asks for+ * the video, so the ~0.5 MB player only loads on demand.+ */+export function YouTubeFacade({+ embedUrl,+ thumbnailUrl,+ title,+}: {+ embedUrl: string;+ thumbnailUrl: string;+ title: string;+}) {+ const [playing, setPlaying] = useState(false);++ if (playing) {+ return (+ <iframe+ src={`${embedUrl}?autoplay=1`}+ title={title}+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"+ allowFullScreen+ className="absolute inset-0 h-full w-full"+ />+ );+ }++ return (+ <button+ type="button"+ onClick={() => setPlaying(true)}+ aria-label={`Play video: ${title}`}+ className="group absolute inset-0 h-full w-full cursor-pointer"+ >+ {/* plain <img>: remote thumbnail, avoids a next/image remotePatterns change */}+ <img+ src={thumbnailUrl}+ alt={title}+ loading="lazy"+ decoding="async"+ className="absolute inset-0 h-full w-full object-cover transition-transform duration-300 group-hover:scale-105 motion-reduce:transition-none motion-reduce:group-hover:scale-100"+ />+ <span className="absolute inset-0 flex items-center justify-center">+ <span className="bg-background/90 text-foreground border-border group-hover:bg-background group-focus-visible:ring-ring flex size-14 items-center justify-center rounded-full border shadow-sm transition-colors group-focus-visible:ring-2">+ <Play className="ml-0.5 size-6 fill-current" aria-hidden />+ </span>+ </span>+ </button>+ );+}diff --git a/apps/web/src/content/mdx-components/youtube.tsx b/apps/web/src/content/mdx-components/youtube.tsxindex 13a21dd57..3065d7651 100644--- a/apps/web/src/content/mdx-components/youtube.tsx+++ b/apps/web/src/content/mdx-components/youtube.tsx@@ -1,38 +1,52 @@-function toEmbedUrl(href: string): string {+import { YouTubeFacade } from "./youtube-facade";++/** Extracts the video id from a watch, youtu.be or embed URL. */+function idOf(href: string): string | null {try {const url = new URL(href);- if (url.pathname.startsWith("/embed/")) return href;- const id =+ if (url.pathname.startsWith("/embed/")) {+ return url.pathname.slice("/embed/".length).split("/")[0] || null;+ }+ return (url.searchParams.get("v") ??- (url.hostname === "youtu.be" ? url.pathname.slice(1) : null);- return id ? `https://www.youtube.com/embed/${id}` : href;+ (url.hostname === "youtu.be" ? url.pathname.slice(1) || null : null)+ );} catch {- return href;+ return null;}}+function toEmbedUrl(href: string): string {+ const id = idOf(href);+ return id ? `https://www.youtube-nocookie.com/embed/${id}` : href;+}+export function ShowcaseYouTube({- entries,+ href,+ title = "YouTube video",}: {- entries: { href: string; title?: string }[];+ href: string;+ title?: string;}) {+ const id = idOf(href);return (- <div className="my-4 grid gap-4 sm:grid-cols-2">- {entries.map((entry, i) => (- <div- key={`${entry.href}-${i}`}- className="border-border relative aspect-video w-full overflow-hidden border"- >- <iframe- src={toEmbedUrl(entry.href)}- title={entry.title ?? "YouTube video"}- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"- loading="lazy"- allowFullScreen- className="absolute inset-0 h-full w-full"- />- </div>- ))}+ <div className="border-border relative my-4 aspect-video w-full overflow-hidden border [.grid>&]:my-0">+ {id ? (+ <YouTubeFacade+ embedUrl={toEmbedUrl(href)}+ thumbnailUrl={`https://i.ytimg.com/vi/${id}/hqdefault.jpg`}+ title={title}+ />+ ) : (+ <iframe+ src={href}+ title={title}+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"+ loading="lazy"+ allowFullScreen+ className="absolute inset-0 h-full w-full"+ />+ )}</div>);}diff --git a/apps/web/src/content/pages/docs/guides/how-to-configure-status-page.mdx b/apps/web/src/content/pages/docs/guides/how-to-configure-status-page.mdxindex deafeabd2..eff0f5cbe 100644--- a/apps/web/src/content/pages/docs/guides/how-to-configure-status-page.mdx+++ b/apps/web/src/content/pages/docs/guides/how-to-configure-status-page.mdx@@ -151,12 +151,4 @@ We are continuously adding new features. Feel free to let us know what's missing## Video tutorial-<ShowcaseYouTube- entries={[- {- href: 'https://www.youtube.com/watch?v=igMbSrej6RQ',- title: 'View, configure and enable the new status page',- },-- ]}-/>+<ShowcaseYouTube href="https://www.youtube.com/watch?v=DggletH0oOM" title="Create a free status page for your SaaS" />diff --git a/apps/web/src/content/pages/docs/reference/maintenance.mdx b/apps/web/src/content/pages/docs/reference/maintenance.mdxindex 5afe21156..83821a8d5 100644--- a/apps/web/src/content/pages/docs/reference/maintenance.mdx+++ b/apps/web/src/content/pages/docs/reference/maintenance.mdx@@ -97,3 +97,7 @@ A maintenance always keeps at least one update: deleting the last one is rejecte- **[Status page reference](/docs/reference/status-page)** — how maintenance windows surface on the public status page.- **[Page components](/docs/reference/page-components)** — the monitor and static components a maintenance window can target.- **[Status report reference](/docs/reference/status-report)** — communicate unplanned incidents, as opposed to scheduled maintenance.++## Video tutorial++<ShowcaseYouTube href="https://www.youtube.com/watch?v=7rjDDyMumeY" title="How to schedule maintenance on your status page" />diff --git a/apps/web/src/content/pages/docs/tutorial/create-your-first-monitor.mdx b/apps/web/src/content/pages/docs/tutorial/create-your-first-monitor.mdxindex 6467e0d0c..06e258369 100644--- a/apps/web/src/content/pages/docs/tutorial/create-your-first-monitor.mdx+++ b/apps/web/src/content/pages/docs/tutorial/create-your-first-monitor.mdx@@ -123,12 +123,4 @@ If you're monitoring a URL you don't own (like `google.com` or a partner API), y## Video tutorial-<ShowcaseYouTube- entries={[- {- href: 'https://www.youtube.com/embed/nYti3DjHoWY?si=RBGFHzoHFmwphRf',- title: 'Create your first monitor',- },-- ]}-/>+<ShowcaseYouTube href="https://www.youtube.com/watch?v=0oN0V9UJogk" title="How to set up an HTTP monitor with openstatus" />diff --git a/apps/web/src/content/pages/docs/tutorial/create-your-first-status-page.mdx b/apps/web/src/content/pages/docs/tutorial/create-your-first-status-page.mdxindex d755bd153..e272f0dde 100644--- a/apps/web/src/content/pages/docs/tutorial/create-your-first-status-page.mdx+++ b/apps/web/src/content/pages/docs/tutorial/create-your-first-status-page.mdx@@ -100,3 +100,10 @@ four access types.- **[Status page reference](/docs/reference/status-page)** — complete configuration options.- **[Understanding uptime values](/docs/concept/uptime-calculation-and-values)** — how uptime is calculated.++## Video tutorial++<Grid cols={2} variant="borderless">+<ShowcaseYouTube href="https://www.youtube.com/watch?v=DggletH0oOM" title="Create a free status page for your SaaS" />+<ShowcaseYouTube href="https://www.youtube.com/watch?v=_GRy14tsoyU" title="How to connect a monitor to your status page" />+</Grid>diff --git a/apps/web/src/content/pages/docs/tutorial/getting-started.mdx b/apps/web/src/content/pages/docs/tutorial/getting-started.mdxindex ba7829cda..6bf2d187b 100644--- a/apps/web/src/content/pages/docs/tutorial/getting-started.mdx+++ b/apps/web/src/content/pages/docs/tutorial/getting-started.mdx@@ -11,6 +11,8 @@ Our tutorials walk you end-to-end through the openstatus workflow: monitor an enIf you're new, follow the tutorials below in order. Each one builds on the previous and takes 5–10 minutes.+Prefer video? The same path is on YouTube as the [openstatus tutorials playlist](https://www.youtube.com/playlist?list=PLejPLN0oV6WA_HyBXwRHOytolZFZX1pXG).+## Get started1. **[Create an uptime monitor](/docs/tutorial/create-your-first-monitor)** (~5 min) — set up uptime monitoring for your first endpoint.diff --git a/apps/web/src/content/pages/docs/tutorial/your-first-notification.mdx b/apps/web/src/content/pages/docs/tutorial/your-first-notification.mdxindex 7dcd1fded..39b9aced4 100644--- a/apps/web/src/content/pages/docs/tutorial/your-first-notification.mdx+++ b/apps/web/src/content/pages/docs/tutorial/your-first-notification.mdx@@ -71,3 +71,7 @@ The same region agreement that fires the alert also gates *recovery*. If you poi- **[Notification channels reference](/docs/reference/notification)** — every channel type, its config fields, and (for webhooks) the payload schema.- **[Incident reference](/docs/reference/incident)** — exactly what triggers a notification and the lifecycle states an incident goes through.++## Video tutorial++<ShowcaseYouTube href="https://www.youtube.com/watch?v=g9Pb1dRDt6c" title="How to get alerted when your website goes down" />diff --git a/apps/web/src/content/pages/docs/tutorial/your-first-status-report.mdx b/apps/web/src/content/pages/docs/tutorial/your-first-status-report.mdxindex c611981fe..0c596582a 100644--- a/apps/web/src/content/pages/docs/tutorial/your-first-status-report.mdx+++ b/apps/web/src/content/pages/docs/tutorial/your-first-status-report.mdx@@ -83,3 +83,7 @@ Save. The report is now archived. On the status page it moves out of the active- **[Incident reference](/docs/reference/incident)** — how openstatus auto-detects incidents from monitor failures (the trigger side of the same workflow).- **[Building trust with status pages](/docs/concept/best-practices-status-page)** — the *why* behind the four-state cadence.- **[CLI reference — status-report](/docs/reference/cli-reference#status-report-command-aliases-sr)** — the same workflow from a terminal.++## Video tutorial++<ShowcaseYouTube href="https://www.youtube.com/watch?v=hTBJ296ZIxM" title="How to post an incident update on your status page" />diff --git a/apps/web/src/content/pages/guides/migrate-from-atlassian-statuspage.mdx b/apps/web/src/content/pages/guides/migrate-from-atlassian-statuspage.mdxindex 75ea321b9..eb769059e 100644--- a/apps/web/src/content/pages/guides/migrate-from-atlassian-statuspage.mdx+++ b/apps/web/src/content/pages/guides/migrate-from-atlassian-statuspage.mdx@@ -136,14 +136,7 @@ After verifying that everything is working correctly on openstatus, you can cancWatch a full migration from Atlassian Statuspage to openstatus in real time.-<ShowcaseYouTube- entries={[- {- href: 'https://www.youtube.com/embed/fsjfnihLjDU',- title: 'Migration speedrun: Atlassian Statuspage to openstatus',- },- ]}-/>+<ShowcaseYouTube href="https://www.youtube.com/embed/fsjfnihLjDU" title="Migration speedrun: Atlassian Statuspage to openstatus" />## Further Readingdiff --git a/apps/web/src/content/pages/guides/migrate-from-betterstack.mdx b/apps/web/src/content/pages/guides/migrate-from-betterstack.mdxindex 8adffcbe4..6dc83a27d 100644--- a/apps/web/src/content/pages/guides/migrate-from-betterstack.mdx+++ b/apps/web/src/content/pages/guides/migrate-from-betterstack.mdx@@ -165,14 +165,7 @@ Once the import finishes, there are a few things to verify:Watch a full migration from Better Stack to openstatus in real time.-<ShowcaseYouTube- entries={[- {- href: 'https://www.youtube.com/embed/6nX-qjzAInU',- title: 'Migration speedrun: Better Stack to openstatus',- },- ]}-/>+<ShowcaseYouTube href="https://www.youtube.com/embed/6nX-qjzAInU" title="Migration speedrun: Better Stack to openstatus" />## Further readingdiff --git a/apps/web/src/content/pages/guides/migrate-from-instatus.mdx b/apps/web/src/content/pages/guides/migrate-from-instatus.mdxindex bc185de17..2fe3bc98f 100644--- a/apps/web/src/content/pages/guides/migrate-from-instatus.mdx+++ b/apps/web/src/content/pages/guides/migrate-from-instatus.mdx@@ -94,14 +94,7 @@ Toggle which resource types to include. Click **Import**. The import runs in secWatch a full migration from Instatus to openstatus in real time.-<ShowcaseYouTube- entries={[- {- href: 'https://www.youtube.com/embed/fSEBm2QTgto',- title: 'Migration speedrun: Instatus to openstatus',- },- ]}-/>+<ShowcaseYouTube href="https://www.youtube.com/embed/fSEBm2QTgto" title="Migration speedrun: Instatus to openstatus" />## Further reading