# jim788e/mooz-website architecture

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

- Interactive diagram: https://gitdiagram.com/jim788e/mooz-website
- Repository: https://github.com/jim788e/mooz-website

## Overview

##### Project Type and Purpose
- This is a full-stack modern web application built with Next.js 15 (App Router) and TailwindCSS.
- It serves as a marketing and analytics site for the MOOZ NFT Collection on the SEI blockchain, featuring real-time stats via the Magic Eden API, static content (terms, privacy), interactive UI components, and optimized image delivery.

##### File Structure
- Top-level “app/” directory follows Next.js 15 conventions:
- app/page.tsx, app/layout.tsx, app/globals.css → root layout, global styles, home page
- app/api/lib → library code for external API calls (magiceden.ts, tallal-test.ts)
- app/api/stats/route.ts → server route that fetches NFT stats
- app/components & app/components/ui → reusable React components (shadcn/ui buttons, NavLink, Footer, StatsSection)
- app/privacy, app/terms & nested pages → static content routes
- “public/images” → static image assets organized by feature
- “lib/utils.ts” → shared utilities
- Config files: next.config.*, tailwind.config.js, tsconfig.json, ESLint, PostCSS, .env.example

##### README for Additional Insights
- Confirms Next.js + App Router, TailwindCSS, shadcn/ui
- Highlights external dependencies: Magic Eden API (for NFT stats), SEI blockchain integration, Vercel Analytics

##### Main Components
a. Client-Side Frontend (Next.js React app)
b. Server-Side API Routes (app/api/**)
c. External Services:
- Magic Eden API (real-time NFT marketplace data)
- SEI Blockchain (NFT contract interactions)
- Vercel Analytics (performance monitoring)
d. Static Asset Store (public/images)

##### Relationships and Data Flow
- User (browser) → HTTP(S) → Vercel Edge → Next.js app
- Static page requests (terms, privacy, home) served via SSG/SSR
- Dynamic data requests (stats) hit internal API route (/api/stats)
- Internal API (/api/stats) → lib/magiceden.ts → calls Magic Eden REST API → returns JSON
- Next.js server-side renders (or client-side fetches) UI with fetched stats
- Analytics events sent to Vercel Analytics
- All components share utilities (lib/utils.ts) & styles (TailwindCSS)

##### Architectural Patterns and Design Principles
- App Router structure for clear routing & layout separation
- “API Routes as Micro-Endpoints” pattern: single-purpose serverless functions
- Component-based UI (shadcn/ui, custom components) encourages reusability
- Static asset optimization (Next.js Image, AVIF/WebP)
- Environment variables for API keys (.env)

## Diagram (Mermaid)

```mermaid
flowchart TD
    User[/"User"/]:::external

    subgraph "Vercel Hosting / Edge Runtime"
        direction TB
        subgraph "Next.js Frontend"
            direction TB
            Page["app/page.tsx\n(app/layout & globals.css)"]:::internal
            Privacy["app/privacy/page.tsx"]:::internal
            Terms["app/terms/page.tsx"]:::internal
            Staking["app/terms/staking/page.tsx"]:::internal
            NavLink["NavLink.tsx"]:::internal
            Footer["Footer.tsx"]:::internal
            StatsSec["StatsSection.tsx"]:::internal
            Button["button.tsx"]:::internal
            util["lib/utils.ts"]:::internal
        end
        subgraph "Next.js API Routes"
            direction TB
            StatsRoute["app/api/stats/route.ts"]:::internal
            MagicLib["app/api/lib/magiceden.ts"]:::internal
            TestLib["app/api/lib/tallal-test.ts"]:::internal
        end
    end

    Static["Static Assets (public/images)"]:::asset

    MagicEden["Magic Eden API"]:::external
    SEI["SEI Blockchain RPC"]:::external
    VercelAn["Vercel Analytics"]:::external

    User -->|"HTTP GET"| Page
    Page -->|"fetch /api/stats"| StatsRoute
    StatsRoute -->|"calls REST"| MagicLib
    StatsRoute -->|"uses RPC"| SEI
    Page -->|"telemetry"| VercelAn
    StatsRoute -->|"telemetry"| VercelAn
    Page --> Static
    util --> Page
    util --> StatsRoute

    click Page "https://github.com/jim788e/mooz-website/blob/main/app/page.tsx"
    click Privacy "https://github.com/jim788e/mooz-website/blob/main/app/privacy/page.tsx"
    click Terms "https://github.com/jim788e/mooz-website/blob/main/app/terms/page.tsx"
    click Staking "https://github.com/jim788e/mooz-website/blob/main/app/terms/staking/page.tsx"
    click NavLink "https://github.com/jim788e/mooz-website/blob/main/app/components/NavLink.tsx"
    click Footer "https://github.com/jim788e/mooz-website/blob/main/app/components/Footer.tsx"
    click StatsSec "https://github.com/jim788e/mooz-website/blob/main/app/components/StatsSection.tsx"
    click Button "https://github.com/jim788e/mooz-website/blob/main/app/components/ui/button.tsx"
    click StatsRoute "https://github.com/jim788e/mooz-website/blob/main/app/api/stats/route.ts"
    click MagicLib "https://github.com/jim788e/mooz-website/blob/main/app/api/lib/magiceden.ts"
    click TestLib "https://github.com/jim788e/mooz-website/blob/main/app/api/lib/tallal-test.ts"
    click util "https://github.com/jim788e/mooz-website/blob/main/lib/utils.ts"
    click Static "https://github.com/jim788e/mooz-website/tree/main/public/images/"

    classDef internal fill:#e6ffed,stroke:#2d7a2d,color:#000
    classDef external fill:#e6f0ff,stroke:#1a4f8a,color:#000
    classDef asset fill:#fff5cc,stroke:#a68b00,color:#000
```
