# yarc7/landing-page architecture

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

- Interactive diagram: https://gitdiagram.com/yarc7/landing-page
- Repository: https://github.com/yarc7/landing-page

## Overview

##### And break down the core system components
- Presentation/Frontend Layer:
- Next.js Pages: Located under src/app (e.g., Home, About, Projects, Contact, Dynamic [slug]).
- UI Components: In the src/components directory (e.g., Navbar, Menu, Slider, Filter, etc.).
- Styling: Tailwind CSS configuration (tailwind.config.ts) ensures consistent design.
- Business Logic / State Management:
- Redux Store: Visible in the src/lib/features with languageSlice and themeSlice.
- Actions & Utilities: Found in src/actions, src/hooks, src/lib, and src/context for shared business logic and state propagation.
- Data Access Layer:
- Prisma: This is a crucial piece given your specific instruction. The prisma directory houses migration files, schema definitions, and generated Prisma clients, which serve as the gateway to your underlying database.
- Database Connection: Also note the presence of src/prisma-db.ts that likely handles database interactions using Prisma.
- External Services:
- Wix Integration: Through src/context/wixContext.tsx and src/hooks/useWixClient.tsx, external content is integrated from Wix CMS.
- Configuration and Development Settings:
- Next.js configuration (next.config.mjs) and other settings (e.g., ESLint, TypeScript configurations).

##### Relationships and Interactions
- The Presentation Layer (Next.js pages and UI components) interacts with the Business Logic (Redux store) to render dynamic content.
- User-triggered events in UI components dispatch actions that update the Redux store, which in turn may trigger API calls or data modifications.
- For data storage or retrieval, the Business Logic layer calls functions encapsulated in the Prisma layer (data access), communicating with the database. These operations are facilitated by prisma-generated clients, ensuring strong typing and easy migrations.
- Any external content from Wix is fetched via the Wix integration layer (perhaps through custom hooks and context) and injected into the application state for rendering.
- Configuration files (e.g., tailwind, next.config, tsconfig) are used to set up the necessary environments that support the other layers.

##### Architectural Patterns and Technologies
- Clear separation of concerns is demonstrated by the split between presentation, business logic, and data access.
- The use of Redux for state management emphasizes unidirectional data flow.
- Prisma represents the ORM pattern, simplifying database migrations and interactions.
- Next.js’s routing and file-based page system provide clear delineation of view components.
- Integration with external services (Wix) is handled via context/hook patterns to encapsulate API calls and state management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        NX["Next.js Pages"]:::frontend
        UI["UI Components"]:::frontend
        TW["Tailwind CSS Config"]:::config
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        LS["Language Slice"]:::backend
        TS["Theme Slice"]:::backend
        RS["Redux Store"]:::backend
        ACTS["Actions & Utilities"]:::backend
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        PC["Database Connection (src/prisma-db.ts)"]:::database
        PRISMA["Prisma ORM & Migrations"]:::database
        DB["Database"]:::databaseCylinder
    end

    %% External Services
    subgraph "External Services"
        WIXCTX["Wix CMS Context"]:::external
        WIXHOOK["Wix Custom Hook"]:::external
    end

    %% Configuration / Infrastructure
    subgraph "Configuration/Infrastructure"
        NXCONFIG["Next.js Config"]:::config
        TSCONFIG["TypeScript Config"]:::config
        ESLINT["ESLint Config"]:::config
        POSTCSS["PostCSS Config"]:::config
    end

    %% Connections within Layers
    NX -->|"dispatches"| RS
    UI -->|"triggers"| RS
    TW --- NX

    LS --> RS
    TS --> RS
    ACTS --> RS

    RS -->|"uses"| PC
    PC -->|"invokes"| PRISMA
    PRISMA -->|"operates on"| DB

    WIXCTX -->|"feeds content"| RS
    WIXHOOK -->|"fetches data"| RS

    NXCONFIG -->|"configures"| NX
    TSCONFIG -->|"configures"| NX
    ESLINT -->|"enforces rules"| NX
    POSTCSS -->|"processes styles"| NX

    %% Class definitions for styling
    classDef frontend fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef database fill:#FFECB3,stroke:#F9A825,stroke-width:2px;
    classDef databaseCylinder fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px,stroke-dasharray: 5 5;
    classDef external fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
    classDef config fill:#FFCDD2,stroke:#C62828,stroke-width:2px;

    %% Click Events for Presentation Layer
    click NX "https://github.com/yarc7/landing-page/blob/main/src/app/page.tsx"
    click UI "https://github.com/yarc7/landing-page/tree/main/src/components"
    click TW "https://github.com/yarc7/landing-page/blob/main/tailwind.config.ts"

    %% Click Events for Business Logic Layer
    click LS "https://github.com/yarc7/landing-page/blob/main/src/lib/features/language/languageSlice.ts"
    click TS "https://github.com/yarc7/landing-page/blob/main/src/lib/features/theme/themeSlice.ts"
    click RS "https://github.com/yarc7/landing-page/blob/main/src/lib/store.ts"
    click ACTS "https://github.com/yarc7/landing-page/blob/main/src/actions/product.ts"
    click ACTS "https://github.com/yarc7/landing-page/blob/main/src/lib/utils.ts"
    click ACTS "https://github.com/yarc7/landing-page/tree/main/src/hooks"
    click ACTS "https://github.com/yarc7/landing-page/tree/main/src/context"

    %% Click Events for Data Access Layer
    click PC "https://github.com/yarc7/landing-page/blob/main/src/prisma-db.ts"
    click PRISMA "https://github.com/yarc7/landing-page/tree/main/prisma"

    %% Click Events for External Services
    click WIXCTX "https://github.com/yarc7/landing-page/blob/main/src/context/wixContext.tsx"
    click WIXHOOK "https://github.com/yarc7/landing-page/blob/main/src/hooks/useWixClient.tsx"

    %% Click Events for Configuration / Infrastructure
    click NXCONFIG "https://github.com/yarc7/landing-page/blob/main/next.config.mjs"
    click TSCONFIG "https://github.com/yarc7/landing-page/blob/main/tsconfig.json"
    click ESLINT "https://github.com/yarc7/landing-page/blob/main/.eslintrc.json"
    click POSTCSS "https://github.com/yarc7/landing-page/blob/main/postcss.config.mjs"
```
