Create fumadocs documentation site at /apps/docs/#33
Conversation
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ring, and utilities pages Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Fumadocs-powered Next.js documentation site under apps/docs and wires it into the pnpm workspace, including a first pass at documentation content (architecture, components, hooks, libraries) plus LLM-friendly endpoints (raw MDX + llms.txt).
Changes:
- Add
apps/docsNext.js app configured for Fumadocs MDX, Tailwind, search, OG images, and LLM export routes. - Add initial docs content under
apps/docs/content/docswithmeta.jsonnavigation ordering. - Update workspace and gitignore to accommodate the new docs app.
Reviewed changes
Copilot reviewed 66 out of 68 changed files in this pull request and generated 24 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Adds apps/* workspace packages. |
| apps/docs/tsconfig.json | TypeScript config for the docs app. |
| apps/docs/source.config.ts | Fumadocs collections/source configuration. |
| apps/docs/postcss.config.mjs | PostCSS config for Tailwind integration. |
| apps/docs/package.json | Docs app package scripts and dependencies. |
| apps/docs/next.config.mjs | Next.js config with Fumadocs MDX + rewrites. |
| apps/docs/mdx-components.tsx | MDX component mapping for Fumadocs UI. |
| apps/docs/lib/source.ts | Fumadocs source loader + helpers (OG + LLM text). |
| apps/docs/lib/layout.shared.tsx | Shared layout options + GitHub repo config. |
| apps/docs/lib/cn.ts | Tailwind class merge helper for docs app. |
| apps/docs/content/docs/meta.json | Top-level docs navigation ordering. |
| apps/docs/content/docs/index.mdx | Docs home page content. |
| apps/docs/content/docs/getting-started/meta.json | “Getting Started” section ordering. |
| apps/docs/content/docs/getting-started/index.mdx | Getting started guide content. |
| apps/docs/content/docs/architecture/meta.json | “Architecture” section ordering. |
| apps/docs/content/docs/architecture/index.mdx | Architecture overview page. |
| apps/docs/content/docs/architecture/data-layer.mdx | Data layer documentation page. |
| apps/docs/content/docs/architecture/offline-first.mdx | Offline-first architecture page. |
| apps/docs/content/docs/components/meta.json | “Components” section ordering. |
| apps/docs/content/docs/components/index.mdx | Components overview page. |
| apps/docs/content/docs/components/renderers.mdx | View renderers documentation page. |
| apps/docs/content/docs/components/ui-primitives.mdx | UI primitives documentation page. |
| apps/docs/content/docs/components/common.mdx | Common components documentation page. |
| apps/docs/content/docs/components/actions.mdx | Action components documentation page. |
| apps/docs/content/docs/components/query.mdx | Query components documentation page. |
| apps/docs/content/docs/hooks/meta.json | “Hooks” section ordering. |
| apps/docs/content/docs/hooks/index.mdx | Hooks reference landing page. |
| apps/docs/content/docs/hooks/data-hooks.mdx | Data hooks documentation page. |
| apps/docs/content/docs/hooks/auth-hooks.mdx | Auth/security hooks documentation page. |
| apps/docs/content/docs/hooks/feature-hooks.mdx | Feature hooks documentation page. |
| apps/docs/content/docs/hooks/analytics-hooks.mdx | Analytics hooks documentation page. |
| apps/docs/content/docs/hooks/ui-hooks.mdx | UI hooks documentation page. |
| apps/docs/content/docs/authentication/meta.json | “Authentication” section ordering. |
| apps/docs/content/docs/authentication/index.mdx | Authentication documentation page. |
| apps/docs/content/docs/libraries/meta.json | “Libraries” section ordering. |
| apps/docs/content/docs/libraries/index.mdx | Libraries landing page (cards). |
| apps/docs/content/docs/libraries/auth.mdx | Auth libraries documentation page. |
| apps/docs/content/docs/libraries/data.mdx | Data libraries documentation page. |
| apps/docs/content/docs/libraries/security.mdx | Security libraries documentation page. |
| apps/docs/content/docs/libraries/monitoring.mdx | Monitoring libraries documentation page. |
| apps/docs/content/docs/libraries/utilities.mdx | Utilities libraries documentation page. |
| apps/docs/components/ai/page-actions.tsx | “Copy markdown” + “Open in …” actions UI. |
| apps/docs/app/layout.tsx | Root layout + provider + global CSS import. |
| apps/docs/app/global.css | Tailwind + fumadocs UI CSS imports. |
| apps/docs/app/(home)/layout.tsx | Home layout wrapper. |
| apps/docs/app/(home)/page.tsx | Landing page content for docs app. |
| apps/docs/app/docs/layout.tsx | Docs layout using Fumadocs page tree. |
| apps/docs/app/docs/[[...slug]]/page.tsx | Docs page renderer + metadata + GitHub link. |
| apps/docs/app/api/search/route.ts | Server search endpoint from Fumadocs source. |
| apps/docs/app/og/docs/[...slug]/route.tsx | OG image generation route for docs pages. |
| apps/docs/app/llms.txt/route.ts | LLM index (llms.txt) route. |
| apps/docs/app/llms-full.txt/route.ts | Aggregated full-text LLM export route. |
| apps/docs/app/llms.mdx/docs/[[...slug]]/route.ts | Raw processed markdown endpoint per doc page. |
| apps/docs/README.md | Docs app README (generated template). |
| apps/docs/.gitignore | Docs app gitignore (build + generated artifacts). |
| .gitignore | Adds docs app build artifacts to root ignore list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { createFeatureFlagManager } from '@/lib/feature-flags'; | ||
|
|
||
| const manager = createFeatureFlagManager({ | ||
| flags: { | ||
| 'new-dashboard': { enabled: true, rollout: 50 }, | ||
| 'ai-search': { enabled: false }, | ||
| }, | ||
| }); | ||
|
|
||
| // Evaluate a flag (considers rollout percentage) | ||
| const isEnabled = manager.evaluate('new-dashboard', userId); | ||
| ``` |
There was a problem hiding this comment.
The createFeatureFlagManager sample uses a { flags: { ... }, rollout } config and manager.evaluate(...), but lib/feature-flags.ts uses { defaults?: FeatureFlag[], refreshIntervalMs?, endpoint? } and exposes isEnabled(...). Please align the example with the implemented API and naming (rolloutPercentage, etc.).
There was a problem hiding this comment.
Fixed in abd0517. Updated to use FeatureFlagConfig with defaults: FeatureFlag[], refreshIntervalMs, and manager.isEnabled() / manager.setUserId() matching the actual API.
| import { createRemoteConfigManager } from '@/lib/remote-config'; | ||
|
|
||
| const config = createRemoteConfigManager({ | ||
| endpoint: 'https://server.objectstack.com/config', | ||
| pollInterval: 300000, // 5 minutes | ||
| }); | ||
|
|
||
| // Fetch latest config | ||
| await config.refresh(); | ||
|
|
||
| // Get a value (falls back to cached) | ||
| const value = config.get('maxUploadSizeMB'); // 10 | ||
| ``` |
There was a problem hiding this comment.
The createRemoteConfigManager example uses pollInterval and config.get(...), but lib/remote-config.ts uses refreshIntervalMs and methods like getValue(...) / getValueWithDefault(...). Please update the option/method names so the snippet is copy/paste-able.
There was a problem hiding this comment.
Fixed in abd0517. Updated to refreshIntervalMs and config.getValue<T>() / config.getValueWithDefault() matching the actual API.
| import type { ReviewChecklist } from '@/lib/app-store-review'; | ||
|
|
||
| // Validates against expo app.json config | ||
| // Checks: metadata, assets, privacy, compliance | ||
| ``` |
There was a problem hiding this comment.
ReviewChecklist doesn’t appear to exist in lib/app-store-review.ts (the file exports ReviewCheckItem, AppConfig, ReviewReport, and validateAppStoreReadiness). Consider updating the docs to reference the actual exported types/functions so readers aren’t pointed at non-existent APIs.
There was a problem hiding this comment.
Fixed in abd0517. Updated to reference the actual exports: validateAppStoreReadiness, ReviewCheckItem, AppConfig, and ReviewReport.
| export default async function Page(props: PageProps<'/docs/[[...slug]]'>) { | ||
| const params = await props.params; | ||
| const page = source.getPage(params.slug); |
There was a problem hiding this comment.
This file uses PageProps<'/docs/[[...slug]]'> but there’s no local/imported definition for PageProps in the repo. Unless next typegen has been run and its generated types are available, tsc/CI will fail with an unknown identifier. Prefer using explicit props typing (e.g., { params: { slug?: string[] } }) or importing a stable type instead of relying on generated globals.
|
|
||
| export default function Layout({ children }: LayoutProps<'/docs'>) { |
There was a problem hiding this comment.
This layout signature uses LayoutProps<'/docs'> but there’s no local/imported definition for LayoutProps in the repo. Unless generated route types exist at build time, tsc/CI will fail. Consider using a plain { children: React.ReactNode } prop type (or importing a stable type) to avoid depending on generated globals.
| export default function Layout({ children }: LayoutProps<'/docs'>) { | |
| import type React from 'react'; | |
| export default function Layout({ children }: { children: React.ReactNode }) { |
| import { createMemoryTracker } from '@/lib/memory-profiler'; | ||
|
|
||
| const tracker = createMemoryTracker({ | ||
| leakThreshold: 10, // Report after 10 unmatched mounts | ||
| }); | ||
|
|
||
| // Track component lifecycle | ||
| tracker.onMount('ContactList'); | ||
| tracker.onUnmount('ContactList'); | ||
|
|
||
| // Check for leaks | ||
| const leaks = tracker.getLeaks(); | ||
| ``` |
There was a problem hiding this comment.
The memory profiler example doesn’t match lib/memory-profiler.ts. The implementation has createMemoryTracker() with track/untrack/reportLeaks, not { leakThreshold } options and onMount/onUnmount/getLeaks methods. Updating this will avoid readers implementing against a non-existent API.
There was a problem hiding this comment.
Fixed in abd0517. Updated to use createMemoryTracker() (no constructor args), track(label, cleanup), untrack(label), reportLeaks(thresholdMs), and disposeAll().
|
|
||
| export default function Layout({ children }: LayoutProps<'/'>) { |
There was a problem hiding this comment.
This layout signature uses LayoutProps<'/'> but there’s no local/imported definition for LayoutProps in the repo. Unless generated route types exist at build time, tsc/CI will fail. Consider using a plain { children: React.ReactNode } prop type (or importing a stable type) instead.
| export default function Layout({ children }: LayoutProps<'/'>) { | |
| import type { ReactNode } from 'react'; | |
| export default function Layout({ children }: { children: ReactNode }) { |
| export async function GET(_req: Request, { params }: RouteContext<'/llms.mdx/docs/[[...slug]]'>) { | ||
| const { slug } = await params; | ||
| const page = source.getPage(slug); |
There was a problem hiding this comment.
RouteContext<'/llms.mdx/docs/[[...slug]]'> is used but there’s no local/imported definition for RouteContext in the repo. Unless generated route types exist at build time, tsc/CI will fail. Consider typing the context as { params: { slug?: string[] } } (or similar) to avoid depending on generated globals.
| "next": "16.1.6", | ||
| "react": "^19.2.4", | ||
| "react-dom": "^19.2.4", | ||
| "tailwind-merge": "^3.4.0" |
There was a problem hiding this comment.
This package pins react/react-dom to versions that differ from the workspace root. In a monorepo this often leads to multiple React copies and peer-dep conflicts (especially with Next). Consider aligning React versions with the root package (or using workspace protocol) to avoid duplication and hard-to-debug runtime issues.
| // Create client with auth token | ||
| const client = createObjectStackClient(authToken); | ||
|
|
||
| // Retrieve existing singleton | ||
| const client = getObjectStackClient(); | ||
| ``` |
There was a problem hiding this comment.
This code sample declares const client twice, which won’t compile and is confusing for readers. Consider showing one approach, or rename the second variable (e.g. existingClient) to demonstrate retrieving the singleton separately.
There was a problem hiding this comment.
Fixed in abd0517. Renamed the second variable to existingClient.
|
@copilot 继续 |
…e issues Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
/apps/docs/libraries/utilities.mdx— align feature-flags (isEnabled,FeatureFlagConfig), remote-config (refreshIntervalMs,getValue/getValueWithDefault), app-store-review (validateAppStoreReadiness,ReviewCheckItem)libraries/data.mdx— correctSyncQueueEntryshape (id: number,recordIdrequired,payload: string,retries,errorMessage,updatedAt), correctConflictInfo, fix OPERATOR_META to read-only usagelibraries/security.mdx— correctbuildPinningPolicy(apiUrl, pins)signature,validateCertificatePin(policy, certHash),addCheck(AuditCheckDefinition)shapelibraries/monitoring.mdx—flushIntervalMs, error codes (VALIDATION_ERROR,INTERNAL_ERROR),createPerformanceBenchmarkwith flat thresholds,createMemoryTrackerwithtrack/untrack/reportLeakslibraries/auth.mdx— rename duplicateconst clienttoexistingClientwriteTextinstead ofClipboardItemapps/docs/prefixgenerateStaticParams: remove extralangkey/docs.mdx→/llms.mdx/docsfor index page✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.