Skip to content

Commit 529637b

Browse files
committed
fixed templates page
1 parent d256424 commit 529637b

File tree

21 files changed

+937
-280
lines changed

21 files changed

+937
-280
lines changed

apps/framework-docs-v2/.npmrc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# Force all dependencies to be hoisted locally to this app's node_modules
22
# This prevents TypeScript from finding React types in nested node_modules
3-
# This overrides the root .npmrc which prevents hoisting to support multiple React versions
4-
# Since this app only uses React 19, we can safely hoist everything here
5-
shamefully-hoist=true
3+
# This works with the root .npmrc which prevents React from being hoisted to root
4+
# Since this app only uses React 19, we can safely hoist everything locally here
5+
#
6+
# IMPORTANT: We use hoist-pattern instead of shamefully-hoist=true to avoid
7+
# conflicts with the root hoisting pattern when running pnpm add from this directory
8+
# (e.g., via shadcn CLI). This hoists everything locally without modifying root structure.
9+
hoist-pattern[]=*
10+
11+
# Match root public-hoist-pattern to prevent ERR_PNPM_PUBLIC_HOIST_PATTERN_DIFF
12+
# This ensures compatibility when running pnpm add from this directory
13+
public-hoist-pattern[]=!react
14+
public-hoist-pattern[]=!react-dom
15+
public-hoist-pattern[]=!react/jsx-runtime
16+
public-hoist-pattern[]=!react-dom/server
17+
public-hoist-pattern[]=!react/jsx-dev-runtime
18+
public-hoist-pattern[]=!@types/react
19+
public-hoist-pattern[]=!@types/react-dom
620

apps/framework-docs-v2/content/templates/index.mdx

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,69 +5,13 @@ order: 2
55
category: getting-started
66
---
77

8-
import { CTACards, CTACard } from "@/components/mdx";
9-
import { Badge } from "@/components/ui/badge";
10-
import Link from "next/link";
11-
import { TemplatesGridServer } from "@/components/mdx";
8+
import { TemplatesGridServer, CommandSnippet } from "@/components/mdx";
129

1310
# Templates & Apps
1411

1512
Moose provides two ways to get started: **templates** and **demo apps**. Templates are simple skeleton applications that you can initialize with `moose init`, while demo apps are more advanced examples available on GitHub that showcase real-world use cases and integrations.
1613

17-
**Initialize a template:**
18-
```bash filename="Terminal" copy
19-
moose init PROJECT_NAME TEMPLATE_NAME
20-
```
21-
22-
**List available templates:**
23-
```bash filename="Terminal" copy
24-
moose template list
25-
```
26-
27-
## Popular Apps
28-
29-
<CTACards columns={2}>
30-
<CTACard
31-
title="Nextjs + Express + MCP demo app: Aircraft data"
32-
description="Complete demo application featuring real-time aircraft transponder data with MCP chat integration."
33-
ctaLink="#plane-transponder-demo"
34-
ctaLabel="Details"
35-
secondaryCtaLink="https://github.com/514-labs/planes"
36-
secondaryCtaLabel="Github →"
37-
badge={{ variant: "default", text: "Express APIs + MCP Demo" }}
38-
/>
39-
40-
<CTACard
41-
title="Postgres to ClickHouse CDC with Debezium"
42-
description="Easy-to-run demo of a CDC pipeline using Debezium, PostgreSQL, Redpanda, and ClickHouse."
43-
ctaLink="#postgres-clickhouse-cdc"
44-
ctaLabel="Details"
45-
secondaryCtaLink="https://github.com/514-labs/debezium-cdc"
46-
secondaryCtaLabel="Github →"
47-
badge={{ variant: "default", text: "CDC Demo" }}
48-
/>
49-
50-
<CTACard
51-
title="User-facing analytics reference app (Postgres + Clickhouse + React)"
52-
description="Complete reference architecture showing how to add a dedicated analytics microservice to an existing application."
53-
ctaLink="#foobar-ufa"
54-
ctaLabel="Details"
55-
secondaryCtaLink="https://github.com/514-labs/area-code/tree/main/ufa"
56-
secondaryCtaLabel="Github →"
57-
badge={{ variant: "default", text: "Reference Architecture" }}
58-
/>
59-
60-
<CTACard
61-
title="User-facing analytics reference app (Clickhouse Cloud + React)"
62-
description="Simplified version of the reference architecture using ClickHouse Cloud with React frontend and chat analytics."
63-
ctaLink="#foobar-ufa-lite"
64-
ctaLabel="Details"
65-
secondaryCtaLink="https://github.com/514-labs/area-code/tree/main/ufa-lite"
66-
secondaryCtaLabel="Github →"
67-
badge={{ variant: "default", text: "ClickHouse Cloud demo" }}
68-
/>
69-
</CTACards>
70-
---
14+
<CommandSnippet />
7115

7216
## Browse Apps and Templates
7317

apps/framework-docs-v2/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
"@next/mdx": "^16.0.1",
2222
"@radix-ui/react-accordion": "^1.2.11",
2323
"@radix-ui/react-avatar": "^1.0.4",
24+
"@radix-ui/react-checkbox": "^1.3.3",
2425
"@radix-ui/react-collapsible": "^1.1.11",
2526
"@radix-ui/react-dialog": "^1.1.15",
2627
"@radix-ui/react-dropdown-menu": "^2.1.15",
2728
"@radix-ui/react-label": "^2.1.7",
2829
"@radix-ui/react-navigation-menu": "^1.2.13",
30+
"@radix-ui/react-popover": "^1.1.15",
2931
"@radix-ui/react-scroll-area": "^1.2.2",
3032
"@radix-ui/react-select": "^2.0.0",
3133
"@radix-ui/react-separator": "^1.1.7",

apps/framework-docs-v2/src/app/[...slug]/page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ export async function generateStaticParams() {
1919
const slugs = getAllSlugs();
2020

2121
// Generate params for each slug
22+
// Note: templates is excluded from getAllSlugs() as it is now an explicit page
2223
const allParams: { slug: string[] }[] = slugs.map((slug) => ({
2324
slug: slug.split("/"),
2425
}));
2526

26-
// Also add section index routes (moosestack, ai, hosting, templates)
27-
// These map to section/index.mdx files
27+
// Also add section index routes (moosestack, ai, hosting, guides)
28+
// Note: templates is now an explicit page, so it's excluded here
2829
allParams.push(
2930
{ slug: ["moosestack"] },
3031
{ slug: ["ai"] },
3132
{ slug: ["hosting"] },
32-
{ slug: ["templates"] },
33+
{ slug: ["guides"] },
3334
);
3435

3536
return allParams;
@@ -81,6 +82,11 @@ export default async function DocPage({ params }: PageProps) {
8182

8283
const slug = slugArray.join("/");
8384

85+
// Templates is now an explicit page, so it should not be handled by this catch-all route
86+
if (slug.startsWith("templates/")) {
87+
notFound();
88+
}
89+
8490
let content;
8591
try {
8692
content = await parseMarkdownContent(slug);
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { notFound } from "next/navigation";
2+
import type { Metadata } from "next";
3+
import { parseMarkdownContent } from "@/lib/content";
4+
import { TOCNav } from "@/components/navigation/toc-nav";
5+
import { MDXRenderer } from "@/components/mdx-renderer";
6+
import { DocBreadcrumbs } from "@/components/navigation/doc-breadcrumbs";
7+
import { buildDocBreadcrumbs } from "@/lib/breadcrumbs";
8+
9+
export const dynamic = "force-dynamic";
10+
11+
export async function generateMetadata(): Promise<Metadata> {
12+
try {
13+
const content = await parseMarkdownContent(
14+
"guides/strategy/platform-engineering",
15+
);
16+
return {
17+
title:
18+
content.frontMatter.title ?
19+
`${content.frontMatter.title} | MooseStack Documentation`
20+
: "Platform Engineering | MooseStack Documentation",
21+
description:
22+
content.frontMatter.description ||
23+
"Guide to platform engineering strategy with MooseStack",
24+
};
25+
} catch (error) {
26+
return {
27+
title: "Platform Engineering | MooseStack Documentation",
28+
description: "Guide to platform engineering strategy with MooseStack",
29+
};
30+
}
31+
}
32+
33+
export default async function PlatformEngineeringPage() {
34+
let content;
35+
try {
36+
content = await parseMarkdownContent(
37+
"guides/strategy/platform-engineering",
38+
);
39+
} catch (error) {
40+
notFound();
41+
}
42+
43+
const breadcrumbs = buildDocBreadcrumbs(
44+
"guides/strategy/platform-engineering",
45+
typeof content.frontMatter.title === "string" ?
46+
content.frontMatter.title
47+
: undefined,
48+
);
49+
50+
return (
51+
<>
52+
<div className="flex w-full flex-col gap-6 pt-4">
53+
<DocBreadcrumbs items={breadcrumbs} />
54+
<article className="prose prose-slate dark:prose-invert max-w-none w-full min-w-0">
55+
{content.isMDX ?
56+
<MDXRenderer source={content.content} />
57+
: <div dangerouslySetInnerHTML={{ __html: content.content }} />}
58+
</article>
59+
</div>
60+
<TOCNav
61+
headings={content.headings}
62+
helpfulLinks={content.frontMatter.helpfulLinks}
63+
/>
64+
</>
65+
);
66+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { ReactNode } from "react";
2+
import { Suspense } from "react";
3+
import { TemplatesSideNav } from "./templates-side-nav";
4+
import { AnalyticsProvider } from "@/components/analytics-provider";
5+
import { SidebarInset } from "@/components/ui/sidebar";
6+
7+
interface TemplatesLayoutProps {
8+
children: ReactNode;
9+
}
10+
11+
export default async function TemplatesLayout({
12+
children,
13+
}: TemplatesLayoutProps) {
14+
return (
15+
<AnalyticsProvider>
16+
<div className="flex flex-1">
17+
<Suspense fallback={<div className="w-64" />}>
18+
<TemplatesSideNav />
19+
</Suspense>
20+
<SidebarInset>
21+
<div className="container flex-1 pt-6 pb-12 lg:pt-8">
22+
{/* Reserve space for the right TOC on xl+ screens */}
23+
<main className="relative flex flex-col gap-10 xl:grid xl:grid-cols-[minmax(0,1fr)_240px] xl:gap-12">
24+
{children}
25+
</main>
26+
</div>
27+
</SidebarInset>
28+
</div>
29+
</AnalyticsProvider>
30+
);
31+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { notFound } from "next/navigation";
2+
import type { Metadata } from "next";
3+
import { parseMarkdownContent } from "@/lib/content";
4+
import { TOCNav } from "@/components/navigation/toc-nav";
5+
import { MDXRenderer } from "@/components/mdx-renderer";
6+
import { DocBreadcrumbs } from "@/components/navigation/doc-breadcrumbs";
7+
import { buildDocBreadcrumbs } from "@/lib/breadcrumbs";
8+
9+
export const dynamic = "force-dynamic";
10+
11+
export async function generateMetadata(): Promise<Metadata> {
12+
try {
13+
const content = await parseMarkdownContent("templates/index");
14+
return {
15+
title:
16+
content.frontMatter.title ?
17+
`${content.frontMatter.title} | MooseStack Documentation`
18+
: "Templates & Apps | MooseStack Documentation",
19+
description:
20+
content.frontMatter.description ||
21+
"Browse templates and demo apps for MooseStack",
22+
};
23+
} catch (error) {
24+
return {
25+
title: "Templates & Apps | MooseStack Documentation",
26+
description: "Browse templates and demo apps for MooseStack",
27+
};
28+
}
29+
}
30+
31+
export default async function TemplatesPage() {
32+
let content;
33+
try {
34+
content = await parseMarkdownContent("templates/index");
35+
} catch (error) {
36+
notFound();
37+
}
38+
39+
const breadcrumbs = buildDocBreadcrumbs(
40+
"templates/index",
41+
typeof content.frontMatter.title === "string" ?
42+
content.frontMatter.title
43+
: undefined,
44+
);
45+
46+
return (
47+
<>
48+
<div className="flex w-full flex-col gap-6 pt-4">
49+
<DocBreadcrumbs items={breadcrumbs} />
50+
<article className="prose prose-slate dark:prose-invert max-w-none w-full min-w-0">
51+
{content.isMDX ?
52+
<MDXRenderer source={content.content} />
53+
: <div dangerouslySetInnerHTML={{ __html: content.content }} />}
54+
</article>
55+
</div>
56+
<TOCNav
57+
headings={content.headings}
58+
helpfulLinks={content.frontMatter.helpfulLinks}
59+
/>
60+
</>
61+
);
62+
}

0 commit comments

Comments
 (0)