# aykutkardas/miniature-painting architecture

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

- Interactive diagram: https://gitdiagram.com/aykutkardas/miniature-painting
- Repository: https://github.com/aykutkardas/miniature-painting

## Overview

##### Project type and purpose
- This is a Next.js-based web application using the new “app” router (App Directory) and React Server/Client Components.
- Its purpose is to render React pages (some server‐rendered, some hydrated client components), serve static assets, and deploy easily on platforms like Vercel.

##### File structure
- Top-level config & metadata:
- .gitignore, package.json/package-lock.json, tsconfig.json, eslint.config.mjs, postcss.config.mjs, next.config.ts
- Public assets:
- public/
- Application code under src/:
- src/app/ – App Directory (file-based routing)
– layout.tsx (root layout)
– page.tsx (root page)
– globals.css (global styles)
– components/ (page-specific components: bottom-bar.tsx, painting-board.tsx)
- src/components/ui/ – Shared UI primitives (Button, Popover, Slider, Tooltip)
- src/lib/utils.ts – Utility functions

##### README for insights
- Confirms standard Next.js stack: React, file-based routing, next/font integration, hot-reload dev server, Vercel deployment target.
- No backend/API routes or database layers in this minimal scaffold.

##### Main components & their interactions
a. Next.js Server (Node.js runtime)
- Listens for HTTP requests, resolves file-based routes in src/app, renders appropriate React Server Components into HTML.
- Serves static assets from public/.
- Applies postcss during the build, bundles with Webpack/Turbopack.
b. React Server Components (in app/page.tsx, layout.tsx, etc.)
- Execute on the server, generate HTML shell and data.
c. React Client Components (components using state/events, e.g. painting-board.tsx or any “use client” tagged files)
- Hydrate on the browser, handle interactivity.
d. Shared UI Library (src/components/ui)
- Imported by both server and client components for consistent look & feel.
e. Public assets
- Static images/fonts served directly by the server.
f. Utilities (src/lib/utils.ts)
- Business-logic/helpers invoked by components on server or client.

##### Architectural patterns & design principles
- File-based routing → automatic registration of pages.
- Server vs Client Components → separation of rendering and interactivity.
- Component library (atomic design) → UI primitives separated into src/components/ui.
- Global CSS + component-scoped styling.
- Zero-API (no custom API routes) in this scaffold; would slot in an /src/app/api folder if added.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External
    HTTP["HTTP Request"]:::external
    CI_CD["CI/CD Pipeline"]:::external

    %% Server Side
    subgraph "Server-Side" 
        direction TB
        NextServer["Next.js Server (Node.js)"]:::server
        NextConfig["next.config.ts"]:::dev
    end

    %% File Router & Server Components
    subgraph "File-Based Router" 
        direction TB
        Router["📁 src/app/"]:::server
        Page["page.tsx"]:::server
        Layout["layout.tsx"]:::server
        GlobalsCSS["globals.css"]:::static
    end

    %% Client Components
    subgraph "Client-Side Components"
        direction TB
        PaintBoard["painting-board.tsx"]:::client
        BottomBar["bottom-bar.tsx"]:::client
    end

    %% Shared UI Library
    subgraph "UI Library (Primitives)"
        direction TB
        Button["button.tsx"]:::client
        Popover["popover.tsx"]:::client
        Slider["slider.tsx"]:::client
        Tooltip["tooltip.tsx"]:::client
    end

    %% Utilities
    Utils["src/lib/utils.ts"]:::server

    %% Public Assets
    Public["public/"]:::static

    %% Build Tools
    subgraph "Build Tools & Config"
        direction TB
        ESLint["eslint.config.mjs"]:::dev
        PostCSS["postcss.config.mjs"]:::dev
        TSConfig["tsconfig.json"]:::dev
        Package["package.json"]:::dev
    end

    %% Deployment
    Vercel["Vercel Deployment"]:::external

    %% Browser
    Browser["Browser (HTML+JS Bundle)"]:::external

    %% Flows
    HTTP -->|"requests"| NextServer
    NextServer -->|"resolves routes"| Router
    Router --> Page
    Router --> Layout
    NextServer -->|"serves static"| Public
    Page -->|"renders HTML+JS"| Browser
    Layout -->|"provides shell"| Browser
    Browser -->|"hydrates"| PaintBoard
    Browser -->|"hydrates"| BottomBar

    %% Imports (dashed)
    Page -.->|imports| Button
    Page -.->|imports| Popover
    Layout -.->|imports| Slider
    Layout -.->|imports| Tooltip
    PaintBoard -.->|imports| Utils
    BottomBar -.->|imports| Utils
    PaintBoard -.->|imports| Button
    BottomBar -.->|imports| Slider

    %% Build & Deploy
    CI_CD -->|"runs"| ESLint
    CI_CD -->|"runs"| PostCSS
    CI_CD -->|"validates"| TSConfig
    CI_CD -->|"installs"| Package
    CI_CD -->|"builds & deploys"| Vercel

    %% Config connection
    NextConfig -.-> NextServer

    %% Click Events
    click NextConfig "https://github.com/aykutkardas/miniature-painting/blob/main/next.config.ts"
    click Router "https://github.com/aykutkardas/miniature-painting/tree/main/src/app/"
    click Page "https://github.com/aykutkardas/miniature-painting/blob/main/src/app/page.tsx"
    click Layout "https://github.com/aykutkardas/miniature-painting/blob/main/src/app/layout.tsx"
    click PaintBoard "https://github.com/aykutkardas/miniature-painting/blob/main/src/app/components/painting-board.tsx"
    click BottomBar "https://github.com/aykutkardas/miniature-painting/blob/main/src/app/components/bottom-bar.tsx"
    click Button "https://github.com/aykutkardas/miniature-painting/blob/main/src/components/ui/button.tsx"
    click Popover "https://github.com/aykutkardas/miniature-painting/blob/main/src/components/ui/popover.tsx"
    click Slider "https://github.com/aykutkardas/miniature-painting/blob/main/src/components/ui/slider.tsx"
    click Tooltip "https://github.com/aykutkardas/miniature-painting/blob/main/src/components/ui/tooltip.tsx"
    click Utils "https://github.com/aykutkardas/miniature-painting/blob/main/src/lib/utils.ts"
    click GlobalsCSS "https://github.com/aykutkardas/miniature-painting/blob/main/src/app/globals.css"
    click ESLint "https://github.com/aykutkardas/miniature-painting/blob/main/eslint.config.mjs"
    click PostCSS "https://github.com/aykutkardas/miniature-painting/blob/main/postcss.config.mjs"
    click TSConfig "https://github.com/aykutkardas/miniature-painting/blob/main/tsconfig.json"
    click Package "https://github.com/aykutkardas/miniature-painting/blob/main/package.json"

    %% Styles
    classDef server fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef client fill:#90EE90,stroke:#333,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef dev fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px
```
