# soufianenederra/mogatopo architecture

> Architecture diagram of the GitHub repository soufianenederra/mogatopo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/soufianenederra/mogatopo
- Repository: https://github.com/soufianenederra/mogatopo

## Overview

##### Project Type & Purpose
- Full-stack, internationalized marketing & blog site built on Next.js App Router
- Uses Contentlayer to ingest MDX blog posts from /posts and generate JSON data
- Provides serverless API routes for booking and contact form submissions
- Deployed on Vercel (static/SSR hybrid)

##### High-Level Components
a. Client (Browser or Mobile)
b. Next.js App (Vercel Serverless or Edge Functions)
c. Contentlayer Data Pipeline (build-time)
d. MDX Content Source (/posts/*.mdx)
e. Internationalization Layer (i18n.ts + [locale]/ routes)
f. UI Component Library (components/**/*)
g. Public Assets (public/svg, public/mogatopo)
h. API Routes
– POST /api/booking → booking route.ts
– POST /api/contact → contact route.ts
i. External Services (e.g., Email service or CRM—replace with actual)

##### Relationships & Data Flows
- Build Time:
– Contentlayer reads MDX in /posts → generates JSON under .contentlayer/generated → bundled into the static site
– TailwindCSS and other assets are compiled via postcss.config.js
- Runtime Page Rendering:
– Client requests page under /[locale]/...
– Next.js decides between SSR, SSG, or ISR based on page.tsx and dynamic routes
– i18n layer picks correct locale JSON files (messages/en.json, fr.json)
– UI Components render, fetching prebuilt Contentlayer data via imported hooks or GraphQL
- API Calls:
– Booking form component calls fetch('/api/booking') → serverless function processes data → optionally calls external booking service or database → responds to client
– Contact form component calls fetch('/api/contact') → serverless function sends email or logs to CRM → responds to client

##### Architectural Patterns & Design Principles
- Separation of Concerns: UI components vs. data layer (Contentlayer) vs. API layer
- File‐based Routing (Next.js App Router)
- Static Generation + Dynamic SSR fallback (hybrid)
- Serverless Functions for lightweight back-end logic
- Internationalization via folder conventions and JSON message bundles

– Green for static assets & data (MDX, JSON, public/)
– Blue for runtime server components (Next.js pages, API routes)
– Orange for external services
- Protocols (HTTP/HTTPS, fetch) on the connectors

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Swimlanes
    subgraph "Frontend Layer"
        direction TB
        Client["Client (Browser/Mobile)"]:::external
        subgraph "Routes & Pages"
            direction TB
            AR["App Router (Pages & Layouts)"]:::runtime
            subgraph "app/[locale]"
                direction TB
                A_Page["page.tsx"]:::runtime
                A_Layout["layout.tsx"]:::runtime
                A_Loading["loading.tsx"]:::runtime
                click A_Page "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/page.tsx"
                click A_Layout "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/layout.tsx"
                click A_Loading "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/loading.tsx"
                subgraph "about"
                    direction TB
                    About_Page["page.tsx"]:::runtime
                    About_Loading["loading.tsx"]:::runtime
                    click About_Page "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/about/page.tsx"
                    click About_Loading "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/about/loading.tsx"
                end
                subgraph "blog"
                    direction TB
                    Blog_Page["page.tsx"]:::runtime
                    Blog_Loading["loading.tsx"]:::runtime
                    Blog_Slug["[slug]/page.tsx"]:::runtime
                    click Blog_Page "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/blog/page.tsx"
                    click Blog_Loading "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/blog/loading.tsx"
                    click Blog_Slug "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/blog/[slug]/page.tsx"
                end
                subgraph "booking"
                    direction TB
                    Booking_Page["page.tsx"]:::runtime
                    Booking_Loading["loading.tsx"]:::runtime
                    click Booking_Page "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/booking/page.tsx"
                    click Booking_Loading "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/booking/loading.tsx"
                end
                subgraph "contact"
                    direction TB
                    Contact_Page["page.tsx"]:::runtime
                    Contact_Loading["loading.tsx"]:::runtime
                    click Contact_Page "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/contact/page.tsx"
                    click Contact_Loading "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/contact/loading.tsx"
                end
                subgraph "services"
                    direction TB
                    Services_Page["page.tsx"]:::runtime
                    Services_Loading["loading.tsx"]:::runtime
                    click Services_Page "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/services/page.tsx"
                    click Services_Loading "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/services/loading.tsx"
                end
                subgraph "thankyou"
                    direction TB
                    TY_Page["page.tsx"]:::runtime
                    click TY_Page "https://github.com/soufianenederra/mogatopo/blob/master/app/[locale]/thankyou/page.tsx"
                end
            end
            Client -->|"HTTP GET /[locale]/..."| AR
        end
        subgraph "UI Components"
            direction TB
            Components["components/**"]:::runtime
            click Components "https://github.com/soufianenederra/mogatopo/tree/master/components"
        end
        subgraph "i18n Loader"
            direction TB
            I18N_Config["i18n.ts"]:::runtime
            Messages_EN["messages/en.json"]:::static
            Messages_FR["messages/fr.json"]:::static
            click I18N_Config "https://github.com/soufianenederra/mogatopo/blob/master/i18n.ts"
            click Messages_EN "https://github.com/soufianenederra/mogatopo/blob/master/messages/en.json"
            click Messages_FR "https://github.com/soufianenederra/mogatopo/blob/master/messages/fr.json"
        end
    end

    subgraph "Backend & Build-time Layer"
        direction TB
        subgraph "Build-time"
            direction TB
            MDX_Source["MDX Content Source (/posts/*.mdx)"]:::static
            click MDX_Source "https://github.com/soufianenederra/mogatopo/blob/master/posts/topographie.mdx"
            CL_Config["contentlayer.config.ts"]:::static
            click CL_Config "https://github.com/soufianenederra/mogatopo/blob/master/contentlayer.config.ts"
            Generated[".contentlayer/generated"]:::static
            click Generated "https://github.com/soufianenederra/mogatopo/tree/master/.contentlayer/generated"
        end
        subgraph "Serverless Runtime"
            direction TB
            NextJS_Runtime["Next.js Serverless Runtime"]:::runtime
            Public_Assets["Public Assets (public/)"]:::static
            click Public_Assets "https://github.com/soufianenederra/mogatopo/tree/master/public/svg/"
            subgraph "API Routes"
                direction TB
                Booking_API["POST /api/booking"]:::runtime
                Contact_API["POST /api/contact"]:::runtime
                click Booking_API "https://github.com/soufianenederra/mogatopo/blob/master/app/api/booking/route.ts"
                click Contact_API "https://github.com/soufianenederra/mogatopo/blob/master/app/api/contact/route.ts"
            end
        end
    end

    subgraph "External Services"
        direction TB
        Email_Service["Email Service/CRM"]:::external
    end

    %% Relationships
    MDX_Source -->|ingest at build| CL_Config -->|generates| Generated
    Generated -->|bundled| Public_Assets
    Generated -->|import hooks| AR
    Public_Assets -->|CDN| Client
    Client -->|"fetch('/api/booking')"| Booking_API
    Client -->|"fetch('/api/contact')"| Contact_API
    Booking_API -->|calls| Email_Service
    Contact_API -->|calls| Email_Service
    AR -->|SSR/SSG/ISR| NextJS_Runtime
    I18N_Config -->|loads| Messages_EN
    I18N_Config -->|loads| Messages_FR
    NextJS_Runtime --> Generated

    %% Styles
    classDef static fill:#e0f7e9,stroke:#2e7d32,color:#2e7d32;
    classDef runtime fill:#e3f2fd,stroke:#1565c0,color:#1565c0;
    classDef external fill:#fff3e0,stroke:#ef6c00,color:#ef6c00;
```
