diff --git a/apps/web/.gitignore b/apps/web/.gitignore index 89d26f2..516adc2 100644 --- a/apps/web/.gitignore +++ b/apps/web/.gitignore @@ -28,5 +28,6 @@ yarn-error.log* .env*.local .vercel next-env.d.ts +.dev.vars analytics-data.json diff --git a/apps/web/content/docs/meta.json b/apps/web/content/docs/meta.json index 4a87df8..1b83440 100644 --- a/apps/web/content/docs/meta.json +++ b/apps/web/content/docs/meta.json @@ -1,7 +1,6 @@ { "pages": [ "index", - "---Getting Started---", "installation", "quick-start", "project-structure", diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index d704c19..78c4376 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -30,12 +30,12 @@ const config = { source: "/ingest/decide", destination: "https://us.i.posthog.com/decide", }, - { - source: "/docs/:path*.mdx", - destination: "/llms.mdx/:path*", - }, ]; }, }; export default withMDX(config); + +import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare"; + +initOpenNextCloudflareForDev(); diff --git a/apps/web/public/_headers b/apps/web/public/_headers new file mode 100644 index 0000000..3b460e6 --- /dev/null +++ b/apps/web/public/_headers @@ -0,0 +1,2 @@ +/_next/static/* + Cache-Control: public,max-age=31536000,immutable diff --git a/apps/web/public/schema.json b/apps/web/public/schema.json index 898d990..1e5780f 100644 --- a/apps/web/public/schema.json +++ b/apps/web/public/schema.json @@ -93,6 +93,9 @@ "biome", "husky", "turborepo", + "fumadocs", + "ultracite", + "oxlint", "none" ] }, diff --git a/apps/web/src/app/docs/[[...slug]]/page.tsx b/apps/web/src/app/docs/[[...slug]]/page.tsx index c29f5bf..b35edf1 100644 --- a/apps/web/src/app/docs/[[...slug]]/page.tsx +++ b/apps/web/src/app/docs/[[...slug]]/page.tsx @@ -7,7 +7,6 @@ import { DocsTitle, } from "fumadocs-ui/page"; import { notFound } from "next/navigation"; -import { LLMCopyButton, ViewOptions } from "@/components/ai/page-actions"; import { source } from "@/lib/source"; export default async function Page(props: { @@ -23,13 +22,6 @@ export default async function Page(props: { {page.data.title} {page.data.description} -
- - -
diff --git a/apps/web/src/app/docs/layout.tsx b/apps/web/src/app/docs/layout.tsx index 0316d8d..63b2501 100644 --- a/apps/web/src/app/docs/layout.tsx +++ b/apps/web/src/app/docs/layout.tsx @@ -1,18 +1,22 @@ import { Banner } from "fumadocs-ui/components/banner"; -import { DocsLayout } from "fumadocs-ui/layouts/docs"; +import { DocsLayout, type DocsLayoutProps } from "fumadocs-ui/layouts/docs"; import type { ReactNode } from "react"; -import { baseOptions } from "@/app/layout.config"; +import { baseOptions, links } from "@/app/layout.config"; import { source } from "@/lib/source"; +const docsOptions: DocsLayoutProps = { + ...baseOptions, + tree: source.pageTree, + links: links.filter((link) => "text" in link && link.text !== "Docs"), +}; + export default function Layout({ children }: { children: ReactNode }) { return ( <> ⚠️ WORK IN PROGRESS DONT TAKE REFERENCE!!! - - {children} - + {children} ); } diff --git a/apps/web/src/app/layout.config.tsx b/apps/web/src/app/layout.config.tsx index 08b06b0..3a7484e 100644 --- a/apps/web/src/app/layout.config.tsx +++ b/apps/web/src/app/layout.config.tsx @@ -1,4 +1,4 @@ -import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared"; +import type { BaseLayoutProps, LinkItemType } from "fumadocs-ui/layouts/shared"; import Image from "next/image"; import discordLogo from "@/public/icon/discord.svg"; import npmLogo from "@/public/icon/npm.svg"; @@ -16,6 +16,61 @@ export const logo = ( ); +export const links: LinkItemType[] = [ + { + text: "Docs", + url: "/docs", + active: "nested-url" as const, + }, + { + text: "Builder", + url: "/new", + }, + { + text: "Analytics", + url: "/analytics", + }, + { + text: "Showcase", + url: "/showcase", + }, + { + text: "NPM", + icon: ( + npm + ), + label: "NPM", + type: "icon", + url: "https://www.npmjs.com/package/create-better-t-stack", + external: true, + secondary: true, + }, + { + text: "X", + icon: x, + label: "X", + type: "icon", + url: "https://x.com/amanvarshney01", + external: true, + secondary: true, + }, + { + text: "Discord", + icon: ( + discord + ), + label: "Discord", + type: "icon", + url: "https://discord.gg/ZYsbjpDaM5", + external: true, + secondary: true, + }, +]; + export const baseOptions: BaseLayoutProps = { nav: { title: ( @@ -26,66 +81,7 @@ export const baseOptions: BaseLayoutProps = { ), - // enabled: false, }, - links: [ - { - text: "Docs", - url: "/docs", - }, - { - text: "Builder", - url: "/new", - }, - { - text: "Analytics", - url: "/analytics", - }, - { - text: "Showcase", - url: "/showcase", - }, - { - text: "NPM", - icon: ( - npm - ), - label: "NPM", - type: "icon", - url: "https://www.npmjs.com/package/create-better-t-stack", - external: true, - secondary: true, - }, - { - text: "X", - icon: ( - x - ), - label: "X", - type: "icon", - url: "https://x.com/amanvarshney01", - external: true, - secondary: true, - }, - { - text: "Discord", - icon: ( - discord - ), - label: "Discord", - type: "icon", - url: "https://discord.gg/ZYsbjpDaM5", - external: true, - secondary: true, - }, - ], + links: links, githubUrl: "https://github.com/AmanVarshney01/create-better-t-stack", }; diff --git a/apps/web/src/app/llms-full.txt/route.ts b/apps/web/src/app/llms-full.txt/route.ts deleted file mode 100644 index 7fe521d..0000000 --- a/apps/web/src/app/llms-full.txt/route.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { getLLMText } from "@/lib/get-llm-text"; -import { source } from "@/lib/source"; - -export const revalidate = false; - -export async function GET() { - const scan = source.getPages().map(getLLMText); - const scanned = await Promise.all(scan); - - return new Response(scanned.join("\n\n")); -} diff --git a/apps/web/src/app/llms.mdx/[[...slug]]/route.ts b/apps/web/src/app/llms.mdx/[[...slug]]/route.ts deleted file mode 100644 index 80ebdfb..0000000 --- a/apps/web/src/app/llms.mdx/[[...slug]]/route.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { notFound } from "next/navigation"; -import { type NextRequest, NextResponse } from "next/server"; -import { getLLMText } from "@/lib/get-llm-text"; -import { source } from "@/lib/source"; - -export const revalidate = false; - -export async function GET( - _req: NextRequest, - { params }: { params: Promise<{ slug?: string[] }> }, -) { - const { slug } = await params; - const page = source.getPage(slug); - if (!page) notFound(); - - return new NextResponse(await getLLMText(page)); -} - -export function generateStaticParams() { - return source.generateParams(); -} diff --git a/apps/web/src/components/ai/page-actions.tsx b/apps/web/src/components/ai/page-actions.tsx deleted file mode 100644 index c8e1a89..0000000 --- a/apps/web/src/components/ai/page-actions.tsx +++ /dev/null @@ -1,184 +0,0 @@ -"use client"; -import { cva } from "class-variance-authority"; -import { buttonVariants } from "fumadocs-ui/components/ui/button"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "fumadocs-ui/components/ui/popover"; -import { useCopyButton } from "fumadocs-ui/utils/use-copy-button"; -import { - Check, - ChevronDown, - Copy, - ExternalLinkIcon, - MessageCircleIcon, -} from "lucide-react"; -import { useMemo, useState } from "react"; -import { cn } from "../../../lib/cn"; - -const cache = new Map(); - -export function LLMCopyButton({ - /** - * A URL to fetch the raw Markdown/MDX content of page - */ - markdownUrl, -}: { - markdownUrl: string; -}) { - const [isLoading, setLoading] = useState(false); - const [checked, onClick] = useCopyButton(async () => { - const cached = cache.get(markdownUrl); - if (cached) return navigator.clipboard.writeText(cached); - - setLoading(true); - - try { - await navigator.clipboard.write([ - new ClipboardItem({ - "text/plain": fetch(markdownUrl).then(async (res) => { - const content = await res.text(); - cache.set(markdownUrl, content); - - return content; - }), - }), - ]); - } finally { - setLoading(false); - } - }); - - return ( - - ); -} - -const optionVariants = cva( - "inline-flex items-center gap-2 rounded-lg p-2 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4", -); - -export function ViewOptions({ - markdownUrl, - githubUrl, -}: { - /** - * A URL to the raw Markdown/MDX content of page - */ - markdownUrl: string; - - /** - * Source file URL on GitHub - */ - githubUrl: string; -}) { - const items = useMemo(() => { - const fullMarkdownUrl = - typeof window !== "undefined" - ? new URL(markdownUrl, window.location.origin) - : "loading"; - const q = `Read ${fullMarkdownUrl}, I want to ask questions about it.`; - - return [ - { - title: "Open in GitHub", - href: githubUrl, - icon: ( - - GitHub - - - ), - }, - { - title: "Open in ChatGPT", - href: `https://chatgpt.com/?${new URLSearchParams({ - hints: "search", - q, - })}`, - icon: ( - - OpenAI - - - ), - }, - { - title: "Open in Claude", - href: `https://claude.ai/new?${new URLSearchParams({ - q, - })}`, - icon: ( - - Anthropic - - - ), - }, - { - title: "Open in T3 Chat", - href: `https://t3.chat/new?${new URLSearchParams({ - q, - })}`, - icon: , - }, - ]; - }, [githubUrl, markdownUrl]); - - return ( - - - Open - - - - {items.map((item) => ( - - {item.icon} - {item.title} - - - ))} - - - ); -} diff --git a/apps/web/src/lib/get-llm-text.ts b/apps/web/src/lib/get-llm-text.ts deleted file mode 100644 index 1a5e231..0000000 --- a/apps/web/src/lib/get-llm-text.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { InferPageType } from "fumadocs-core/source"; -import { remarkInclude } from "fumadocs-mdx/config"; -import { remark } from "remark"; -import remarkGfm from "remark-gfm"; -import remarkMdx from "remark-mdx"; -import type { source } from "@/lib/source"; - -const processor = remark() - .use(remarkMdx) - // needed for Fumadocs MDX - .use(remarkInclude) - .use(remarkGfm); - -export async function getLLMText(page: InferPageType) { - const processed = await processor.process({ - path: page.data._file.absolutePath, - value: page.data.content, - }); - - return `# ${page.data.title} -URL: ${page.url} - -${page.data.description} - -${processed.value}`; -} diff --git a/apps/web/wrangler.jsonc b/apps/web/wrangler.jsonc index 52c8095..0e37bd1 100644 --- a/apps/web/wrangler.jsonc +++ b/apps/web/wrangler.jsonc @@ -1,4 +1,5 @@ { + "$schema": "../../node_modules/wrangler/config-schema.json", "main": ".open-next/worker.js", "name": "better-t-stack", "compatibility_date": "2025-07-13", diff --git a/bun.lock b/bun.lock index da8c4f8..5693232 100644 --- a/bun.lock +++ b/bun.lock @@ -14,7 +14,7 @@ }, "apps/cli": { "name": "create-better-t-stack", - "version": "2.27.1", + "version": "2.28.0", "bin": { "create-better-t-stack": "dist/index.js", },