The Open Standard for Generative UI
import { createMDX } from "fumadocs-mdx/next";
import { dirname } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const withMDX = createMDX();
// Demos deployed as their own Vercel projects, served under openui.com/demo/<path>. Each app sets
// NEXT_PUBLIC_BASE_PATH to the same path, so its pages, assets and API routes all live under it.
const proxiedDemos = {
"f1-dashboard": "https://openui-f1-dashboard.vercel.app",
"trip-planner": "https://openui-trip-planner.vercel.app",
"intelligent-ui": "https://open-intelligent-ui.vercel.app",
};
/** @type {import('next').NextConfig} */
const config = {
serverExternalPackages: ["@takumi-rs/image-response"],
// OG metadata and images read artwork from public/ by path, so tracing would otherwise
// bundle every video into each function. Media is served from the CDN, never read at runtime.
outputFileTracingExcludes: {
"/**": ["./public/**/*.{mp4,webm,mov,gif}"],
},
images: {
/* Dense product screenshots contain small UI text and one-pixel rules.
Keep the default for general imagery, but allow the illustration pair
components to request a sharper responsive derivative. */
qualities: [75, 95],
},
turbopack: {
root: dirname(dirname(__dirname)),
},
reactStrictMode: true,
async headers() {
return [
{
source: "/:path*.mp4",
headers: [
{
key: "Cache-Control",
value: "public, max-age=86400, immutable",
},
],
},
// Keep build chunks crawlable (Google needs them to render pages) but out of the index.
{
source: "/_next/static/:path*",
headers: [{ key: "X-Robots-Tag", value: "noindex" }],
},
];
},
async redirects() {
return [
{
source: "/favicon.svg",
destination: "/shiro-logo.svg",
permanent: true,
},
// The Cookbooks overview is temporarily removed; open the only cookbook instead.
{
source: "/cookbooks",
destination: "/cookbooks/conversational-analytics",
permanent: false,
},
{
source: "/docs/cookbooks",
destination: "/cookbooks/conversational-analytics",
permanent: false,
},
// Cookbooks and Demos moved from /docs to their own top-level paths.
{
source: "/docs/:section(cookbooks|demos)/:path*",
destination: "/:section/:path*",
permanent: true,
},
// The Examples tab is now Integrations, under /docs.
{
source: "/examples",
destination: "/docs/integrations",
permanent: true,
},
{
source: "/docs/examples",
destination: "/docs/integrations",
permanent: true,
},
{
source: "/docs/gateway/api/autofix",
destination: "/docs/autofix",
permanent: true,
},
{
source: "/docs/observability",
destination: "/docs/reliability",
permanent: false,
},
{
source: "/docs/observability/:path*",
destination: "/docs/reliability/:path*",
permanent: false,
},
// /cloud was the OpenUI Cloud product page; its pitch now lives on the
// home page, and the managed products have pages of their own. Temporary
// while the marketing restructure settles — make it permanent once the
// home page has actually absorbed the cloud sections.
{
source: "/cloud/:page(app)?",
destination: "/",
permanent: false,
},
{
source: "/AGENTS.md",
destination: "/",
permanent: true,
},
{
source: "/skills.md",
destination: "https://github.com/thesysdev/skills/blob/main/skills/openui/SKILL.md",
permanent: false,
},
{
source: "/components/:path*",
destination: "/docs",
permanent: true,
},
{
source: "/docs/design-system/blocks/accordian",
destination: "/docs/design-system/blocks/accordion",
permanent: true,
},
{
source: "/docs/architecture",
destination: "/docs",
permanent: true,
},
{
source: "/docs/overview",
destination: "/docs",
permanent: true,
},
{
source: "/docs/openui-lang/how-it-works",
destination: "/docs/openui-lang/architecture",
permanent: true,
},
{
source: "/docs/agent",
destination: "/docs/agent/getting-started/introduction",
permanent: true,
},
...["assistant-ui", "copilotkit"].map((integration) => ({
source: `/docs/agent/${integration}`,
destination: `/docs/build-agents/${integration}`,
permanent: true,
})),
{
source: "/docs/agent/build-your-own-ui",
destination: "/docs/build-agents/custom-chat-ui",
permanent: true,
},
{
source: "/docs/agent/vercel-ai-sdk",
destination: "/docs/build-agents/frameworks/vercel-ai-sdk",
permanent: true,
},
{
source: "/docs/agent/langchain",
destination: "/docs/build-agents/frameworks/langgraph",
permanent: true,
},
{
source: "/docs/agent/harnesses/:path*",
destination: "/docs/build-agents/frameworks/:path*",
permanent: true,
},
// Agent framework guides moved out of Agent Interface into Build Agents.
{
source: "/docs/agent/agent-runtimes/langgraph-platform",
destination: "/docs/build-agents/frameworks/langgraph",
permanent: true,
},
{
source: "/docs/agent/agent-runtimes/:path*",
destination: "/docs/build-agents/frameworks/:path*",
permanent: true,
},
{
source: "/docs/agent/core-concepts/tools",
destination: "/docs/build-agents/tools",
permanent: true,
},
{
source: "/docs/build-agents/backend-setup",
destination: "/docs/build-agents/ui-generation",
permanent: true,
},
...["assistant-ui", "copilotkit"].map((integration) => ({
source: `/docs/integrations/${integration}`,
destination: `/docs/build-agents/${integration}`,
permanent: true,
})),
{
source: "/docs/integrations/build-your-own-ui",
destination: "/docs/build-agents/custom-chat-ui",
permanent: true,
},
{
source: "/docs/integrations/vercel-ai-sdk",
destination: "/docs/build-agents/frameworks/vercel-ai-sdk",
permanent: true,
},
{
source: "/docs/integrations/langchain",
destination: "/docs/build-agents/frameworks/langgraph",
permanent: true,
},
{
source: "/docs/integrations/harnesses/:path*",
destination: "/docs/build-agents/frameworks/:path*",
permanent: true,
},
{
source: "/docs/openui-lang/examples/agent-frameworks/vercel-ai-sdk",
destination: "/docs/build-agents/frameworks/vercel-ai-sdk",
permanent: true,
},
{
source: "/docs/openui-lang/examples/agent-frameworks/langchain",
destination: "/docs/build-agents/frameworks/langgraph",
permanent: true,
},
{
source: "/docs/openui-lang/examples/agent-frameworks/langgraph-platform",
destination: "/docs/build-agents/frameworks/langgraph",
permanent: true,
},
{
source: "/docs/openui-lang/examples/agent-frameworks/vercel-eve",
destination: "/docs/build-agents/frameworks/vercel-eve",
permanent: true,
},
{
source: "/docs/openui-lang/examples/harnesses/pi",
destination: "/docs/build-agents/frameworks/pi",
permanent: true,
},
{
source: "/docs/openui-lang/examples/app-frameworks/react-native",
destination: "/docs/openui-lang",
permanent: true,
},
{
source: "/docs/openui-lang/src/library.ts",
destination: "/docs/openui-lang/defining-components",
permanent: true,
},
// Pre-reorganisation flat example URLs.
...Object.entries({
"shadcn-chat": "/docs/openui-lang/examples/design-systems/shadcn",
"react-email": "/docs/openui-lang/examples/miscellaneous/react-email",
"react-native": "/docs/openui-lang",
dashboard: "/cookbooks/conversational-analytics",
"langgraph-chat": "/docs/build-agents/frameworks/langgraph",
"langchain-chat": "/docs/build-agents/frameworks/langgraph",
"vercel-ai-chat": "/docs/build-agents/frameworks/vercel-ai-sdk",
"harnesses/pi-agent-harness": "/docs/build-agents/frameworks/pi",
"harnesses/vercel-eve": "/docs/build-agents/frameworks/vercel-eve",
}).map(([example, destination]) => ({
source: `/docs/openui-lang/examples/${example}`,
destination,
permanent: true,
})),
// The old /docs/chat section was replaced by the Agent Interface docs.
...Object.entries({
"quick-start": "/docs/agent/getting-started/quickstart",
installation: "/docs/agent/getting-started/quickstart",
nextjs: "/docs/agent/reference/self-hosting",
connecting: "/docs/agent/reference/adapters-and-formats",
genui: "/docs/agent/core-concepts/generative-ui",
artifacts: "/docs/agent/core-concepts/artifacts",
welcome: "/docs/agent/customize/welcome-and-starters",
theming: "/docs/agent/reference/agentinterface-props#theme",
persistence: "/docs/build-agents/conversation-history",
}).map(([page, destination]) => ({
source: `/docs/chat/${page}`,
destination,
permanent: true,
})),
{
source: "/docs/chat/:path*",
destination: "/docs/build-agents/chat-ui",
permanent: true,
},
{
source: "/docs/agent/getting-started/openui-cloud",
destination: "/docs/agent/getting-started/quickstart",
permanent: true,
},
{
source: "/docs/agent/agent-interface",
destination: "/docs/agent/getting-started/introduction",
permanent: true,
},
{
source: "/docs/agent/agent-interface/:path*",
destination: "/docs/agent/:path*",
permanent: true,
},
{
source: "/docs/openui-cloud/get-started",
destination: "/docs/gateway/generate-openui-lang",
permanent: true,
},
{
source: "/docs/gateway/quickstart",
destination: "/docs/gateway/generate-openui-lang",
permanent: true,
},
{
source: "/docs/openui-cloud/how-it-works",
destination: "/docs/gateway",
permanent: true,
},
{
source: "/docs/openui-cloud/production-readiness",
destination: "/docs/gateway/reliability",
permanent: true,
},
{
source: "/docs/gateway/reliability/error-correction",
destination: "/docs/gateway/reliability",
permanent: true,
},
{
source: "/docs/gateway/reliability/provider-fallbacks",
destination: "/docs/gateway/reliability",
permanent: true,
},
{
source: "/docs/openui-cloud/models-and-byok",
destination: "/docs/gateway/models",
permanent: true,
},
{
source: "/docs/openui-cloud/api/chat-completions",
destination: "/docs/gateway/api/chat-completions",
permanent: true,
},
{
source: "/docs/openui-cloud/api/responses",
destination: "/docs/gateway/api/responses",
permanent: true,
},
{
source: "/docs/openui-cloud/api/conversations",
destination: "/docs/gateway/api/conversations",
permanent: true,
},
{
source: "/docs/openui-cloud",
destination: "/docs/gateway",
permanent: true,
},
{
source: "/docs/openui-cloud/:path*",
destination: "/docs/gateway",
permanent: true,
},
{
source: "/docs/add-ons",
destination: "/lab",
permanent: false,
},
{
source: "/add-ons",
destination: "/lab",
permanent: false,
},
{
source: "/ecosystem",
destination: "/lab",
permanent: false,
},
{
source: "/registry",
destination: "/lab",
permanent: false,
},
// Nav rename: Playground -> Demos, Projects -> Lab. Keep the old
// paths working for external links and search results.
// Product rename: Paste → Debug. Keep the old path working.
{
source: "/paste",
destination: "/debug",
permanent: true,
},
{
source: "/playground",
destination: "/openui-vs-json",
permanent: true,
},
{
source: "/projects",
destination: "/lab",
permanent: true,
},
{
source: "/showcase",
destination: "/lab",
permanent: true,
},
{
source: "/blog/should-chat-be-the-new-homepage-for-saas",
destination: "/blog/beyond-the-chatbar",
permanent: true,
},
// Preserve the founder-shared singular spelling while keeping one
// canonical benchmark namespace for search engines and agents.
{
source: "/benchmark/framework",
destination: "/benchmarks/framework",
permanent: true,
},
{
source: "/benchmark/language",
destination: "/benchmarks/language",
permanent: true,
},
];
},
async rewrites() {
return [
...Object.entries(proxiedDemos).flatMap(([path, origin]) => [
{ source: `/demo/${path}`, destination: `${origin}/demo/${path}` },
{ source: `/demo/${path}/:rest*`, destination: `${origin}/demo/${path}/:rest*` },
]),
{
source: "/docs/:path*.mdx",
destination: "/llms.mdx/docs/:path*",
},
{
source: "/:section(cookbooks|demos)/:path*.mdx",
destination: "/llms.mdx/docs/:section/:path*",
},
{
source: "/demos.mdx",
destination: "/llms.mdx/docs/demos",
},
];
},
};
export default withMDX(config);