Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(docs): mount docs site at /docs subpath via basePath + multi-zone (#1160)

Bohan Jiang7c6158f3c94f
diff --git a/apps/docs/app/(home)/layout.tsx b/apps/docs/app/(home)/layout.tsx
deleted file mode 100644
index 1c64fbb9c2..0000000000
--- a/apps/docs/app/(home)/layout.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import type { ReactNode } from "react";
-import { HomeLayout } from "fumadocs-ui/layouts/home";
-import { baseOptions } from "@/app/layout.config";
-
-export default function Layout({ children }: { children: ReactNode }) {
- return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
-}
diff --git a/apps/docs/app/(home)/page.tsx b/apps/docs/app/(home)/page.tsx
deleted file mode 100644
index 21f36203e1..0000000000
--- a/apps/docs/app/(home)/page.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import Link from "next/link";
-
-export default function HomePage() {
- return (
- <main className="flex min-h-screen flex-col items-center justify-center gap-6 text-center px-4">
- <h1 className="text-4xl font-bold tracking-tight sm:text-5xl">
- Multica Documentation
- </h1>
- <p className="max-w-2xl text-lg text-fd-muted-foreground">
- The open-source managed agents platform. Turn coding agents into real
- teammates — assign tasks, track progress, compound skills.
- </p>
- <div className="flex gap-4">
- <Link
- href="/docs"
- className="inline-flex items-center rounded-md bg-fd-primary px-6 py-3 text-sm font-medium text-fd-primary-foreground transition-colors hover:bg-fd-primary/90"
- >
- Get Started
- </Link>
- <Link
- href="https://github.com/multica-ai/multica"
- className="inline-flex items-center rounded-md border border-fd-border px-6 py-3 text-sm font-medium transition-colors hover:bg-fd-accent"
- >
- GitHub
- </Link>
- </div>
- </main>
- );
-}
diff --git a/apps/docs/app/docs/[[...slug]]/page.tsx b/apps/docs/app/[...slug]/page.tsx
similarity index 84%
rename from apps/docs/app/docs/[[...slug]]/page.tsx
rename to apps/docs/app/[...slug]/page.tsx
index 8e3ff66b5e..e31ac4ae48 100644
--- a/apps/docs/app/docs/[[...slug]]/page.tsx
+++ b/apps/docs/app/[...slug]/page.tsx
@@ -10,7 +10,7 @@ import defaultMdxComponents from "fumadocs-ui/mdx";
import type { Metadata } from "next";
export default async function Page(props: {
- params: Promise<{ slug?: string[] }>;
+ params: Promise<{ slug: string[] }>;
}) {
const params = await props.params;
const page = source.getPage(params.slug);
@@ -29,12 +29,12 @@ export default async function Page(props: {
);
}
-export async function generateStaticParams() {
- return source.generateParams();
+export function generateStaticParams() {
+ return source.generateParams().filter((p) => p.slug.length > 0);
}
export async function generateMetadata(props: {
- params: Promise<{ slug?: string[] }>;
+ params: Promise<{ slug: string[] }>;
}): Promise<Metadata> {
const params = await props.params;
const page = source.getPage(params.slug);
diff --git a/apps/docs/app/docs/layout.tsx b/apps/docs/app/docs/layout.tsx
deleted file mode 100644
index 39a1aed26b..0000000000
--- a/apps/docs/app/docs/layout.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { DocsLayout } from "fumadocs-ui/layouts/docs";
-import type { ReactNode } from "react";
-import { baseOptions } from "@/app/layout.config";
-import { source } from "@/lib/source";
-
-export default function Layout({ children }: { children: ReactNode }) {
- return (
- <DocsLayout tree={source.pageTree} {...baseOptions}>
- {children}
- </DocsLayout>
- );
-}
diff --git a/apps/docs/app/layout.config.tsx b/apps/docs/app/layout.config.tsx
index 26aa591c55..3197ed3979 100644
--- a/apps/docs/app/layout.config.tsx
+++ b/apps/docs/app/layout.config.tsx
@@ -1,5 +1,4 @@
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
-import { BookOpen, Terminal, Rocket, Code } from "lucide-react";
export const baseOptions: BaseLayoutProps = {
nav: {
@@ -8,11 +7,6 @@ export const baseOptions: BaseLayoutProps = {
),
},
links: [
- {
- text: "Documentation",
- url: "/docs",
- active: "nested-url",
- },
{
text: "GitHub",
url: "https://github.com/multica-ai/multica",
diff --git a/apps/docs/app/layout.tsx b/apps/docs/app/layout.tsx
index 26a40f2ea0..a64f684948 100644
--- a/apps/docs/app/layout.tsx
+++ b/apps/docs/app/layout.tsx
@@ -1,7 +1,10 @@
import "./global.css";
import { RootProvider } from "fumadocs-ui/provider";
+import { DocsLayout } from "fumadocs-ui/layouts/docs";
import type { ReactNode } from "react";
import type { Metadata } from "next";
+import { baseOptions } from "@/app/layout.config";
+import { source } from "@/lib/source";
export const metadata: Metadata = {
title: {
@@ -16,7 +19,11 @@ export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
- <RootProvider>{children}</RootProvider>
+ <RootProvider>
+ <DocsLayout tree={source.pageTree} {...baseOptions}>
+ {children}
+ </DocsLayout>
+ </RootProvider>
</body>
</html>
);
diff --git a/apps/docs/app/not-found.tsx b/apps/docs/app/not-found.tsx
new file mode 100644
index 0000000000..6f4eb1c2e9
--- /dev/null
+++ b/apps/docs/app/not-found.tsx
@@ -0,0 +1,18 @@
+import Link from "next/link";
+
+export default function NotFound() {
+ return (
+ <main className="flex flex-1 flex-col items-center justify-center gap-4 px-4 py-24 text-center">
+ <h1 className="text-3xl font-semibold">Page not found</h1>
+ <p className="text-fd-muted-foreground">
+ The page you are looking for doesn&apos;t exist.
+ </p>
+ <Link
+ href="/"
+ className="inline-flex items-center rounded-md bg-fd-primary px-4 py-2 text-sm font-medium text-fd-primary-foreground transition-colors hover:bg-fd-primary/90"
+ >
+ Back to docs
+ </Link>
+ </main>
+ );
+}
diff --git a/apps/docs/app/page.tsx b/apps/docs/app/page.tsx
new file mode 100644
index 0000000000..d821d7c35e
--- /dev/null
+++ b/apps/docs/app/page.tsx
@@ -0,0 +1,37 @@
+import { source } from "@/lib/source";
+import {
+ DocsPage,
+ DocsBody,
+ DocsDescription,
+ DocsTitle,
+} from "fumadocs-ui/page";
+import { notFound } from "next/navigation";
+import defaultMdxComponents from "fumadocs-ui/mdx";
+import type { Metadata } from "next";
+
+export default function Page() {
+ const page = source.getPage([]);
+ if (!page) notFound();
+
+ const MDX = page.data.body;
+
+ return (
+ <DocsPage toc={page.data.toc}>
+ <DocsTitle>{page.data.title}</DocsTitle>
+ <DocsDescription>{page.data.description}</DocsDescription>
+ <DocsBody>
+ <MDX components={{ ...defaultMdxComponents }} />
+ </DocsBody>
+ </DocsPage>
+ );
+}
+
+export function generateMetadata(): Metadata {
+ const page = source.getPage([]);
+ if (!page) notFound();
+
+ return {
+ title: page.data.title,
+ description: page.data.description,
+ };
+}
diff --git a/apps/docs/content/docs/cli/installation.mdx b/apps/docs/content/docs/cli/installation.mdx
index d5df65adc1..b5c8f02ff4 100644
--- a/apps/docs/content/docs/cli/installation.mdx
+++ b/apps/docs/content/docs/cli/installation.mdx
@@ -68,7 +68,7 @@ multica setup
This configures the CLI for Multica Cloud, opens your browser for login, discovers your workspaces, and starts the agent daemon.
-For self-hosted servers, use `multica setup self-host` instead. See [Self-Hosting](/docs/getting-started/self-hosting) for details.
+For self-hosted servers, use `multica setup self-host` instead. See [Self-Hosting](/getting-started/self-hosting) for details.
## Verify
diff --git a/apps/docs/content/docs/index.mdx b/apps/docs/content/docs/index.mdx
index 92c2e97c71..0a384513e1 100644
--- a/apps/docs/content/docs/index.mdx
+++ b/apps/docs/content/docs/index.mdx
@@ -41,7 +41,7 @@ No more copy-pasting prompts. No more babysitting runs. Your agents show up on t
## Next Steps
-- [Cloud Quickstart](/docs/getting-started/cloud-quickstart)
-- [Self-Hosting](/docs/getting-started/self-hosting)
-- [CLI Installation](/docs/cli/installation)
-- [Contributing](/docs/developers/contributing)
+- [Cloud Quickstart](/getting-started/cloud-quickstart)
+- [Self-Hosting](/getting-started/self-hosting)
+- [CLI Installation](/cli/installation)
+- [Contributing](/developers/contributing)
diff --git a/apps/docs/lib/source.ts b/apps/docs/lib/source.ts
index c5fb60a865..7be5bda491 100644
--- a/apps/docs/lib/source.ts
+++ b/apps/docs/lib/source.ts
@@ -2,6 +2,6 @@ import { docs } from "@/.source";
import { loader } from "fumadocs-core/source";
export const source = loader({
- baseUrl: "/docs",
+ baseUrl: "/",
source: docs.toFumadocsSource(),
});
diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs
index 50894e976d..25753dc67c 100644
--- a/apps/docs/next.config.mjs
+++ b/apps/docs/next.config.mjs
@@ -5,6 +5,7 @@ const withMDX = createMDX();
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
+ basePath: "/docs",
};
export default withMDX(config);
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
index 672bed443c..e0b59ed8fd 100644
--- a/apps/web/next.config.ts
+++ b/apps/web/next.config.ts
@@ -6,6 +6,7 @@ import { resolve } from "path";
config({ path: resolve(__dirname, "../../.env") });
const remoteApiUrl = process.env.REMOTE_API_URL || "http://localhost:8080";
+const docsUrl = process.env.DOCS_URL || "http://localhost:4000";
// Parse hostnames from CORS_ALLOWED_ORIGINS so that Next.js dev server
// allows cross-origin HMR / webpack requests (e.g. from Tailscale IPs).
@@ -49,6 +50,14 @@ const nextConfig: NextConfig = {
source: "/uploads/:path*",
destination: `${remoteApiUrl}/uploads/:path*`,
},
+ {
+ source: "/docs",
+ destination: `${docsUrl}/docs`,
+ },
+ {
+ source: "/docs/:path*",
+ destination: `${docsUrl}/docs/:path*`,
+ },
];
},
};
diff --git a/turbo.json b/turbo.json
index 457cd39245..1335f52b08 100644
--- a/turbo.json
+++ b/turbo.json
@@ -8,6 +8,7 @@
"NEXT_PUBLIC_API_URL",
"NEXT_PUBLIC_WS_URL",
"MULTICA_SERVER_URL",
+ "DOCS_URL",
"COMPOSE_PROJECT_NAME",
"POSTGRES_DB",
"POSTGRES_PORT",