# iku-earth/terrum-home-site architecture

> Architecture diagram of the GitHub repository iku-earth/terrum-home-site, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iku-earth/terrum-home-site
- Repository: https://github.com/iku-earth/terrum-home-site

## Overview

##### Project Type and Purpose
- This is a full-stack web application built with Next.js (React + Node.js).
- It serves a marketing/landing site (with pages like home, events, policies, contact us) and exposes a serverless API endpoint for handling “Contact Us” form submissions.

##### File Structure Analysis
- app/ (Next.js App Directory)
- page.tsx and subfolders: React Server Components for each route (home, events/[id], cancellation-policy, privacy, etc.)
- api/submit-contact-us-form/route.ts: serverless function (Node.js) for form submissions
- layout.tsx: global layout wrapper
- globals.css: global stylesheet
- components/
- landing/: reusable landing-page sections (header, welcome, focus, carousel, etc.)
- ui/: design system primitives (Button, Card, Input, Form, etc.)
- other shared React components (contact-form.tsx, experience-card.tsx, footer, warning-stripes, etc.)
- lib/utils.ts and utils/fonts.ts: shared business logic and font configuration
- config files: next.config.js, tailwind.config.js, tsconfig.json, postcss.config.js
- package.json / lock file: dependencies and scripts

##### Key Architectural Patterns
- Monorepo-style single Next.js app combining SSR/SSG pages and API routes.
- Component-driven UI with a separation between design system primitives (components/ui) and use-case-specific sections (components/landing).
- Serverless backend via Next.js API Routes, deployed on Vercel.
- Static asset hosting (public/) and CSS utility framework (Tailwind CSS).

##### Main Components
a. Browser (client)
b. CDN / Edge Network (Vercel)
c. Next.js Application Server (serverless)
- React Server Components (app/pages)
- API Route: submit-contact-us-form
- Layout and CSS pipeline (global styles, Tailwind)
d. Component Library
- UI primitives
- Landing page sections
e. Static Assets Store (public/)
f. External Services (optionally)
- Email service or CRM for form data (if used by route.ts)
- Analytics, if integrated later

##### Relationships and Data Flows
1. Client → CDN: requests HTML/CSS/JS, images, fonts
2. CDN → Next.js Serverless: SSR or SSG page rendering
3. Next.js → Public assets: serves static files
4. Client UI Components ←→ React Server Components / Props
5. Client → API Route (POST /api/submit-contact-us-form)
6. API Route → External Service (e.g., email/CRM)
7. Response → Client (success/failure UI)

##### Essential Elements Checklist
- Shaded grouping for related folders (e.g., all UI components in one cluster)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Browser["Browser"]:::frontend

    %% CDN/Edge Layer
    CDN["CDN (Vercel Edge)"]:::edge

    %% Application Server Layer
    subgraph "Next.js App Server (SSR/SSG & API)" 
        direction TB
        Layout["app/layout.tsx\n+ globals.css"]:::server
        HomePage["Home Page\napp/page.tsx"]:::server
        EventDetail["Event Detail Page\napp/events/[eventId]/page.tsx"]:::server
        Cancellation["Cancellation Policy Page\napp/cancellation-policy/page.tsx"]:::server
        ContactUsPage["Contact Us Page\napp/contact-us/page.tsx"]:::server
        Privacy["Privacy Policy Page\napp/privacy/policy/page.tsx"]:::server
        Terms["Terms & Conditions Page\napp/terms-and-conditions/page.tsx"]:::server
        Robots["Robots Route\napp/robots.ts"]:::server
        Sitemap["Sitemap Route\napp/sitemap.ts"]:::server
        API["Contact Form API\nPOST /api/submit-contact-us-form\napp/api/submit-contact-us-form/route.ts"]:::backend
    end

    %% Component Library Layer
    subgraph "Component Library" 
        direction TB
        UIPrimitives["UI Primitives\ncomponents/ui"]:::library
        LandingSections["Landing Sections\ncomponents/landing"]:::library
        SharedComponents["Shared Components\ncomponents/contact-form.tsx,\nexperience-card.tsx, footer.tsx,\nwarning-stripes.tsx, vector-underline.tsx"]:::library
    end

    %% Static Assets and Config
    StaticAssets["Static Assets\npublic/"]:::static
    ConfigFiles["Build & Config\nnext.config.js,\ntailwind.config.js,\npostcss.config.js,\ntsconfig.json"]:::static
    PackageMgmt["Package Files\npackage.json,\npackage-lock.json"]:::static
    LibUtils["Business Logic\nlib/utils.ts"]:::static
    FontConfig["Font Config\nutils/fonts.ts"]:::static

    %% External Services
    External["External Services\nEmail/CRM,\nAnalytics"]:::external

    %% Connections
    Browser -->|"GET HTML/CSS/JS\n(images, fonts)"| CDN
    CDN -->|"SSR/SSG\npage render"| Layout
    Layout --> HomePage
    Layout --> EventDetail
    Layout --> Cancellation
    Layout --> ContactUsPage
    Layout --> Privacy
    Layout --> Terms
    Layout --> Robots
    Layout --> Sitemap
    HomePage --> UIPrimitives
    HomePage --> LandingSections
    EventDetail --> UIPrimitives
    Cancellation --> UIPrimitives
    ContactUsPage --> UIPrimitives
    ContactUsPage --> SharedComponents
    Layout --> FontConfig
    Layout --> LibUtils
    Layout --> ConfigFiles
    Layout --> PackageMgmt
    Layout --> StaticAssets
    StaticAssets -->|"serves static files"| Layout
    Browser -->|"POST /api/submit-contact-us-form"| API
    API -->|"invoke business logic"| LibUtils
    API --> External
    API --> Browser

    %% Legend (as a note)
    subgraph Legend
        direction LR
        A["User-Facing"]:::frontend
        B["Backend/Server"]:::server
        C["Serverless/API"]:::backend
        D["Library/Components"]:::library
        E["Static/Config"]:::static
        F["External"]:::external
    end

    %% Click Events
    click Layout "https://github.com/iku-earth/terrum-home-site/blob/main/app/layout.tsx"
    click HomePage "https://github.com/iku-earth/terrum-home-site/blob/main/app/page.tsx"
    click EventDetail "https://github.com/iku-earth/terrum-home-site/blob/main/app/events/[eventId]/page.tsx"
    click Cancellation "https://github.com/iku-earth/terrum-home-site/blob/main/app/cancellation-policy/page.tsx"
    click ContactUsPage "https://github.com/iku-earth/terrum-home-site/blob/main/app/contact-us/page.tsx"
    click Privacy "https://github.com/iku-earth/terrum-home-site/blob/main/app/privacy/policy/page.tsx"
    click Terms "https://github.com/iku-earth/terrum-home-site/blob/main/app/terms-and-conditions/page.tsx"
    click Robots "https://github.com/iku-earth/terrum-home-site/blob/main/app/robots.ts"
    click Sitemap "https://github.com/iku-earth/terrum-home-site/blob/main/app/sitemap.ts"
    click API "https://github.com/iku-earth/terrum-home-site/blob/main/app/api/submit-contact-us-form/route.ts"
    click UIPrimitives "https://github.com/iku-earth/terrum-home-site/tree/main/components/ui"
    click LandingSections "https://github.com/iku-earth/terrum-home-site/tree/main/components/landing"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef edge fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef server fill:#d4edda,stroke:#155724,color:#155724
    classDef backend fill:#c3e6cb,stroke:#155724,color:#155724
    classDef library fill:#fff3cd,stroke:#856404,color:#856404
    classDef static fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24
```
