Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: added showcases list, showcase singe page

kapishdimaecf67903fd31
diff --git a/Dockerfile b/Dockerfile
index 276630d8..a3c5dbe4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -41,6 +41,15 @@ RUN bun install --frozen-lockfile
# App source + build.
COPY . .
+
+# The /showcases pages are prerendered, so the build itself fetches the manager
+# and fails loudly when it can't reach it. Coolify only forwards this to the
+# build when the variable is marked as a *build* variable in its UI — a plain
+# runtime variable is not enough. ENV also carries the value into the running
+# image as a default; a runtime variable of the same name still overrides it.
+ARG SHOWCASES_API_URL
+ENV SHOWCASES_API_URL=$SHOWCASES_API_URL
+
RUN bun run build
# Bake the Chrome Headless Shell into the image (no slow runtime download).
diff --git a/app/(home)/components/github-button.tsx b/app/(home)/components/github-button.tsx
index 423b8fde..e08f91ef 100644
--- a/app/(home)/components/github-button.tsx
+++ b/app/(home)/components/github-button.tsx
@@ -1,6 +1,7 @@
import Link from "next/link";
import { GITHUB_URL } from "@/config/site";
import { formatStars, getGitHubStars } from "@/lib/github";
+import { GitHubIcon } from "./github-icon";
export async function GithubButton() {
const stars = await getGitHubStars();
@@ -23,16 +24,3 @@ export async function GithubButton() {
</Link>
);
}
-
-const GitHubIcon = ({ className }: { className?: string }) => (
- <svg
- viewBox="0 0 24 24"
- className={className}
- fill="currentColor"
- role="img"
- aria-label="GitHub"
- >
- <title>GitHub</title>
- <path d="M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.27-.01-1-.02-1.96-3.2.69-3.87-1.54-3.87-1.54-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.7 1.26 3.36.96.1-.75.4-1.26.73-1.55-2.55-.29-5.24-1.28-5.24-5.71 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.18 1.18a11 11 0 0 1 5.79 0c2.21-1.49 3.18-1.18 3.18-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.44-2.7 5.41-5.27 5.7.41.36.78 1.06.78 2.14 0 1.55-.01 2.8-.01 3.18 0 .31.21.68.8.56C20.21 21.39 23.5 17.08 23.5 12 23.5 5.65 18.35.5 12 .5Z" />
- </svg>
-);
diff --git a/app/(home)/components/github-icon.tsx b/app/(home)/components/github-icon.tsx
new file mode 100644
index 00000000..2968a94d
--- /dev/null
+++ b/app/(home)/components/github-icon.tsx
@@ -0,0 +1,12 @@
+export const GitHubIcon = ({ className }: { className?: string }) => (
+ <svg
+ viewBox="0 0 24 24"
+ className={className}
+ fill="currentColor"
+ role="img"
+ aria-label="GitHub"
+ >
+ <title>GitHub</title>
+ <path d="M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.27-.01-1-.02-1.96-3.2.69-3.87-1.54-3.87-1.54-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.7 1.26 3.36.96.1-.75.4-1.26.73-1.55-2.55-.29-5.24-1.28-5.24-5.71 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.18 1.18a11 11 0 0 1 5.79 0c2.21-1.49 3.18-1.18 3.18-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.44-2.7 5.41-5.27 5.7.41.36.78 1.06.78 2.14 0 1.55-.01 2.8-.01 3.18 0 .31.21.68.8.56C20.21 21.39 23.5 17.08 23.5 12 23.5 5.65 18.35.5 12 .5Z" />
+ </svg>
+);
diff --git a/app/(home)/showcases/[slug]/page.tsx b/app/(home)/showcases/[slug]/page.tsx
new file mode 100644
index 00000000..26d3685e
--- /dev/null
+++ b/app/(home)/showcases/[slug]/page.tsx
@@ -0,0 +1,93 @@
+import { ArrowLeft } from "lucide-react";
+import type { Metadata } from "next";
+import Link from "next/link";
+import { notFound } from "next/navigation";
+import { Button } from "@/components/ui/button";
+import { getShowcase, getShowcases } from "@/lib/showcases";
+import { GitHubIcon } from "../../components/github-icon";
+import { ShowcaseAuthor } from "../components/showcase-author";
+import { ShowcaseComponents } from "../components/showcase-components";
+import { ShowcaseVideo } from "../components/showcase-video";
+
+type PageProps = { params: Promise<{ slug: string }> };
+
+export async function generateStaticParams() {
+ const showcases = await getShowcases();
+ return showcases.map((showcase) => ({ slug: showcase.slug }));
+}
+
+export async function generateMetadata({
+ params,
+}: PageProps): Promise<Metadata> {
+ const { slug } = await params;
+ const showcase = await getShowcase(slug);
+ if (!showcase) return {};
+
+ const title = `${showcase.title} · remocn`;
+
+ return {
+ title: showcase.title,
+ openGraph: {
+ type: "article",
+ url: `/showcases/${showcase.slug}`,
+ siteName: "Remocn",
+ title,
+ locale: "en_US",
+ images: [{ url: showcase.posterUrl, alt: showcase.title }],
+ },
+ twitter: {
+ card: "summary_large_image",
+ title,
+ images: [showcase.posterUrl],
+ },
+ };
+}
+
+export default async function ShowcasePage({ params }: PageProps) {
+ const { slug } = await params;
+ const showcase = await getShowcase(slug);
+ if (!showcase) notFound();
+
+ return (
+ <section className="pt-10 pb-24 sm:pt-14">
+ <div className="section flex flex-col gap-8">
+ <Link
+ href="/showcases"
+ className="inline-flex w-fit items-center gap-1.5 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground"
+ >
+ <ArrowLeft className="size-4" aria-hidden="true" />
+ Showcases
+ </Link>
+
+ <div className="flex flex-col gap-4">
+ <h1 className="text-3xl font-semibold leading-tight tracking-tight text-foreground sm:text-4xl">
+ {showcase.title}
+ </h1>
+ <div className="flex flex-wrap items-center justify-between gap-x-6 gap-y-3">
+ <ShowcaseAuthor author={showcase.author} linked />
+ {showcase.githubUrl ? (
+ <Button
+ variant="outline"
+ className="h-9 gap-2 rounded-full px-4 text-sm"
+ render={
+ <Link
+ href={showcase.githubUrl}
+ target="_blank"
+ rel="noreferrer"
+ />
+ }
+ >
+ <GitHubIcon className="size-4" />
+ View source
+ </Button>
+ ) : null}
+ </div>
+ </div>
+
+ <ShowcaseVideo src={showcase.videoUrl} poster={showcase.posterUrl} />
+
+ <ShowcaseComponents components={showcase.components} />
+ </div>
+ </section>
+ );
+}
diff --git a/app/(home)/showcases/components/showcase-author.tsx b/app/(home)/showcases/components/showcase-author.tsx
new file mode 100644
index 00000000..1fad592e
--- /dev/null
+++ b/app/(home)/showcases/components/showcase-author.tsx
@@ -0,0 +1,47 @@
+import type { Showcase } from "@/lib/showcases";
+import { cn } from "@/lib/utils";
+
+export function ShowcaseAuthor({
+ author,
+ linked = false,
+ className,
+}: {
+ author: Showcase["author"];
+ linked?: boolean;
+ className?: string;
+}) {
+ const body = (
+ <>
+ <img
+ src={author.avatarUrl}
+ alt=""
+ width={24}
+ height={24}
+ loading="lazy"
+ referrerPolicy="no-referrer"
+ className="size-6 shrink-0 rounded-full bg-muted object-cover"
+ />
+ <span className="truncate">{author.name}</span>
+ </>
+ );
+
+ const shared = cn(
+ "inline-flex min-w-0 items-center gap-2 text-sm text-muted-foreground",
+ className,
+ );
+
+ if (linked && author.url) {
+ return (
+ <a
+ href={author.url}
+ target="_blank"
+ rel="noreferrer"
+ className={cn(shared, "transition-colors hover:text-foreground")}
+ >
+ {body}
+ </a>
+ );
+ }
+
+ return <span className={shared}>{body}</span>;
+}
diff --git a/app/(home)/showcases/components/showcase-components.tsx b/app/(home)/showcases/components/showcase-components.tsx
new file mode 100644
index 00000000..e12bfe3c
--- /dev/null
+++ b/app/(home)/showcases/components/showcase-components.tsx
@@ -0,0 +1,54 @@
+import { ArrowUpRight } from "lucide-react";
+import Link from "next/link";
+import type { ShowcaseComponent } from "@/lib/showcases";
+
+const chipClassName =
+ "inline-flex items-center gap-1.5 rounded-full border border-border bg-muted px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:border-foreground/20";
+
+function ComponentChip({ component }: { component: ShowcaseComponent }) {
+ if (component.url.startsWith("/")) {
+ return (
+ <Link href={component.url} className={chipClassName}>
+ {component.name}
+ </Link>
+ );
+ }
+
+ return (
+ <a
+ href={component.url}
+ target="_blank"
+ rel="noreferrer"
+ className={chipClassName}
+ >
+ {component.name}
+ <ArrowUpRight
+ className="size-3.5 text-muted-foreground"
+ aria-hidden="true"
+ />
+ </a>
+ );
+}
+
+export function ShowcaseComponents({
+ components,
+}: {
+ components: ShowcaseComponent[];
+}) {
+ if (components.length === 0) return null;
+
+ return (
+ <section className="flex flex-col gap-3">
+ <h2 className="text-sm font-semibold text-muted-foreground">
+ Built with
+ </h2>
+ <ul className="flex flex-wrap gap-2">
+ {components.map((component) => (
+ <li key={`${component.name}-${component.url}`}>
+ <ComponentChip component={component} />
+ </li>
+ ))}
+ </ul>
+ </section>
+ );
+}
diff --git a/app/(home)/showcases/components/showcase-grid.tsx b/app/(home)/showcases/components/showcase-grid.tsx
new file mode 100644
index 00000000..11bfe14b
--- /dev/null
+++ b/app/(home)/showcases/components/showcase-grid.tsx
@@ -0,0 +1,129 @@
+"use client";
+
+import Link from "next/link";
+import { useEffect, useRef, useState } from "react";
+import type { Showcase } from "@/lib/showcases";
+import { usePrefersReducedMotion } from "@/lib/use-prefers-reduced-motion";
+import { ShowcaseAuthor } from "./showcase-author";
+import { useHoverCapable } from "./use-hover-capable";
+
+const ACTIVE_THRESHOLD = 0.5;
+
+export function ShowcaseGrid({ showcases }: { showcases: Showcase[] }) {
+ const containerRef = useRef<HTMLDivElement>(null);
+ const hoverCapable = useHoverCapable();
+ const reducedMotion = usePrefersReducedMotion();
+ const [hoveredSlug, setHoveredSlug] = useState<string | null>(null);
+ const [visibleSlug, setVisibleSlug] = useState<string | null>(null);
+
+ useEffect(() => {
+ const root = containerRef.current;
+ if (!root || hoverCapable || typeof IntersectionObserver === "undefined") {
+ return;
+ }
+
+ const ratios = new Map<string, number>();
+ const observer = new IntersectionObserver(
+ (records) => {
+ for (const record of records) {
+ const slug = record.target.getAttribute("data-showcase-slug");
+ if (slug) ratios.set(slug, record.intersectionRatio);
+ }
+ let best: string | null = null;
+ let bestRatio = ACTIVE_THRESHOLD;
+ for (const [slug, ratio] of ratios) {
+ if (ratio > bestRatio) {
+ bestRatio = ratio;
+ best = slug;
+ }
+ }
+ setVisibleSlug(best);
+ },
+ { threshold: [0, 0.25, 0.5, 0.75, 1] },
+ );
+
+ for (const frame of root.querySelectorAll("[data-showcase-slug]")) {
+ observer.observe(frame);
+ }
+ return () => observer.disconnect();
+ }, [hoverCapable]);
+
+ const playingSlug = hoverCapable ? hoveredSlug : visibleSlug;
+
+ return (
+ <div
+ ref={containerRef}
+ className="grid gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3"
+ >
+ {showcases.map((showcase) => (
+ <ShowcaseCard
+ key={showcase.slug}
+ showcase={showcase}
+ playing={!reducedMotion && showcase.slug === playingSlug}
+ onHover={(hovered) =>
+ setHoveredSlug((prev) =>
+ hovered ? showcase.slug : prev === showcase.slug ? null : prev,
+ )
+ }
+ />
+ ))}
+ </div>
+ );
+}
+
+function ShowcaseCard({
+ showcase,
+ playing,
+ onHover,
+}: {
+ showcase: Showcase;
+ playing: boolean;
+ onHover: (hovered: boolean) => void;
+}) {
+ const videoRef = useRef<HTMLVideoElement>(null);
+
+ useEffect(() => {
+ const video = videoRef.current;
+ if (!video) return;
+ if (playing) {
+ void video.play().catch(() => {});
+ return;
+ }
+ video.pause();
+ video.currentTime = 0;
+ }, [playing]);
+
+ return (
+ <Link
+ href={`/showcases/${showcase.slug}`}
+ onPointerEnter={() => onHover(true)}
+ onPointerLeave={() => onHover(false)}
+ onFocus={() => onHover(true)}
+ onBlur={() => onHover(false)}
+ className="group flex min-w-0 flex-col gap-4 focus-visible:outline-none"
+ >
+ <div
+ data-showcase-slug={showcase.slug}
+ className="surface-card aspect-video w-full overflow-hidden rounded-2xl transition-colors group-hover:border-foreground/20 group-focus-visible:border-foreground/40"
+ >
+ <video
+ ref={videoRef}
+ src={showcase.videoUrl}
+ poster={showcase.posterUrl}
+ muted
+ loop
+ playsInline
+ preload="none"
+ className="size-full object-cover"
+ />
+ </div>
+
+ <div className="flex min-w-0 flex-col gap-2">
+ <h2 className="text-base font-medium leading-snug text-foreground">
+ {showcase.title}
+ </h2>
+ <ShowcaseAuthor author={showcase.author} />
+ </div>
+ </Link>
+ );
+}
diff --git a/app/(home)/showcases/components/showcase-video.tsx b/app/(home)/showcases/components/showcase-video.tsx
new file mode 100644
index 00000000..e5db7d11
--- /dev/null
+++ b/app/(home)/showcases/components/showcase-video.tsx
@@ -0,0 +1,46 @@
+"use client";
+
+import { useEffect, useRef, useState } from "react";
+import { usePrefersReducedMotion } from "@/lib/use-prefers-reduced-motion";
+import { useHoverCapable } from "./use-hover-capable";
+
+export function ShowcaseVideo({
+ src,
+ poster,
+}: {
+ src: string;
+ poster: string;
+}) {
+ const videoRef = useRef<HTMLVideoElement>(null);
+ const reducedMotion = usePrefersReducedMotion();
+ const hoverCapable = useHoverCapable();
+ const [hovered, setHovered] = useState(false);
+
+ useEffect(() => {
+ const video = videoRef.current;
+ if (!video) return;
+ if (reducedMotion) {
+ video.pause();
+ return;
+ }
+ void video.play().catch(() => {});
+ }, [reducedMotion]);
+
+ return (
+ <div className="surface-card aspect-video w-full overflow-hidden rounded-2xl">
+ <video
+ ref={videoRef}
+ src={src}
+ poster={poster}
+ controls={!hoverCapable || hovered || reducedMotion}
+ onPointerEnter={() => setHovered(true)}
+ onPointerLeave={() => setHovered(false)}
+ muted
+ loop
+ playsInline
+ preload="metadata"
+ className="size-full object-cover"
+ />
+ </div>
+ );
+}
diff --git a/app/(home)/showcases/components/showcases-hero.tsx b/app/(home)/showcases/components/showcases-hero.tsx
new file mode 100644
index 00000000..56156346
--- /dev/null
+++ b/app/(home)/showcases/components/showcases-hero.tsx
@@ -0,0 +1,44 @@
+import { ArrowRight } from "lucide-react";
+import Link from "next/link";
+import { Button } from "@/components/ui/button";
+import { FadeUp } from "../../components/fade-up";
+
+export const SHOWCASES_DESCRIPTION =
+ "Videos made with remocn — real products and launches, animated with copy-paste Remotion components.";
+
+export function ShowcasesHero() {
+ return (
+ <section className="pt-10 pb-10 sm:pt-14 sm:pb-12">
+ <div className="section">
+ <div className="flex flex-col items-center text-center">
+ <FadeUp delay={0.06}>
+ <p className="mb-3 font-mono text-xs font-medium text-muted-foreground">
+ Showcases
+ </p>
+ </FadeUp>
+ <FadeUp delay={0.1}>
+ <h1 className="max-w-3xl text-balance text-4xl font-semibold leading-[1.05] tracking-tight text-foreground sm:text-6xl">
+ Made with remocn
+ </h1>
+ </FadeUp>
+ <FadeUp delay={0.16}>
+ <p className="mt-6 max-w-2xl text-balance text-base leading-relaxed text-muted-foreground sm:text-lg">
+ {SHOWCASES_DESCRIPTION}
+ </p>
+ </FadeUp>
+ <FadeUp delay={0.22}>
+ <Button
+ variant="outline"
+ size="lg"
+ className="mt-8 h-11 gap-2 rounded-full px-5 text-sm"
+ render={<Link href="/docs/getting-started/introduction" />}
+ >
+ Start building
+ <ArrowRight className="size-4" aria-hidden="true" />
+ </Button>
+ </FadeUp>
+ </div>
+ </div>
+ </section>
+ );
+}
diff --git a/app/(home)/showcases/components/use-hover-capable.ts b/app/(home)/showcases/components/use-hover-capable.ts
new file mode 100644
index 00000000..ce74ad84
--- /dev/null
+++ b/app/(home)/showcases/components/use-hover-capable.ts
@@ -0,0 +1,19 @@
+"use client";
+
+import { useEffect, useState } from "react";
+
+export function useHoverCapable() {
+ const [hoverCapable, setHoverCapable] = useState(false);
+
+ useEffect(() => {
+ if (typeof window === "undefined" || !window.matchMedia) return;
+ const mql = window.matchMedia("(hover: hover)");
+ setHoverCapable(mql.matches);
+ const onChange = (event: MediaQueryListEvent) =>
+ setHoverCapable(event.matches);
+ mql.addEventListener("change", onChange);
+ return () => mql.removeEventListener("change", onChange);
+ }, []);
+
+ return hoverCapable;
+}
diff --git a/app/(home)/showcases/page.tsx b/app/(home)/showcases/page.tsx
new file mode 100644
index 00000000..068d0dc2
--- /dev/null
+++ b/app/(home)/showcases/page.tsx
@@ -0,0 +1,56 @@
+import type { Metadata } from "next";
+import { getShowcases } from "@/lib/showcases";
+import { ShowcaseGrid } from "./components/showcase-grid";
+import {
+ SHOWCASES_DESCRIPTION as DESCRIPTION,
+ ShowcasesHero,
+} from "./components/showcases-hero";
+
+export async function generateMetadata(): Promise<Metadata> {
+ const showcases = await getShowcases();
+ const shareImage = showcases[0]?.posterUrl ?? "/hero.png";
+
+ return {
+ title: "Showcases",
+ description: DESCRIPTION,
+ openGraph: {
+ type: "website",
+ url: "/showcases",
+ siteName: "Remocn",
+ title: "Showcases · remocn",
+ description: DESCRIPTION,
+ locale: "en_US",
+ images: [{ url: shareImage, alt: "Showcases · remocn" }],
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: "Showcases · remocn",
+ description: DESCRIPTION,
+ images: [shareImage],
+ },
+ };
+}
+
+export default async function ShowcasesPage() {
+ const showcases = await getShowcases();
+
+ return (
+ <>
+ <ShowcasesHero />
+
+ <section className="pb-24">
+ <div className="section">
+ {showcases.length > 0 ? (
+ <ShowcaseGrid showcases={showcases} />
+ ) : (
+ <div className="surface-card rounded-2xl px-6 py-20 text-center">
+ <p className="text-sm text-muted-foreground">
+ No showcases yet — the first videos are on their way.
+ </p>
+ </div>
+ )}
+ </div>
+ </section>
+ </>
+ );
+}
diff --git a/app/sitemap.ts b/app/sitemap.ts
index 0d5d6a7a..b087a40e 100644
--- a/app/sitemap.ts
+++ b/app/sitemap.ts
@@ -1,10 +1,11 @@
import type { MetadataRoute } from "next";
import { changelog } from "@/.source/server";
+import { getShowcases } from "@/lib/showcases";
import { source } from "@/source";
const SITE_URL = "https://remocn.dev";
-export default function sitemap(): MetadataRoute.Sitemap {
+export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const now = new Date();
const staticRoutes: MetadataRoute.Sitemap = [
@@ -32,6 +33,12 @@ export default function sitemap(): MetadataRoute.Sitemap {
changeFrequency: "weekly",
priority: 0.5,
},
+ {
+ url: `${SITE_URL}/showcases`,
+ lastModified: now,
+ changeFrequency: "weekly",
+ priority: 0.6,
+ },
];
const docRoutes: MetadataRoute.Sitemap = source.getPages().map((page) => ({
@@ -52,5 +59,19 @@ export default function sitemap(): MetadataRoute.Sitemap {
};
});
- return [...staticRoutes, ...docRoutes, ...changelogRoutes];
+ const showcaseRoutes: MetadataRoute.Sitemap = (await getShowcases()).map(
+ (showcase) => ({
+ url: `${SITE_URL}/showcases/${showcase.slug}`,
+ lastModified: new Date(showcase.createdAt),
+ changeFrequency: "monthly",
+ priority: 0.5,
+ }),
+ );
+
+ return [
+ ...staticRoutes,
+ ...docRoutes,
+ ...changelogRoutes,
+ ...showcaseRoutes,
+ ];
}
diff --git a/config/site.ts b/config/site.ts
index e936aca0..1414c91b 100644
--- a/config/site.ts
+++ b/config/site.ts
@@ -44,6 +44,7 @@ export const NAV_LINKS: NavLink[] = [
{ href: "/docs/typography", label: "Components" },
{ href: "/docs/shaders/getting-started/introduction", label: "Shaders" },
{ href: "/docs/icons/gallery", label: "Icons" },
+ { href: "/showcases", label: "Showcases" },
{ href: "/sponsors", label: "Sponsors" },
];
@@ -63,6 +64,7 @@ export const NEW_BADGE_PATHS = new Set<string>([
export const FOOTER_NAV: NavLink[] = [
{ href: "/docs/getting-started/introduction", label: "Docs" },
{ href: "/changelog", label: "Changelog" },
+ { href: "/showcases", label: "Showcases" },
{ href: GITHUB_URL, label: "GitHub" },
{ href: "/sponsors", label: "Sponsors" },
];
diff --git a/lib/showcases.ts b/lib/showcases.ts
new file mode 100644
index 00000000..f62c554b
--- /dev/null
+++ b/lib/showcases.ts
@@ -0,0 +1,60 @@
+import { z } from "zod";
+
+const showcaseComponentSchema = z.object({
+ name: z.string().min(1),
+ url: z.string().min(1),
+});
+
+const showcaseSchema = z.object({
+ slug: z.string().min(1),
+ title: z.string().min(1),
+ videoUrl: z.url(),
+ posterUrl: z.url(),
+ author: z.object({
+ name: z.string().min(1),
+ avatarUrl: z.url(),
+ url: z.url().nullable(),
+ }),
+ components: z.array(showcaseComponentSchema),
+ githubUrl: z.url().nullish(),
+ createdAt: z.iso.datetime({ offset: true }),
+});
+
+const showcaseListSchema = z.object({ items: z.array(showcaseSchema) });
+
+export type Showcase = z.infer<typeof showcaseSchema>;
+export type ShowcaseComponent = z.infer<typeof showcaseComponentSchema>;
+
+const REVALIDATE_SECONDS = 300;
+
+function apiBase(): string {
+ const base = process.env.SHOWCASES_API_URL;
+ if (!base) {
+ throw new Error(
+ "SHOWCASES_API_URL is not set. The showcases pages read from the manager both at build time and at runtime — set it in .env locally, and in Coolify as a build variable *and* a runtime variable.",
+ );
+ }
+ return base.replace(/\/+$/, "");
+}
+
+export async function getShowcases(): Promise<Showcase[]> {
+ const res = await fetch(`${apiBase()}/api/public/showcases`, {
+ next: { revalidate: REVALIDATE_SECONDS },
+ });
+ if (!res.ok) {
+ throw new Error(`showcases: HTTP ${res.status} ${res.statusText}`);
+ }
+ return showcaseListSchema.parse(await res.json()).items;
+}
+
+export async function getShowcase(slug: string): Promise<Showcase | null> {
+ const res = await fetch(
+ `${apiBase()}/api/public/showcases/${encodeURIComponent(slug)}`,
+ { next: { revalidate: REVALIDATE_SECONDS } },
+ );
+ if (res.status === 404) return null;
+ if (!res.ok) {
+ throw new Error(`showcase ${slug}: HTTP ${res.status} ${res.statusText}`);
+ }
+ return showcaseSchema.parse(await res.json());
+}