Cookest
Contributing

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

LayerTechnologyPurpose
FrameworkNext.js 16 (App Router)SSG + routing
Docs engineFumadocs 16.8MDX content, sidebar, search
StylingTailwindCSS 4UI components
DiagramsMermaidArchitecture/flow diagrams
i18n (content)Fumadocs directory parserLocale-specific MDX files
i18n (UI strings)Custom JSON + t() functionNav, buttons, labels
IconsLucide ReactNavigation 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 translations

i18n 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 β†’ Portuguese
  • content/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

TierLocalesCoverageMaintenance
Tier 1πŸ‡¬πŸ‡§ EN, πŸ‡΅πŸ‡Ή PTFull parity β€” every page translatedCore team
Tier 2πŸ‡«πŸ‡· FR, πŸ‡©πŸ‡ͺ DE, πŸ‡ͺπŸ‡Έ ESIndex/landing pages + high-value contentCommunity

Tier 2 languages show a Ξ² badge in the language switcher and a translation notice banner on each page.

URL Routing

URL PatternLocaleRoute Handler
/docs/...Englishapp/docs/(en)/[[...slug]]/page.tsx
/docs/pt/...Portugueseapp/docs/pt/[[...slug]]/page.tsx
/docs/fr/...Frenchapp/docs/fr/[[...slug]]/page.tsx
/docs/de/...Germanapp/docs/de/[[...slug]]/page.tsx
/docs/es/...Spanishapp/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.

On this page