How soufianenederra/mogatopo works
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