# nabit23/course-creative-portfolio-next architecture

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

- Interactive diagram: https://gitdiagram.com/nabit23/course-creative-portfolio-next
- Repository: https://github.com/nabit23/course-creative-portfolio-next

## Overview

##### Main Components
- Frontend – Built with Next.js:
- This is realized through the src/app directory which includes the main pages, dynamic route segments (e.g., [uid]), layouts, and dedicated sections (blog, project, slice simulator).
- The app leverages Next.js API routes found under src/app/api (e.g., preview, exit-preview, revalidate) to control content previewing and live content updates.
- Content Management Integration – Prismic CMS:
- Custom content types are defined in the customtypes folder. Each content type (blog_post, homepage, page, project, settings) has its own JSON configuration.
- The slices directory (src/slices) contains various slice components (e.g., Biography, Hero, TechList) complete with mock data and models. This, along with the slicemachine.config.json, signifies integration with Prismic's Slice Machine.
- 3D and Animation Components:
- The project name indicates 3D creative content, which uses Three.js (for 3D scenes) and GSAP (for animations). Although these libraries are referenced via the tutorial and course documentation in the README, highlight them as dedicated components for rendering and animating portfolio content.
- Public Assets and Media:
- The public directory contains assets like HDR file for environment mapping ("smallroom.hdr") and sound effects. These contribute as supporting media used in the interactive and 3D sections.
- Utility and Configurations:
- Utility functions under src/utils (e.g., formatting dates).

##### Relationships and Interactions
- The Frontend interacts with the Prismic CMS in two primary ways:
- During build-time and/or runtime API calls (using fetch / Next.js API routes) to retrieve or update content.
- The dynamic rendering of slices/components that compose the pages (using data from slice models and mocks).
- API Routes handle specialized content scenarios:
- Preview mode, content revalidation, and exit-preview endpoints form an integral layer allowing live content collaboration and updates.
- 3D/Animation Components are embedded within the Next.js pages:
- Configuration and Utility Layers are “injected” across components:
- Global CSS and Tailwind act as the styling backbone across pages while shared utilities help format data or process content before rendering.

##### Architectural Patterns and Design Principles
- Modular and Component-Driven Design:
- Every part of the UI is broken down into logically grouped components (e.g., Header, Footer, Button) and slices.
- Dynamic Routing and API Abstractions:
- Next.js file-based routing (dynamic routes like [uid]) combined with API endpoints provides flexibility in content rendering.
- Integration with External CMS via Slice Machine:
- Use of Prismic’s custom types and slices is a key architectural choice, influencing how the application decouples content creation from presentation.
- Separation of Concerns:
- Clear divisions between layout, presentation, API handling, and utility aspects ensure maintainability.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Layer"
        FE["Next.js Frontend (src/app)"]:::frontend
        API["API Endpoints (src/app/api)"]:::api
    end

    subgraph "CMS Integration"
        CMS_CT["Prismic CMS Custom Content Types"]:::cms
        CMS_S["Prismic Slice Components"]:::cms
    end

    subgraph "3D and Animation"
        ANIM["3D/Animation Components (slice simulator, Three.js, GSAP)"]:::animation
    end

    subgraph "Supporting Modules"
        ASSETS["Public Assets (media)"]:::assets
        UTILS["Utility Functions (src/utils)"]:::utility
        subgraph "Configuration Files"
            NEXT["next.config.js"]:::config
            TAILWIND["tailwind.config.ts"]:::config
            TSC["tsconfig.json"]:::config
            SM["slicemachine.config.json"]:::config
        end
    end

    API -->|"API_Call"| FE
    CMS_CT -->|"Content"| FE
    CMS_S -->|"Slices"| FE
    FE -->|"Render_Animation"| ANIM
    UTILS -->|"Format_Data"| FE
    ASSETS -->|"Load_Media"| FE
    NEXT -->|"Config"| FE
    TAILWIND -->|"Styles"| FE
    TSC -->|"Types"| FE
    SM -->|"Slice_Config"| FE

    click FE "https://github.com/nabit23/course-creative-portfolio-next/tree/master/src/app"
    click API "https://github.com/nabit23/course-creative-portfolio-next/tree/master/src/app/api"
    click CMS_CT "https://github.com/nabit23/course-creative-portfolio-next/tree/master/customtypes"
    click CMS_S "https://github.com/nabit23/course-creative-portfolio-next/tree/master/src/slices"
    click ANIM "https://github.com/nabit23/course-creative-portfolio-next/blob/master/src/app/slice-simulator/page.tsx"
    click ASSETS "https://github.com/nabit23/course-creative-portfolio-next/tree/master/public"
    click UTILS "https://github.com/nabit23/course-creative-portfolio-next/tree/master/src/utils"
    click NEXT "https://github.com/nabit23/course-creative-portfolio-next/blob/master/next.config.js"
    click TAILWIND "https://github.com/nabit23/course-creative-portfolio-next/blob/master/tailwind.config.ts"
    click TSC "https://github.com/nabit23/course-creative-portfolio-next/blob/master/tsconfig.json"
    click SM "https://github.com/nabit23/course-creative-portfolio-next/blob/master/slicemachine.config.json"

    classDef frontend fill:#FAD4D4,stroke:#B22222,stroke-width:2px;
    classDef api fill:#D4FAD4,stroke:#228B22,stroke-width:2px;
    classDef cms fill:#D4E4FA,stroke:#1E90FF,stroke-width:2px;
    classDef animation fill:#FFF4D4,stroke:#DAA520,stroke-width:2px;
    classDef assets fill:#E4D4FA,stroke:#8A2BE2,stroke-width:2px;
    classDef utility fill:#F4F4D4,stroke:#B8860B,stroke-width:2px;
    classDef config fill:#FAD4FA,stroke:#C71585,stroke-width:2px;
```
