Skip to content

Commit f6e7beb

Browse files
Initial commit from Create Fumadocs App
0 parents  commit f6e7beb

21 files changed

+6648
-0
lines changed

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next/core-web-vitals", "next/typescript"]
3+
}

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# deps
2+
/node_modules
3+
4+
# generated content
5+
.contentlayer
6+
.content-collections
7+
.source
8+
9+
# test & build
10+
/coverage
11+
/.next/
12+
/out/
13+
/build
14+
*.tsbuildinfo
15+
16+
# misc
17+
.DS_Store
18+
*.pem
19+
/.pnp
20+
.pnp.js
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# others
26+
.env*.local
27+
.vercel
28+
next-env.d.ts

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# nextify
2+
3+
This is a Next.js application generated with
4+
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
5+
6+
Run development server:
7+
8+
```bash
9+
npm run dev
10+
# or
11+
pnpm dev
12+
# or
13+
yarn dev
14+
```
15+
16+
Open http://localhost:3000 with your browser to see the result.
17+
18+
## Learn More
19+
20+
To learn more about Next.js and Fumadocs, take a look at the following
21+
resources:
22+
23+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
24+
features and API.
25+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
26+
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs

app/(home)/layout.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { ReactNode } from 'react';
2+
import { HomeLayout } from 'fumadocs-ui/layouts/home';
3+
import { baseOptions } from '@/app/layout.config';
4+
5+
export default function Layout({
6+
children,
7+
}: {
8+
children: ReactNode;
9+
}): React.ReactElement {
10+
return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
11+
}

app/(home)/page.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Link from 'next/link';
2+
3+
export default function HomePage() {
4+
return (
5+
<main className="flex flex-1 flex-col justify-center text-center">
6+
<h1 className="mb-4 text-2xl font-bold">Hello World</h1>
7+
<p className="text-fd-muted-foreground">
8+
You can open{' '}
9+
<Link
10+
href="/docs"
11+
className="text-fd-foreground font-semibold underline"
12+
>
13+
/docs
14+
</Link>{' '}
15+
and see the documentation.
16+
</p>
17+
</main>
18+
);
19+
}

app/api/search/route.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { source } from '@/lib/source';
2+
import { createFromSource } from 'fumadocs-core/search/server';
3+
4+
export const { GET } = createFromSource(source);

app/docs/[[...slug]]/page.tsx

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { source } from '@/lib/source';
2+
import {
3+
DocsPage,
4+
DocsBody,
5+
DocsDescription,
6+
DocsTitle,
7+
} from 'fumadocs-ui/page';
8+
import { notFound } from 'next/navigation';
9+
import defaultMdxComponents from 'fumadocs-ui/mdx';
10+
11+
export default async function Page(props: {
12+
params: Promise<{ slug?: string[] }>;
13+
}) {
14+
const params = await props.params;
15+
const page = source.getPage(params.slug);
16+
if (!page) notFound();
17+
18+
const MDX = page.data.body;
19+
20+
return (
21+
<DocsPage toc={page.data.toc} full={page.data.full}>
22+
<DocsTitle>{page.data.title}</DocsTitle>
23+
<DocsDescription>{page.data.description}</DocsDescription>
24+
<DocsBody>
25+
<MDX components={{ ...defaultMdxComponents }} />
26+
</DocsBody>
27+
</DocsPage>
28+
);
29+
}
30+
31+
export async function generateStaticParams() {
32+
return source.generateParams();
33+
}
34+
35+
export async function generateMetadata(props: {
36+
params: Promise<{ slug?: string[] }>;
37+
}) {
38+
const params = await props.params;
39+
const page = source.getPage(params.slug);
40+
if (!page) notFound();
41+
42+
return {
43+
title: page.data.title,
44+
description: page.data.description,
45+
};
46+
}

app/docs/layout.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
2+
import type { ReactNode } from 'react';
3+
import { baseOptions } from '@/app/layout.config';
4+
import { source } from '@/lib/source';
5+
6+
export default function Layout({ children }: { children: ReactNode }) {
7+
return (
8+
<DocsLayout tree={source.pageTree} {...baseOptions}>
9+
{children}
10+
</DocsLayout>
11+
);
12+
}

app/global.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

app/layout.config.tsx

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
2+
3+
/**
4+
* Shared layout configurations
5+
*
6+
* you can configure layouts individually from:
7+
* Home Layout: app/(home)/layout.tsx
8+
* Docs Layout: app/docs/layout.tsx
9+
*/
10+
export const baseOptions: BaseLayoutProps = {
11+
nav: {
12+
title: 'My App',
13+
},
14+
links: [
15+
{
16+
text: 'Documentation',
17+
url: '/docs',
18+
active: 'nested-url',
19+
},
20+
],
21+
};

app/layout.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import './global.css';
2+
import { RootProvider } from 'fumadocs-ui/provider';
3+
import { Inter } from 'next/font/google';
4+
import type { ReactNode } from 'react';
5+
6+
const inter = Inter({
7+
subsets: ['latin'],
8+
});
9+
10+
export default function Layout({ children }: { children: ReactNode }) {
11+
return (
12+
<html lang="en" className={inter.className} suppressHydrationWarning>
13+
<body className="flex flex-col min-h-screen">
14+
<RootProvider>{children}</RootProvider>
15+
</body>
16+
</html>
17+
);
18+
}

content/docs/index.mdx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Hello World
3+
description: Your first document
4+
---
5+
6+
Welcome to the docs! You can start writing documents in `/content/docs`.
7+
8+
## What is Next?
9+
10+
<Cards>
11+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
12+
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
13+
</Cards>

content/docs/test.mdx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Components
3+
description: Components
4+
---
5+
6+
## Code Block
7+
8+
```js
9+
console.log('Hello World');
10+
```
11+
12+
## Cards
13+
14+
<Cards>
15+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
16+
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
17+
</Cards>

lib/source.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { docs, meta } from '@/.source';
2+
import { createMDXSource } from 'fumadocs-mdx';
3+
import { loader } from 'fumadocs-core/source';
4+
5+
export const source = loader({
6+
baseUrl: '/docs',
7+
source: createMDXSource(docs, meta),
8+
});

next.config.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createMDX } from 'fumadocs-mdx/next';
2+
3+
const withMDX = createMDX();
4+
5+
/** @type {import('next').NextConfig} */
6+
const config = {
7+
reactStrictMode: true,
8+
};
9+
10+
export default withMDX(config);

package.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "nextify",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"build": "next build",
7+
"dev": "next dev",
8+
"start": "next start",
9+
"postinstall": "fumadocs-mdx"
10+
},
11+
"dependencies": {
12+
"next": "15.0.3",
13+
"fumadocs-ui": "14.5.5",
14+
"fumadocs-core": "14.5.5",
15+
"react": "^18.3.1",
16+
"react-dom": "^18.3.1",
17+
"fumadocs-mdx": "11.1.2"
18+
},
19+
"devDependencies": {
20+
"@types/node": "22.10.1",
21+
"@types/react": "^18.3.12",
22+
"@types/react-dom": "^18.3.1",
23+
"typescript": "^5.7.2",
24+
"@types/mdx": "^2.0.13",
25+
"autoprefixer": "^10.4.20",
26+
"postcss": "^8.4.49",
27+
"tailwindcss": "^3.4.15",
28+
"eslint": "^8",
29+
"eslint-config-next": "15.0.3"
30+
}
31+
}

0 commit comments

Comments
 (0)