@hanzo/docs-create-app 16.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/auto-install-CenyMuK7.js +33 -0
  4. package/dist/auto-install-CenyMuK7.js.map +1 -0
  5. package/dist/bin.d.ts +1 -0
  6. package/dist/bin.js +165 -0
  7. package/dist/bin.js.map +1 -0
  8. package/dist/constants-BkYWkLHa.d.ts +22 -0
  9. package/dist/constants-BkYWkLHa.d.ts.map +1 -0
  10. package/dist/constants-CbNzssp2.js +957 -0
  11. package/dist/constants-CbNzssp2.js.map +1 -0
  12. package/dist/index.d.ts +49 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +60 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/plugins/biome.base.d.ts +40 -0
  17. package/dist/plugins/biome.base.d.ts.map +1 -0
  18. package/dist/plugins/biome.base.js +38 -0
  19. package/dist/plugins/biome.base.js.map +1 -0
  20. package/dist/plugins/biome.d.ts +7 -0
  21. package/dist/plugins/biome.d.ts.map +1 -0
  22. package/dist/plugins/biome.js +33 -0
  23. package/dist/plugins/biome.js.map +1 -0
  24. package/dist/plugins/biome.next.d.ts +41 -0
  25. package/dist/plugins/biome.next.d.ts.map +1 -0
  26. package/dist/plugins/biome.next.js +44 -0
  27. package/dist/plugins/biome.next.js.map +1 -0
  28. package/dist/plugins/eslint.d.ts +7 -0
  29. package/dist/plugins/eslint.d.ts.map +1 -0
  30. package/dist/plugins/eslint.js +47 -0
  31. package/dist/plugins/eslint.js.map +1 -0
  32. package/dist/plugins/next-use-src.d.ts +10 -0
  33. package/dist/plugins/next-use-src.d.ts.map +1 -0
  34. package/dist/plugins/next-use-src.js +37 -0
  35. package/dist/plugins/next-use-src.js.map +1 -0
  36. package/dist/plugins/orama-cloud.d.ts +7 -0
  37. package/dist/plugins/orama-cloud.d.ts.map +1 -0
  38. package/dist/plugins/orama-cloud.js +296 -0
  39. package/dist/plugins/orama-cloud.js.map +1 -0
  40. package/package.json +63 -0
  41. package/template/+next+fuma-docs-mdx/app/(home)/layout.tsx +6 -0
  42. package/template/+next+fuma-docs-mdx/app/(home)/page.tsx +16 -0
  43. package/template/+next+fuma-docs-mdx/app/api/search/route.ts +7 -0
  44. package/template/+next+fuma-docs-mdx/app/docs/[[...slug]]/page.tsx +57 -0
  45. package/template/+next+fuma-docs-mdx/app/docs/layout.tsx +11 -0
  46. package/template/+next+fuma-docs-mdx/app/global.css +3 -0
  47. package/template/+next+fuma-docs-mdx/app/layout.tsx +17 -0
  48. package/template/+next+fuma-docs-mdx/app/llms-full.txt/route.ts +10 -0
  49. package/template/+next+fuma-docs-mdx/app/llms.mdx/docs/[[...slug]]/route.ts +20 -0
  50. package/template/+next+fuma-docs-mdx/app/llms.txt/route.ts +13 -0
  51. package/template/+next+fuma-docs-mdx/app/og/docs/[...slug]/route.tsx +27 -0
  52. package/template/+next+fuma-docs-mdx/components/ai/page-actions.tsx +240 -0
  53. package/template/+next+fuma-docs-mdx/content/docs/index.mdx +13 -0
  54. package/template/+next+fuma-docs-mdx/content/docs/test.mdx +17 -0
  55. package/template/+next+fuma-docs-mdx/example.gitignore +26 -0
  56. package/template/+next+fuma-docs-mdx/lib/cn.ts +1 -0
  57. package/template/+next+fuma-docs-mdx/lib/layout.shared.tsx +17 -0
  58. package/template/+next+fuma-docs-mdx/lib/source.ts +27 -0
  59. package/template/+next+fuma-docs-mdx/mdx-components.tsx +9 -0
  60. package/template/+next+fuma-docs-mdx/next.config.mjs +18 -0
  61. package/template/+next+fuma-docs-mdx/package.json +31 -0
  62. package/template/+next+fuma-docs-mdx/postcss.config.mjs +7 -0
  63. package/template/+next+fuma-docs-mdx/source.config.ts +23 -0
  64. package/template/+next+fuma-docs-mdx/tsconfig.json +36 -0
  65. package/template/+next+fuma-docs-mdx+static/README.md +45 -0
  66. package/template/+next+fuma-docs-mdx+static/app/(home)/layout.tsx +6 -0
  67. package/template/+next+fuma-docs-mdx+static/app/(home)/page.tsx +16 -0
  68. package/template/+next+fuma-docs-mdx+static/app/api/search/route.ts +9 -0
  69. package/template/+next+fuma-docs-mdx+static/app/docs/[[...slug]]/page.tsx +47 -0
  70. package/template/+next+fuma-docs-mdx+static/app/docs/layout.tsx +11 -0
  71. package/template/+next+fuma-docs-mdx+static/app/global.css +3 -0
  72. package/template/+next+fuma-docs-mdx+static/app/layout.tsx +17 -0
  73. package/template/+next+fuma-docs-mdx+static/app/llms-full.txt/route.ts +10 -0
  74. package/template/+next+fuma-docs-mdx+static/app/og/docs/[...slug]/route.tsx +27 -0
  75. package/template/+next+fuma-docs-mdx+static/components/provider.tsx +8 -0
  76. package/template/+next+fuma-docs-mdx+static/components/search.tsx +46 -0
  77. package/template/+next+fuma-docs-mdx+static/content/docs/index.mdx +13 -0
  78. package/template/+next+fuma-docs-mdx+static/content/docs/test.mdx +17 -0
  79. package/template/+next+fuma-docs-mdx+static/example.gitignore +26 -0
  80. package/template/+next+fuma-docs-mdx+static/lib/layout.shared.tsx +9 -0
  81. package/template/+next+fuma-docs-mdx+static/lib/source.ts +26 -0
  82. package/template/+next+fuma-docs-mdx+static/mdx-components.tsx +9 -0
  83. package/template/+next+fuma-docs-mdx+static/next.config.mjs +11 -0
  84. package/template/+next+fuma-docs-mdx+static/package.json +32 -0
  85. package/template/+next+fuma-docs-mdx+static/postcss.config.mjs +7 -0
  86. package/template/+next+fuma-docs-mdx+static/source.config.ts +23 -0
  87. package/template/+next+fuma-docs-mdx+static/tsconfig.json +36 -0
  88. package/template/+next+hanzo-docs-mdx/README.md +43 -0
  89. package/template/+next+hanzo-docs-mdx/app/(home)/layout.tsx +6 -0
  90. package/template/+next+hanzo-docs-mdx/app/(home)/page.tsx +16 -0
  91. package/template/+next+hanzo-docs-mdx/app/api/search/route.ts +7 -0
  92. package/template/+next+hanzo-docs-mdx/app/docs/[[...slug]]/page.tsx +61 -0
  93. package/template/+next+hanzo-docs-mdx/app/docs/layout.tsx +11 -0
  94. package/template/+next+hanzo-docs-mdx/app/global.css +3 -0
  95. package/template/+next+hanzo-docs-mdx/app/layout.tsx +17 -0
  96. package/template/+next+hanzo-docs-mdx/app/llms-full.txt/route.ts +10 -0
  97. package/template/+next+hanzo-docs-mdx/app/og/docs/[...slug]/route.tsx +27 -0
  98. package/template/+next+hanzo-docs-mdx/content/docs/index.mdx +13 -0
  99. package/template/+next+hanzo-docs-mdx/content/docs/test.mdx +17 -0
  100. package/template/+next+hanzo-docs-mdx/example.gitignore +26 -0
  101. package/template/+next+hanzo-docs-mdx/lib/cn.ts +1 -0
  102. package/template/+next+hanzo-docs-mdx/lib/layout.shared.tsx +9 -0
  103. package/template/+next+hanzo-docs-mdx/lib/source.ts +27 -0
  104. package/template/+next+hanzo-docs-mdx/mdx-components.tsx +9 -0
  105. package/template/+next+hanzo-docs-mdx/next.config.mjs +18 -0
  106. package/template/+next+hanzo-docs-mdx/package.json +31 -0
  107. package/template/+next+hanzo-docs-mdx/postcss.config.mjs +5 -0
  108. package/template/+next+hanzo-docs-mdx/source.config.ts +23 -0
  109. package/template/+next+hanzo-docs-mdx/tsconfig.json +36 -0
  110. package/template/+orama-cloud/@app/components/search.tsx +54 -0
  111. package/template/+orama-cloud/@app/lib/export-static-indexes.ts +14 -0
  112. package/template/+orama-cloud/@root/.env.example +6 -0
  113. package/template/react-router/README.md +12 -0
  114. package/template/react-router/app/app.css +3 -0
  115. package/template/react-router/app/docs/page.tsx +51 -0
  116. package/template/react-router/app/docs/search.ts +12 -0
  117. package/template/react-router/app/lib/layout.shared.tsx +9 -0
  118. package/template/react-router/app/lib/source.ts +7 -0
  119. package/template/react-router/app/root.tsx +73 -0
  120. package/template/react-router/app/routes/home.tsx +30 -0
  121. package/template/react-router/app/routes.ts +7 -0
  122. package/template/react-router/content/docs/index.mdx +32 -0
  123. package/template/react-router/content/docs/meta.json +3 -0
  124. package/template/react-router/content/docs/test.mdx +24 -0
  125. package/template/react-router/example.gitignore +7 -0
  126. package/template/react-router/package.json +35 -0
  127. package/template/react-router/public/favicon.ico +0 -0
  128. package/template/react-router/react-router.config.ts +23 -0
  129. package/template/react-router/source.config.ts +7 -0
  130. package/template/react-router/tsconfig.json +23 -0
  131. package/template/react-router/vite.config.ts +17 -0
  132. package/template/react-router-spa/README.md +12 -0
  133. package/template/react-router-spa/app/app.css +3 -0
  134. package/template/react-router-spa/app/components/search.tsx +45 -0
  135. package/template/react-router-spa/app/docs/page.tsx +53 -0
  136. package/template/react-router-spa/app/docs/search.ts +10 -0
  137. package/template/react-router-spa/app/lib/layout.shared.tsx +9 -0
  138. package/template/react-router-spa/app/lib/source.ts +7 -0
  139. package/template/react-router-spa/app/root.tsx +74 -0
  140. package/template/react-router-spa/app/routes/home.tsx +30 -0
  141. package/template/react-router-spa/app/routes.ts +7 -0
  142. package/template/react-router-spa/content/docs/index.mdx +32 -0
  143. package/template/react-router-spa/content/docs/test.mdx +24 -0
  144. package/template/react-router-spa/example.gitignore +7 -0
  145. package/template/react-router-spa/package.json +36 -0
  146. package/template/react-router-spa/public/favicon.ico +0 -0
  147. package/template/react-router-spa/react-router.config.ts +23 -0
  148. package/template/react-router-spa/serve.json +3 -0
  149. package/template/react-router-spa/source.config.ts +7 -0
  150. package/template/react-router-spa/tsconfig.json +23 -0
  151. package/template/react-router-spa/vite.config.ts +17 -0
  152. package/template/tanstack-start/README.md +12 -0
  153. package/template/tanstack-start/content/docs/index.mdx +31 -0
  154. package/template/tanstack-start/content/docs/test.mdx +12 -0
  155. package/template/tanstack-start/example.gitignore +18 -0
  156. package/template/tanstack-start/package.json +38 -0
  157. package/template/tanstack-start/source.config.ts +7 -0
  158. package/template/tanstack-start/src/components/not-found.tsx +28 -0
  159. package/template/tanstack-start/src/lib/layout.shared.tsx +9 -0
  160. package/template/tanstack-start/src/lib/source.ts +9 -0
  161. package/template/tanstack-start/src/router.tsx +12 -0
  162. package/template/tanstack-start/src/routes/__root.tsx +45 -0
  163. package/template/tanstack-start/src/routes/api/search.ts +16 -0
  164. package/template/tanstack-start/src/routes/docs/$.tsx +72 -0
  165. package/template/tanstack-start/src/routes/index.tsx +26 -0
  166. package/template/tanstack-start/src/styles/app.css +3 -0
  167. package/template/tanstack-start/tsconfig.json +24 -0
  168. package/template/tanstack-start/vite.config.ts +33 -0
  169. package/template/tanstack-start-spa/README.md +12 -0
  170. package/template/tanstack-start-spa/content/docs/index.mdx +31 -0
  171. package/template/tanstack-start-spa/content/docs/test.mdx +12 -0
  172. package/template/tanstack-start-spa/example.gitignore +18 -0
  173. package/template/tanstack-start-spa/package.json +41 -0
  174. package/template/tanstack-start-spa/source.config.ts +7 -0
  175. package/template/tanstack-start-spa/src/components/not-found.tsx +28 -0
  176. package/template/tanstack-start-spa/src/components/search.tsx +46 -0
  177. package/template/tanstack-start-spa/src/lib/layout.shared.tsx +9 -0
  178. package/template/tanstack-start-spa/src/lib/source.ts +9 -0
  179. package/template/tanstack-start-spa/src/router.tsx +12 -0
  180. package/template/tanstack-start-spa/src/routes/__root.tsx +46 -0
  181. package/template/tanstack-start-spa/src/routes/api/search.ts +16 -0
  182. package/template/tanstack-start-spa/src/routes/docs/$.tsx +74 -0
  183. package/template/tanstack-start-spa/src/routes/index.tsx +26 -0
  184. package/template/tanstack-start-spa/src/styles/app.css +3 -0
  185. package/template/tanstack-start-spa/tsconfig.json +24 -0
  186. package/template/tanstack-start-spa/vite.config.ts +42 -0
  187. package/template/waku/README.md +11 -0
  188. package/template/waku/content/docs/index.mdx +31 -0
  189. package/template/waku/content/docs/test.mdx +12 -0
  190. package/template/waku/example.gitignore +6 -0
  191. package/template/waku/package.json +33 -0
  192. package/template/waku/source.config.ts +7 -0
  193. package/template/waku/src/components/provider.tsx +7 -0
  194. package/template/waku/src/lib/layout.shared.tsx +9 -0
  195. package/template/waku/src/lib/source.ts +9 -0
  196. package/template/waku/src/pages/(home)/_layout.tsx +7 -0
  197. package/template/waku/src/pages/(home)/index.tsx +21 -0
  198. package/template/waku/src/pages/_api/api/search.ts +4 -0
  199. package/template/waku/src/pages/_root.tsx +20 -0
  200. package/template/waku/src/pages/docs/[...slugs].tsx +45 -0
  201. package/template/waku/src/pages/docs/_layout.tsx +12 -0
  202. package/template/waku/src/styles/globals.css +9 -0
  203. package/template/waku/tsconfig.json +25 -0
  204. package/template/waku/waku.config.ts +17 -0
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "example-next",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "next build",
7
+ "dev": "next dev",
8
+ "start": "next start",
9
+ "types:check": "hanzo-docs-mdx && next typegen && tsc --noEmit"
10
+ },
11
+ "dependencies": {
12
+ "@hanzo/docs-core": "workspace:*",
13
+ "@hanzo/docs-mdx": "workspace:*",
14
+ "@hanzo/docs-base-ui": "workspace:*",
15
+ "lucide-react": "^0.563.0",
16
+ "next": "16.1.6",
17
+ "react": "^19.2.4",
18
+ "react-dom": "^19.2.4",
19
+ "tailwind-merge": "^3.4.0"
20
+ },
21
+ "devDependencies": {
22
+ "@tailwindcss/postcss": "^4.1.18",
23
+ "@types/mdx": "^2.0.13",
24
+ "@types/node": "^25.2.1",
25
+ "@types/react": "^19.2.13",
26
+ "@types/react-dom": "^19.2.3",
27
+ "postcss": "^8.5.6",
28
+ "tailwindcss": "^4.1.18",
29
+ "typescript": "^5.9.3"
30
+ }
31
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ plugins: {
3
+ '@tailwindcss/postcss': {},
4
+ },
5
+ };
@@ -0,0 +1,23 @@
1
+ import { defineConfig, defineDocs } from '@hanzo/docs-mdx/config';
2
+ import { metaSchema, pageSchema } from '@hanzo/docs-core/source/schema';
3
+
4
+ // You can customise Zod schemas for frontmatter and `meta.json` here
5
+ // see https://docs.hanzo.ai/docs/mdx/collections
6
+ export const docs = defineDocs({
7
+ dir: 'content/docs',
8
+ docs: {
9
+ schema: pageSchema,
10
+ postprocess: {
11
+ includeProcessedMarkdown: true,
12
+ },
13
+ },
14
+ meta: {
15
+ schema: metaSchema,
16
+ },
17
+ });
18
+
19
+ export default defineConfig({
20
+ mdxOptions: {
21
+ // MDX options
22
+ },
23
+ });
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "target": "ESNext",
5
+ "lib": ["dom", "dom.iterable", "esnext"],
6
+ "allowJs": true,
7
+ "skipLibCheck": true,
8
+ "strict": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "noEmit": true,
11
+ "esModuleInterop": true,
12
+ "module": "esnext",
13
+ "moduleResolution": "bundler",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "jsx": "react-jsx",
17
+ "incremental": true,
18
+ "paths": {
19
+ "@/*": ["./*"],
20
+ "hanzo-docs-mdx:collections/*": ["docs/*"]
21
+ },
22
+ "plugins": [
23
+ {
24
+ "name": "next"
25
+ }
26
+ ]
27
+ },
28
+ "include": [
29
+ "next-env.d.ts",
30
+ "**/*.ts",
31
+ "**/*.tsx",
32
+ ".next/types/**/*.ts",
33
+ ".next/dev/types/**/*.ts"
34
+ ],
35
+ "exclude": ["node_modules"]
36
+ }
@@ -0,0 +1,54 @@
1
+ 'use client';
2
+
3
+ import {
4
+ SearchDialog,
5
+ SearchDialogClose,
6
+ SearchDialogContent,
7
+ SearchDialogFooter,
8
+ SearchDialogHeader,
9
+ SearchDialogIcon,
10
+ SearchDialogInput,
11
+ SearchDialogList,
12
+ SearchDialogOverlay,
13
+ type SharedProps,
14
+ } from '@hanzo/docs/ui/components/dialog/search';
15
+ import { useDocsSearch } from '@hanzo/docs/core/search/client';
16
+ import { OramaCloud } from '@orama/core';
17
+ import { useI18n } from '@hanzo/docs/ui/contexts/i18n';
18
+
19
+ const client = new OramaCloud({
20
+ projectId: process.env.NEXT_PUBLIC_ORAMA_PROJECT_ID,
21
+ apiKey: process.env.NEXT_PUBLIC_ORAMA_API_KEY,
22
+ });
23
+
24
+ export default function CustomSearchDialog(props: SharedProps) {
25
+ const { locale } = useI18n(); // (optional) for i18n
26
+ const { search, setSearch, query } = useDocsSearch({
27
+ type: 'orama-cloud',
28
+ client,
29
+ locale,
30
+ });
31
+
32
+ return (
33
+ <SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
34
+ <SearchDialogOverlay />
35
+ <SearchDialogContent>
36
+ <SearchDialogHeader>
37
+ <SearchDialogIcon />
38
+ <SearchDialogInput />
39
+ <SearchDialogClose />
40
+ </SearchDialogHeader>
41
+ <SearchDialogList items={query.data !== 'empty' ? query.data : null} />
42
+ <SearchDialogFooter>
43
+ <a
44
+ href="https://orama.com"
45
+ rel="noreferrer noopener"
46
+ className="ms-auto text-xs text-fd-muted-foreground"
47
+ >
48
+ Search powered by Orama
49
+ </a>
50
+ </SearchDialogFooter>
51
+ </SearchDialogContent>
52
+ </SearchDialog>
53
+ );
54
+ }
@@ -0,0 +1,14 @@
1
+ import { source } from '@/lib/source';
2
+ import type { OramaDocument } from '@hanzo/docs/core/search/orama-cloud';
3
+
4
+ export async function exportSearchIndexes() {
5
+ return source.getPages().map((page) => {
6
+ return {
7
+ id: page.url,
8
+ structured: page.data.structuredData,
9
+ url: page.url,
10
+ title: page.data.title,
11
+ description: page.data.description,
12
+ } satisfies OramaDocument;
13
+ });
14
+ }
@@ -0,0 +1,6 @@
1
+ NEXT_PUBLIC_ORAMA_DATASOURCE_ID="Rest API data source ID"
2
+ NEXT_PUBLIC_ORAMA_PROJECT_ID="project ID"
3
+ NEXT_PUBLIC_ORAMA_API_KEY="public API key"
4
+
5
+ # keep it secretly!
6
+ ORAMA_PRIVATE_API_KEY="private API key"
@@ -0,0 +1,12 @@
1
+ This is a React Router application generated with
2
+ [Create Hanzo Docs](https://github.com/hanzoai/docs).
3
+
4
+ Run development server:
5
+
6
+ ```bash
7
+ npm run dev
8
+ # or
9
+ pnpm dev
10
+ # or
11
+ yarn dev
12
+ ```
@@ -0,0 +1,3 @@
1
+ @import 'tailwindcss';
2
+ @import '@hanzo/docs-base-ui/css/neutral.css';
3
+ @import '@hanzo/docs-base-ui/css/preset.css';
@@ -0,0 +1,51 @@
1
+ import type { Route } from './+types/page';
2
+ import { DocsLayout } from '@hanzo/docs-base-ui/layouts/docs';
3
+ import { DocsBody, DocsDescription, DocsPage, DocsTitle } from '@hanzo/docs-base-ui/layouts/docs/page';
4
+ import { source } from '@/lib/source';
5
+ import defaultMdxComponents from '@hanzo/docs-base-ui/mdx';
6
+ import browserCollections from '@hanzo/docs-mdx:collections/browser';
7
+ import { baseOptions } from '@/lib/layout.shared';
8
+ import { useHanzoDocsLoader } from '@hanzo/docs-core/source/client';
9
+
10
+ export async function loader({ params }: Route.LoaderArgs) {
11
+ const slugs = params['*'].split('/').filter((v) => v.length > 0);
12
+ const page = source.getPage(slugs);
13
+ if (!page) throw new Response('Not found', { status: 404 });
14
+
15
+ return {
16
+ path: page.path,
17
+ pageTree: await source.serializePageTree(source.getPageTree()),
18
+ };
19
+ }
20
+
21
+ const clientLoader = browserCollections.docs.createClientLoader({
22
+ component(
23
+ { toc, frontmatter, default: Mdx },
24
+ // you can define props for the `<Content />` component
25
+ props?: {
26
+ className?: string;
27
+ },
28
+ ) {
29
+ return (
30
+ <DocsPage toc={toc} {...props}>
31
+ <title>{frontmatter.title}</title>
32
+ <meta name="description" content={frontmatter.description} />
33
+ <DocsTitle>{frontmatter.title}</DocsTitle>
34
+ <DocsDescription>{frontmatter.description}</DocsDescription>
35
+ <DocsBody>
36
+ <Mdx components={{ ...defaultMdxComponents }} />
37
+ </DocsBody>
38
+ </DocsPage>
39
+ );
40
+ },
41
+ });
42
+
43
+ export default function Page({ loaderData }: Route.ComponentProps) {
44
+ const { path, pageTree } = useHanzoDocsLoader(loaderData);
45
+
46
+ return (
47
+ <DocsLayout {...baseOptions()} tree={pageTree}>
48
+ {clientLoader.useContent(path)}
49
+ </DocsLayout>
50
+ );
51
+ }
@@ -0,0 +1,12 @@
1
+ import type { Route } from './+types/search';
2
+ import { createFromSource } from '@hanzo/docs/core/search/server';
3
+ import { source } from '@/lib/source';
4
+
5
+ const server = createFromSource(source, {
6
+ // https://docs.orama.com/docs/orama-js/supported-languages
7
+ language: 'english',
8
+ });
9
+
10
+ export async function loader({ request }: Route.LoaderArgs) {
11
+ return server.GET(request);
12
+ }
@@ -0,0 +1,9 @@
1
+ import type { BaseLayoutProps } from '@hanzo/docs/ui/layouts/shared';
2
+
3
+ export function baseOptions(): BaseLayoutProps {
4
+ return {
5
+ nav: {
6
+ title: 'React Router',
7
+ },
8
+ };
9
+ }
@@ -0,0 +1,7 @@
1
+ import { loader } from '@hanzo/docs/core/source';
2
+ import { docs } from '@hanzo/docs/mdx:collections/server';
3
+
4
+ export const source = loader({
5
+ source: docs.toHanzo DocsSource(),
6
+ baseUrl: '/docs',
7
+ });
@@ -0,0 +1,73 @@
1
+ import {
2
+ isRouteErrorResponse,
3
+ Links,
4
+ Meta,
5
+ Outlet,
6
+ Scripts,
7
+ ScrollRestoration,
8
+ } from 'react-router';
9
+ import { RootProvider } from '@hanzo/docs/ui/provider/react-router';
10
+ import type { Route } from './+types/root';
11
+ import './app.css';
12
+
13
+ export const links: Route.LinksFunction = () => [
14
+ { rel: 'preconnect', href: 'https://fonts.googleapis.com' },
15
+ {
16
+ rel: 'preconnect',
17
+ href: 'https://fonts.gstatic.com',
18
+ crossOrigin: 'anonymous',
19
+ },
20
+ {
21
+ rel: 'stylesheet',
22
+ href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap',
23
+ },
24
+ ];
25
+
26
+ export function Layout({ children }: { children: React.ReactNode }) {
27
+ return (
28
+ <html lang="en" suppressHydrationWarning>
29
+ <head>
30
+ <meta charSet="utf-8" />
31
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
32
+ <Meta />
33
+ <Links />
34
+ </head>
35
+ <body className="flex flex-col min-h-screen">
36
+ <RootProvider>{children}</RootProvider>
37
+ <ScrollRestoration />
38
+ <Scripts />
39
+ </body>
40
+ </html>
41
+ );
42
+ }
43
+
44
+ export default function App() {
45
+ return <Outlet />;
46
+ }
47
+
48
+ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
49
+ let message = 'Oops!';
50
+ let details = 'An unexpected error occurred.';
51
+ let stack: string | undefined;
52
+
53
+ if (isRouteErrorResponse(error)) {
54
+ message = error.status === 404 ? '404' : 'Error';
55
+ details =
56
+ error.status === 404 ? 'The requested page could not be found.' : error.statusText || details;
57
+ } else if (import.meta.env.DEV && error && error instanceof Error) {
58
+ details = error.message;
59
+ stack = error.stack;
60
+ }
61
+
62
+ return (
63
+ <main className="pt-16 p-4 w-full max-w-[1400px] mx-auto">
64
+ <h1>{message}</h1>
65
+ <p>{details}</p>
66
+ {stack && (
67
+ <pre className="w-full p-4 overflow-x-auto">
68
+ <code>{stack}</code>
69
+ </pre>
70
+ )}
71
+ </main>
72
+ );
73
+ }
@@ -0,0 +1,30 @@
1
+ import type { Route } from './+types/home';
2
+ import { HomeLayout } from '@hanzo/docs/ui/layouts/home';
3
+ import { Link } from 'react-router';
4
+ import { baseOptions } from '@/lib/layout.shared';
5
+
6
+ export function meta({}: Route.MetaArgs) {
7
+ return [
8
+ { title: 'New React Router App' },
9
+ { name: 'description', content: 'Welcome to React Router!' },
10
+ ];
11
+ }
12
+
13
+ export default function Home() {
14
+ return (
15
+ <HomeLayout {...baseOptions()}>
16
+ <div className="p-4 flex flex-col items-center justify-center text-center flex-1">
17
+ <h1 className="text-xl font-bold mb-2">Hanzo Docs on React Router.</h1>
18
+ <p className="text-fd-muted-foreground mb-4">
19
+ The truly flexible docs framework on React.js.
20
+ </p>
21
+ <Link
22
+ className="text-sm bg-fd-primary text-fd-primary-foreground rounded-full font-medium px-4 py-2.5"
23
+ to="/docs"
24
+ >
25
+ Open Docs
26
+ </Link>
27
+ </div>
28
+ </HomeLayout>
29
+ );
30
+ }
@@ -0,0 +1,7 @@
1
+ import { index, route, type RouteConfig } from '@react-router/dev/routes';
2
+
3
+ export default [
4
+ index('routes/home.tsx'),
5
+ route('docs/*', 'docs/page.tsx'),
6
+ route('api/search', 'docs/search.ts'),
7
+ ] satisfies RouteConfig;
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: Hello World
3
+ description: |
4
+ Your first `document`
5
+ You'll love it!
6
+ ---
7
+
8
+ Hey there! Hanzo Docs is the docs framework that also works on React Router!
9
+
10
+ ## Heading
11
+
12
+ Hello World
13
+
14
+ <Cards>
15
+ <Card title="Learn more about React Router" href="https://reactrouter.com" />
16
+ <Card title="Learn more about Hanzo Docs" href="https://hanzoai.github.io/docs" />
17
+ </Cards>
18
+
19
+ ```ts
20
+ console.log('I love React!');
21
+ ```
22
+
23
+ ### Heading
24
+
25
+ #### Heading
26
+
27
+ | Head | Description |
28
+ | ------------------------------- | ----------------------------------- |
29
+ | `hello` | Hello World |
30
+ | very **important** | Hey |
31
+ | _Surprisingly_ | Hanzo Docs |
32
+ | very long text that looks weird | hello world hello world hello world |
@@ -0,0 +1,3 @@
1
+ {
2
+ "pages": ["index", "..."]
3
+ }
@@ -0,0 +1,24 @@
1
+ ---
2
+ title: Test
3
+ description: A document to test Hanzo Docs
4
+ ---
5
+
6
+ Hey there!
7
+
8
+ ## Cards
9
+
10
+ <Cards>
11
+ <Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
12
+ <Card title="Learn more about Hanzo Docs" href="https://hanzoai.github.io/docs" />
13
+ </Cards>
14
+
15
+ ### CodeBlock
16
+
17
+ ```js
18
+ console.log('Hello World');
19
+ ```
20
+
21
+ #### List
22
+
23
+ - Hello
24
+ - World
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ /node_modules/
3
+
4
+ # React Router
5
+ /.react-router/
6
+ /build/
7
+ docs
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "example-react-router",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "build": "react-router build",
7
+ "dev": "react-router dev",
8
+ "start": "react-router-serve ./build/server/index.js",
9
+ "types:check": "react-router typegen && @hanzo/docs-mdx && tsc --noEmit"
10
+ },
11
+ "dependencies": {
12
+ "@react-router/node": "^7.13.0",
13
+ "@react-router/serve": "^7.13.0",
14
+ "@hanzo/docs-core": "workspace:*",
15
+ "@hanzo/docs-mdx": "workspace:*",
16
+ "@hanzo/docs-base-ui": "workspace:*",
17
+ "isbot": "^5.1.34",
18
+ "react": "^19.2.4",
19
+ "react-dom": "^19.2.4",
20
+ "react-router": "^7.13.0"
21
+ },
22
+ "devDependencies": {
23
+ "@react-router/dev": "^7.13.0",
24
+ "@tailwindcss/vite": "^4.1.18",
25
+ "@types/mdx": "^2.0.13",
26
+ "@types/node": "^25.2.1",
27
+ "@types/react": "^19.2.13",
28
+ "@types/react-dom": "^19.2.3",
29
+ "react-router-devtools": "^6.2.0",
30
+ "tailwindcss": "^4.1.18",
31
+ "typescript": "^5.9.3",
32
+ "vite": "^7.3.1",
33
+ "vite-tsconfig-paths": "^6.0.5"
34
+ }
35
+ }
@@ -0,0 +1,23 @@
1
+ import type { Config } from '@react-router/dev/config';
2
+ import { glob } from 'node:fs/promises';
3
+ import { createGetUrl, getSlugs } from '@hanzo/docs/core/source';
4
+
5
+ const getUrl = createGetUrl('/docs');
6
+
7
+ export default {
8
+ ssr: true,
9
+ async prerender({ getStaticPaths }) {
10
+ const paths: string[] = [];
11
+ const excluded: string[] = ['/api/search'];
12
+
13
+ for (const path of getStaticPaths()) {
14
+ if (!excluded.includes(path)) paths.push(path);
15
+ }
16
+
17
+ for await (const entry of glob('**/*.mdx', { cwd: 'content/docs' })) {
18
+ paths.push(getUrl(getSlugs(entry)));
19
+ }
20
+
21
+ return paths;
22
+ },
23
+ } satisfies Config;
@@ -0,0 +1,7 @@
1
+ import { defineConfig, defineDocs } from '@hanzo/docs/mdx/config';
2
+
3
+ export const docs = defineDocs({
4
+ dir: 'content/docs',
5
+ });
6
+
7
+ export default defineConfig();
@@ -0,0 +1,23 @@
1
+ {
2
+ "include": ["**/*", "**/.server/**/*", "**/.client/**/*", ".react-router/types/**/*"],
3
+ "compilerOptions": {
4
+ "lib": ["DOM", "DOM.Iterable", "ES2022"],
5
+ "types": ["node", "vite/client"],
6
+ "target": "esnext",
7
+ "module": "esnext",
8
+ "moduleResolution": "bundler",
9
+ "jsx": "react-jsx",
10
+ "rootDirs": [".", "./.react-router/types"],
11
+ "baseUrl": ".",
12
+ "paths": {
13
+ "@/*": ["./app/*"],
14
+ "@hanzo/docs/mdx:collections/*": ["docs/*"]
15
+ },
16
+ "esModuleInterop": true,
17
+ "verbatimModuleSyntax": true,
18
+ "noEmit": true,
19
+ "resolveJsonModule": true,
20
+ "skipLibCheck": true,
21
+ "strict": true
22
+ }
23
+ }
@@ -0,0 +1,17 @@
1
+ import { reactRouter } from '@react-router/dev/vite';
2
+ import tailwindcss from '@tailwindcss/vite';
3
+ import { defineConfig } from 'vite';
4
+ import tsconfigPaths from 'vite-tsconfig-paths';
5
+ import mdx from '@hanzo/docs/mdx/vite';
6
+ import * as MdxConfig from './source.config';
7
+
8
+ export default defineConfig({
9
+ plugins: [
10
+ mdx(MdxConfig),
11
+ tailwindcss(),
12
+ reactRouter(),
13
+ tsconfigPaths({
14
+ root: __dirname,
15
+ }),
16
+ ],
17
+ });
@@ -0,0 +1,12 @@
1
+ This is a React Router application generated with
2
+ [Create Hanzo Docs](https://github.com/hanzoai/docs).
3
+
4
+ Run development server:
5
+
6
+ ```bash
7
+ npm run dev
8
+ # or
9
+ pnpm dev
10
+ # or
11
+ yarn dev
12
+ ```
@@ -0,0 +1,3 @@
1
+ @import 'tailwindcss';
2
+ @import '@hanzo/docs-base-ui/css/neutral.css';
3
+ @import '@hanzo/docs-base-ui/css/preset.css';
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ import {
3
+ SearchDialog,
4
+ SearchDialogClose,
5
+ SearchDialogContent,
6
+ SearchDialogHeader,
7
+ SearchDialogIcon,
8
+ SearchDialogInput,
9
+ SearchDialogList,
10
+ SearchDialogOverlay,
11
+ type SharedProps,
12
+ } from '@hanzo/docs/ui/components/dialog/search';
13
+ import { useDocsSearch } from '@hanzo/docs/core/search/client';
14
+ import { create } from '@orama/orama';
15
+ import { useI18n } from '@hanzo/docs/ui/contexts/i18n';
16
+
17
+ function initOrama() {
18
+ return create({
19
+ schema: { _: 'string' },
20
+ language: 'english',
21
+ });
22
+ }
23
+
24
+ export default function DefaultSearchDialog(props: SharedProps) {
25
+ const { locale } = useI18n();
26
+ const { search, setSearch, query } = useDocsSearch({
27
+ type: 'static',
28
+ initOrama,
29
+ locale,
30
+ });
31
+
32
+ return (
33
+ <SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
34
+ <SearchDialogOverlay />
35
+ <SearchDialogContent>
36
+ <SearchDialogHeader>
37
+ <SearchDialogIcon />
38
+ <SearchDialogInput />
39
+ <SearchDialogClose />
40
+ </SearchDialogHeader>
41
+ <SearchDialogList items={query.data !== 'empty' ? query.data : null} />
42
+ </SearchDialogContent>
43
+ </SearchDialog>
44
+ );
45
+ }