|
| 1 | +# Yorkie Documentation Site |
| 2 | + |
| 3 | +Official documentation website for Yorkie (yorkie.dev). Built with Next.js and MDX for content authoring. |
| 4 | + |
| 5 | +## Tech Stack |
| 6 | + |
| 7 | +- Next.js 13, React 18, TypeScript, Sass |
| 8 | +- MDX (next-mdx-remote) with remark/rehype plugins |
| 9 | +- Prism (syntax highlighting), Mermaid (diagrams), Framer Motion |
| 10 | +- ESLint (next/core-web-vitals), Prettier |
| 11 | + |
| 12 | +## Development Commands |
| 13 | + |
| 14 | +```sh |
| 15 | +npm install # Install dependencies |
| 16 | +npm run dev # Start Next.js dev server |
| 17 | +npm run build # Build site + generate sitemap |
| 18 | +npm run build:full # Full build (fetch examples + build examples + build site) |
| 19 | +npm run export # Static export for deployment |
| 20 | +npm run lint # Run ESLint |
| 21 | +npm run fetch:examples # Fetch examples from JS, iOS, Android SDKs |
| 22 | +npm run build:examples # Build JS SDK examples |
| 23 | +npm run fetch:ui # Fetch shared UI styles |
| 24 | +``` |
| 25 | + |
| 26 | +## Project Structure |
| 27 | + |
| 28 | +``` |
| 29 | +docs/ # MDX documentation files (39 pages) |
| 30 | + index.mdx # Landing page (order: 10) |
| 31 | + getting-started/ # Quick start guides (orders: 20-29) |
| 32 | + sdks/ # SDK references (orders: 30-39) |
| 33 | + self-hosted-server/ # Self-hosting guides (orders: 50-59) |
| 34 | + advanced/ # Advanced topics (orders: 110-119) |
| 35 | + internals/ # CRDT internals (orders: 120-129) |
| 36 | + tools/ # CLI, admin API, devtools (orders: 140-149) |
| 37 | +pages/ # Next.js route pages |
| 38 | + docs/[[...slug]].tsx # Dynamic MDX page renderer |
| 39 | +components/ # React components (Layout, Navigator, CodeBlock, etc.) |
| 40 | + docs/ # Doc-specific components (Breadcrumb, Alert, EditThisPage) |
| 41 | +utils/ |
| 42 | + mdxUtils.ts # Navigation generation, slug handling, frontmatter parsing |
| 43 | + rehypeVariables.ts # Template variable replacement |
| 44 | + rehypeImageMeta.ts # Image metadata extraction |
| 45 | + rehypeWrapContents.ts # Content wrapper for styling |
| 46 | +hooks/ # Custom React hooks |
| 47 | +styles/ # SCSS stylesheets |
| 48 | +scripts/ # Example fetch/build scripts |
| 49 | +examples/ # Built example applications (28 examples) |
| 50 | +public/ # Static assets (images, fonts, icons) |
| 51 | +``` |
| 52 | + |
| 53 | +## MDX Conventions |
| 54 | + |
| 55 | +**Frontmatter fields:** |
| 56 | +```yaml |
| 57 | +--- |
| 58 | +title: 'Page Title' # Required: display name |
| 59 | +order: 10 # Required for navigation: determines position |
| 60 | +phase: development # Optional: 'development' pages hidden in production |
| 61 | +--- |
| 62 | +``` |
| 63 | + |
| 64 | +**Navigation ordering:** |
| 65 | +- `order % 10 === 0` -> main navigation group |
| 66 | +- Other orders -> submenu items under the preceding main group |
| 67 | + |
| 68 | +**Template variables** (replaced at build time): |
| 69 | +- `{{YORKIE_VERSION}}`, `{{YORKIE_JS_VERSION}}`, `{{YORKIE_IOS_VERSION}}`, `{{YORKIE_ANDROID_VERSION}}` |
| 70 | +- `{{API_ADDR}}`, `{{API_HOST}}`, `{{API_PORT}}`, `{{DASHBOARD_PATH}}` |
| 71 | + |
| 72 | +**Custom MDX components available:** |
| 73 | +- `<Alert>`, `<Breadcrumb>`, `<Caption>`, `<ImageWrap>` |
| 74 | +- `<CodeBlock>`, `<CodeBlockHeader>`, `<Mermaid>` |
| 75 | +- `<Button>`, `<Icon>` |
| 76 | + |
| 77 | +## Code Conventions |
| 78 | + |
| 79 | +- Prettier: 120 chars, single quotes, trailing commas, 2-space indent |
| 80 | +- ESLint: next/core-web-vitals |
| 81 | +- Path alias: `@/` maps to project root |
| 82 | +- Environment variables: `NEXT_PUBLIC_` prefix for client-side access |
| 83 | +- Commit messages: subject max 70 chars, body at 80 chars |
| 84 | + |
| 85 | +## Architecture Notes |
| 86 | + |
| 87 | +- **Static generation**: All docs pages are statically generated via `getStaticPaths`/`getStaticProps` |
| 88 | +- **MDX pipeline**: gray-matter (frontmatter) -> remark-gfm -> rehype plugins -> MDXRemote |
| 89 | +- **Navigation**: Auto-generated from MDX frontmatter metadata in `utils/mdxUtils.ts` |
| 90 | +- **Examples**: Fetched from SDK repos via scripts, built and served alongside docs |
| 91 | +- **Deployment**: GitHub Pages via GitHub Actions on push to main |
0 commit comments