Documentation Architecture
How the Cookest documentation site is built, how i18n works, and how to extend it
Documentation Architecture
This page describes the internal architecture of the Cookest documentation site itself β how it's built, how translations work, and how to add new content or languages.
Tech Stack
| Layer | Technology | Purpose |
|---|---|---|
| Framework | Next.js 16 (App Router) | SSG + routing |
| Docs engine | Fumadocs 16.8 | MDX content, sidebar, search |
| Styling | TailwindCSS 4 | UI components |
| Diagrams | Mermaid | Architecture/flow diagrams |
| i18n (content) | Fumadocs directory parser | Locale-specific MDX files |
| i18n (UI strings) | Custom JSON + t() function | Nav, buttons, labels |
| Icons | Lucide React | Navigation icons |
High-Level Architecture
Folder Structure
docs/
βββ content/docs/ β MDX content (English = default)
β βββ index.mdx β Root landing page
β βββ architecture/ β System design docs
β βββ backend/ β API documentation
β βββ mobile/ β Flutter app docs
β βββ user-guide/ β End-user tutorials
β βββ etl/ β Data pipeline docs
β βββ contributing/ β This section
β βββ ai/ β AI & automation docs
β βββ pt/ β π΅πΉ Portuguese (Tier 1 β full parity)
β βββ fr/ β π«π· French (Tier 2 β community)
β βββ de/ β π©πͺ German (Tier 2 β community)
β βββ es/ β πͺπΈ Spanish (Tier 2 β community)
βββ messages/ β JSON translation files for UI strings
β βββ en.json
β βββ pt.json
β βββ fr.json
β βββ de.json
β βββ es.json
βββ lib/
β βββ i18n.ts β Central locale registry + t() function
β βββ source.ts β Fumadocs content loader
β βββ layout.shared.tsx β Locale-aware nav configuration
β βββ shared.ts β Constants (routes, git config)
βββ components/
β βββ language-switcher.tsx β Multi-language dropdown
β βββ mdx.tsx β MDX component overrides
β βββ mermaid.tsx β Mermaid diagram renderer
βββ app/
β βββ docs/
β β βββ (en)/ β English routes (default, no prefix)
β β βββ pt/ β Portuguese routes (/docs/pt/...)
β β βββ fr/ β French routes (/docs/fr/...)
β β βββ de/ β German routes (/docs/de/...)
β β βββ es/ β Spanish routes (/docs/es/...)
β βββ api/search/ β Full-text search API
β βββ og/docs/ β OpenGraph image generation
βββ messages/ β UI string translationsi18n System
The documentation uses a two-layer i18n system:
Layer 1: Content (MDX files)
Fumadocs handles content translation through its directory parser. Files are organized by locale:
content/docs/*.mdxβ English (default locale)content/docs/pt/*.mdxβ Portuguesecontent/docs/fr/*.mdxβ French- etc.
The loader in lib/source.ts configures this:
i18n: {
defaultLanguage: 'en',
languages: ['en', 'pt', 'fr', 'de', 'es'],
parser: 'dir',
fallbackLanguage: null, // 404 if translation is missing
}Layer 2: UI Strings (JSON files)
Navigation labels, buttons, and other UI chrome are translated via JSON files in messages/. The t() function in lib/i18n.ts provides type-safe access:
import { t } from '@/lib/i18n';
t('en', 'nav.docs') // "Docs"
t('pt', 'nav.docs') // "DocumentaΓ§Γ£o"
t('fr', 'common.nextPage') // "Suivant"Locale Tiers
| Tier | Locales | Coverage | Maintenance |
|---|---|---|---|
| Tier 1 | π¬π§ EN, π΅πΉ PT | Full parity β every page translated | Core team |
| Tier 2 | π«π· FR, π©πͺ DE, πͺπΈ ES | Index/landing pages + high-value content | Community |
Tier 2 languages show a Ξ² badge in the language switcher and a translation notice banner on each page.
URL Routing
| URL Pattern | Locale | Route Handler |
|---|---|---|
/docs/... | English | app/docs/(en)/[[...slug]]/page.tsx |
/docs/pt/... | Portuguese | app/docs/pt/[[...slug]]/page.tsx |
/docs/fr/... | French | app/docs/fr/[[...slug]]/page.tsx |
/docs/de/... | German | app/docs/de/[[...slug]]/page.tsx |
/docs/es/... | Spanish | app/docs/es/[[...slug]]/page.tsx |
English is the default locale and has no URL prefix (uses a Next.js route group (en)).
Adding a New Language
See the Translation Contribution Guide for the full step-by-step process.