Files
AndreaSlopFotografie/aidlc-docs/_shared/reverse-engineering/code-structure.md
T
SluijsensandClaude Opus 5.5 db2fa89b90 Adds AI-DLC inception docs for the front-end shell feature
Workspace detection, reverse engineering of web/, requirements with
answered verification questions, the execution plan and the open
application design questions for the frontend-shell feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 13:03:26 +02:00

5.1 KiB

Code Structure

Build System

  • Type: npm-compatible via pnpm (lockfile web/pnpm-lock.yaml)
  • Configuration:
    • web/package.json — scripts dev (vite), build (tsc && vite build), preview, typegen (Chakra typegen for theme)
    • web/vite.config.js — TanStack Router plugin (autoCodeSplitting) before @vitejs/plugin-react; resolve.tsconfigPaths
    • web/tsconfig.json — strict-ish bundler mode, @/* → src/* alias, noUnusedLocals/Parameters, erasableSyntaxOnly
    • web/.prettierrc — 4 spaces, single quotes, semicolons

Key Classes/Modules

graph TD
    Root["routes/__root.tsx"] --> AppShell["components/AppShell.tsx"]
    AppShell --> NavigationBar["NavigationBar/NavigationBar.tsx"]
    AppShell --> Footer["components/Footer.tsx"]
    NavigationBar --> NavLink["NavigationBar/NavLink.tsx"]
    NavigationBar --> MobileNav["NavigationBar/MobileNav.tsx"]
    NavigationBar --> navItems["NavigationBar/navItems.ts"]
    MobileNav --> navItems
    NavigationBar --> useScrolledPast["hooks/useScrolledPast.tsx"]
    Index["routes/index.tsx"] --> Hero["Hero/Hero.tsx"]
    Hero --> HeroArrows["Hero/HeroArrows.tsx"]
    Hero --> HeroSocials["Hero/HeroSocials.tsx"]
    Hero --> useHeroSlider["Hero/useHeroSlider.ts"]
    Hero --> LinkButton["components/LinkButton.tsx"]
    HeroSocials --> socialPlatforms["Hero/socialPlatforms.ts"]
    classDef shell fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
    classDef page fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
    classDef util fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
    class Root,AppShell,NavigationBar,Footer,NavLink,MobileNav shell;
    class Index,Hero,HeroArrows,HeroSocials page;
    class navItems,useScrolledPast,useHeroSlider,LinkButton,socialPlatforms util;

Text alternative: the root route renders AppShell (NavigationBar with NavLink/MobileNav/navItems, plus Footer); the index route renders Hero with its arrows, socials, slider hook and the shared LinkButton.

Existing Files Inventory

  • web/index.html — HTML entry; static fallback title/meta for non-JS crawlers (data-fallback)
  • web/src/main.tsx — bootstrap: providers, router, fonts, removes fallback head tags
  • web/src/routeTree.gen.ts — generated by TanStack Router plugin (do not edit)
  • web/src/routes/__root.tsx — root layout route, site-wide head
  • web/src/routes/index.tsx — home page (/), renders Hero
  • web/src/routes/over-mij.tsx — about page (/over-mij), placeholder content
  • web/src/components/AppShell.tsx — shell: NavigationBar + Outlet + Footer
  • web/src/components/Footer.tsx — placeholder footer
  • web/src/components/LinkButton.tsx — router Link styled with linkButton recipe
  • web/src/components/NavigationBar/NavigationBar.tsx — header, logo, desktop nav, hamburger
  • web/src/components/NavigationBar/NavLink.tsx — desktop nav link with underline animation
  • web/src/components/NavigationBar/MobileNav.tsx — full-screen mobile menu
  • web/src/components/NavigationBar/navItems.ts — menu items (Home, Over mij)
  • web/src/components/Hero/* — hero slider (component, arrows, socials, hook, content, types, platforms)
  • web/src/hooks/useScrolledPast.tsx — boolean "scrolled past threshold" hook
  • web/src/recipes/linkButton.ts — Chakra recipe for the square design button
  • web/src/theme.ts — Chakra system config (tokens, semantic tokens, text styles, recipes)
  • web/src/seo.ts — pageHead / siteHead helpers
  • web/src/assets/* — hero photos, light/dark logos, unused Vite starter assets (hero.png, typescript.svg, vite.svg)
  • web/public/favicon.png, web/public/icons.svg — static public assets

Design Patterns

  • Location: NavLink, MobileNav, LinkButton
  • Purpose: Router-aware links with Chakra style props and _currentPage / aria-current styling
  • Implementation: const ChakraLink = chakra(Link)

Design tokens + recipes

  • Location: theme.ts, recipes/
  • Purpose: Single source for colours, fonts, spacing, motion; reusable component variants
  • Implementation: defineConfig tokens/semanticTokens/textStyles, defineRecipe + useRecipe

API-shaped static content

  • Location: Hero/heroContent.ts + types.ts, navItems.ts
  • Purpose: Hard-coded content today, swappable for CMS API responses later
  • Implementation: Plain data objects typed with interfaces; components receive them as props

Route-level head management

  • Location: seo.ts, each route's head option, HeadContent in root
  • Purpose: Per-page SEO without SSR

Critical Dependencies

@chakra-ui/react

  • Version: ^3.37.0
  • Usage: All layout and styling
  • Purpose: Component library and styling system

@tanstack/react-router (+ router-plugin)

  • Version: ^1.170.39 / ^1.168.40
  • Usage: File-based routes, Link, Outlet, HeadContent, useRouterState
  • Purpose: Routing and head management

@iconify/react + @iconify-icons/ant-design

  • Version: ^6.0.2 / 2.0.1
  • Usage: Offline icons in Hero
  • Purpose: Icons bundled at build time (no API calls)