Skip to content

Commit 4815b0b

Browse files
authored
Merge pull request #33 from objectstack-ai/copilot/create-fumadocs-site
2 parents 8a10d56 + abd0517 commit 4815b0b

68 files changed

Lines changed: 6966 additions & 85 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ coverage/
4848
# generated native folders
4949
/ios
5050
/android
51+
52+
# fumadocs
53+
apps/docs/.next/
54+
apps/docs/.source/
55+
apps/docs/node_modules/

apps/docs/.gitignore

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

apps/docs/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# docs
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+
## Explore
19+
20+
In the project, you can see:
21+
22+
- `lib/source.ts`: Code for content source adapter, [`loader()`](https://fumadocs.dev/docs/headless/source-api) provides the interface to access your content.
23+
- `lib/layout.shared.tsx`: Shared options for layouts, optional but preferred to keep.
24+
25+
| Route | Description |
26+
| ------------------------- | ------------------------------------------------------ |
27+
| `app/(home)` | The route group for your landing page and other pages. |
28+
| `app/docs` | The documentation layout and pages. |
29+
| `app/api/search/route.ts` | The Route Handler for search. |
30+
31+
### Fumadocs MDX
32+
33+
A `source.config.ts` config file has been included, you can customise different options like frontmatter schema.
34+
35+
Read the [Introduction](https://fumadocs.dev/docs/mdx) for further details.
36+
37+
## Learn More
38+
39+
To learn more about Next.js and Fumadocs, take a look at the following
40+
resources:
41+
42+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
43+
features and API.
44+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
45+
- [Fumadocs](https://fumadocs.dev) - learn about Fumadocs

apps/docs/app/(home)/layout.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { HomeLayout } from 'fumadocs-ui/layouts/home';
2+
import { baseOptions } from '@/lib/layout.shared';
3+
4+
export default function Layout({ children }: LayoutProps<'/'>) {
5+
return <HomeLayout {...baseOptions()}>{children}</HomeLayout>;
6+
}

apps/docs/app/(home)/page.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Link from 'next/link';
2+
3+
export default function HomePage() {
4+
return (
5+
<div className="flex flex-col justify-center text-center flex-1 px-4">
6+
<h1 className="text-4xl font-bold mb-4">ObjectStack Mobile</h1>
7+
<p className="text-lg text-fd-muted-foreground mb-8 max-w-2xl mx-auto">
8+
Enterprise-grade mobile runtime for the ObjectStack low-code platform.
9+
Metadata-driven, offline-first, built with Expo &amp; React Native.
10+
</p>
11+
<div className="flex flex-row gap-4 justify-center">
12+
<Link
13+
href="/docs"
14+
className="inline-flex items-center justify-center rounded-lg bg-fd-primary px-6 py-3 text-sm font-medium text-fd-primary-foreground shadow hover:bg-fd-primary/90"
15+
>
16+
Get Started
17+
</Link>
18+
<Link
19+
href="/docs/hooks"
20+
className="inline-flex items-center justify-center rounded-lg border border-fd-border px-6 py-3 text-sm font-medium shadow-sm hover:bg-fd-accent"
21+
>
22+
API Reference
23+
</Link>
24+
</div>
25+
</div>
26+
);
27+
}

apps/docs/app/api/search/route.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { source } from '@/lib/source';
2+
import { createFromSource } from 'fumadocs-core/search/server';
3+
4+
export const { GET } = createFromSource(source, {
5+
// https://docs.orama.com/docs/orama-js/supported-languages
6+
language: 'english',
7+
});
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { getPageImage, source } from '@/lib/source';
2+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page';
3+
import { notFound } from 'next/navigation';
4+
import { getMDXComponents } from '@/mdx-components';
5+
import type { Metadata } from 'next';
6+
import { createRelativeLink } from 'fumadocs-ui/mdx';
7+
import { LLMCopyButton, ViewOptions } from '@/components/ai/page-actions';
8+
import { gitConfig } from '@/lib/layout.shared';
9+
10+
export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
11+
const params = await props.params;
12+
const page = source.getPage(params.slug);
13+
if (!page) notFound();
14+
15+
const MDX = page.data.body;
16+
17+
return (
18+
<DocsPage toc={page.data.toc} full={page.data.full}>
19+
<DocsTitle>{page.data.title}</DocsTitle>
20+
<DocsDescription className="mb-0">{page.data.description}</DocsDescription>
21+
<div className="flex flex-row gap-2 items-center border-b pb-6">
22+
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
23+
<ViewOptions
24+
markdownUrl={`${page.url}.mdx`}
25+
// update it to match your repo
26+
githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/apps/docs/content/docs/${page.path}`}
27+
/>
28+
</div>
29+
<DocsBody>
30+
<MDX
31+
components={getMDXComponents({
32+
// this allows you to link to other pages with relative file paths
33+
a: createRelativeLink(source, page),
34+
})}
35+
/>
36+
</DocsBody>
37+
</DocsPage>
38+
);
39+
}
40+
41+
export async function generateStaticParams() {
42+
return source.generateParams();
43+
}
44+
45+
export async function generateMetadata(props: PageProps<'/docs/[[...slug]]'>): Promise<Metadata> {
46+
const params = await props.params;
47+
const page = source.getPage(params.slug);
48+
if (!page) notFound();
49+
50+
return {
51+
title: page.data.title,
52+
description: page.data.description,
53+
openGraph: {
54+
images: getPageImage(page).url,
55+
},
56+
};
57+
}

apps/docs/app/docs/layout.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { source } from '@/lib/source';
2+
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
3+
import { baseOptions } from '@/lib/layout.shared';
4+
5+
export default function Layout({ children }: LayoutProps<'/docs'>) {
6+
return (
7+
<DocsLayout tree={source.getPageTree()} {...baseOptions()}>
8+
{children}
9+
</DocsLayout>
10+
);
11+
}

apps/docs/app/global.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import 'tailwindcss';
2+
@import 'fumadocs-ui/css/neutral.css';
3+
@import 'fumadocs-ui/css/preset.css';

apps/docs/app/layout.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RootProvider } from 'fumadocs-ui/provider/next';
2+
import './global.css';
3+
4+
export default function Layout({ children }: LayoutProps<'/'>) {
5+
return (
6+
<html lang="en" suppressHydrationWarning>
7+
<body className="flex flex-col min-h-screen">
8+
<RootProvider>{children}</RootProvider>
9+
</body>
10+
</html>
11+
);
12+
}

0 commit comments

Comments
 (0)