# bryaneaton13/shadcn-next-link-pagination architecture

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

- Interactive diagram: https://gitdiagram.com/bryaneaton13/shadcn-next-link-pagination
- Repository: https://github.com/bryaneaton13/shadcn-next-link-pagination

## Overview

##### Project type and purpose
- This is a frontend-focused Next.js 13 “App Router” project that ships a reusable pagination component (`PaginationWithLinks`).
- The primary function is to render page links based on URL query parameters (`page` & `pageSize`), updating on navigation.

##### File structure
- Top-level:
- `app/` – Next.js App Router folder containing layout, pages, and server components.
- `components/ui/` – standalone UI primitives (buttons, select, pagination).
- `lib/` – utility functions (Shiki syntax highlighter, general utils).
- Config/build files: `next.config.mjs`, `tailwind.config.ts`, `postcss.config.mjs`, `biome.json`, `bun.lockb`.
- `public/` – static assets.
- Notice the split between server components (`app/page.tsx`, `app/layout.tsx`) and client UI (`components/ui/*`).

##### README
- Describes usage of `PaginationWithLinks` in both static React code and Next.js server components.
- Emphasizes dynamic URL updates and page parameter parsing.

##### Main components
a. Client Browser
b. Next.js Server (App Router runtime)
- Route Handler (app/layout.tsx & app/page.tsx)
- Data Fetching (e.g., `getDataWithCount()` inside server component)
c. UI Component Library
- `PaginationWithLinks` (in `components/ui/pagination-with-links.tsx`)
- Supporting primitives: `button`, `select`, `pagination.tsx`
d. Utilities / Third-party
- Shiki highlighter (`lib/shiki.ts`)
- Tailwind & PostCSS pipeline
e. Static Assets (`public/`)
f. Build & Tooling
- Next.js build (uses `bun` / `npm`)
- Biome / ESLint
- TypeScript config

##### Relationships and data flow
- Inside Server, show “Route Renderer” invoking data fetch (→ `lib/utils.ts` or your data source).
- Server → UI Component (`PaginationWithLinks`) passing props (page, pageSize, totalCount).
- On click of a pagination link, Browser’s router issues a new GET with updated query → cycle repeats.

##### Important architectural patterns
- Next.js App Router with Server Components feeding Client Components.
- Single-page-app navigation via query-param links rather than full page reload.
- Utility layering: UI primitives (atomic components) vs. composite component (`PaginationWithLinks`).

##### Elements
- Clear labels: e.g., “app/layout.tsx”, “PaginationWithLinks”, “tailwind.css build”.
- Server vs. client
- Build tools vs. runtime components
- Static assets vs. dynamic code

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser
    Browser["Client Browser"]:::client

    %% Next.js Server Components
    subgraph "Next.js Server (App Router)"
        Layout["app/layout.tsx"]:::server
        Page["app/page.tsx"]:::server
        Utils["lib/utils.ts"]:::utils
    end

    %% Client UI Components
    subgraph "Client UI Components"
        PW["PaginationWithLinks"]:::client
        Btn["button"]:::client
        Sel["select"]:::client
        Core["pagination core"]:::client
    end

    %% Utilities & Build Tools
    subgraph "Utilities & Build"
        Shiki["lib/shiki.ts"]:::utils
        TailwindCfg["tailwind.config.ts"]:::build
        PostCSS["postcss.config.mjs"]:::build
        NextCfg["next.config.mjs"]:::build
        Biome["biome.json"]:::build
        TSConfig["tsconfig.json"]:::build
        Package["package.json"]:::build
    end

    %% Static Assets & Styles
    subgraph "Static Assets"
        Public["public/"]:::static
        Globals["app/globals.css"]:::static
    end

    %% Data Flow
    Browser -->|"HTTP GET /?page&pageSize"| Layout
    Layout -->|"renders"| Page
    Page -->|"fetch data"| Utils
    Utils -->|"data"| Page
    Page -->|"renders UI"| PW
    PW --> Btn
    PW --> Sel
    PW --> Core
    PW -->|"client navigation"| Browser

    %% Build & Config Relationships
    TailwindCfg -->|"CSS build"| Globals
    PostCSS -->|"CSS build"| Globals
    NextCfg --> Layout
    Package --> Layout
    TSConfig --> Layout
    Biome --> Layout
    Shiki --> Utils
    Public -->|"static assets"| Browser

    %% Click Events
    click Layout "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/app/layout.tsx"
    click Page "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/app/page.tsx"
    click Utils "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/lib/utils.ts"
    click Shiki "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/lib/shiki.ts"
    click PW "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/components/ui/pagination-with-links.tsx"
    click Btn "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/components/ui/button.tsx"
    click Sel "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/components/ui/select.tsx"
    click Core "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/components/ui/pagination.tsx"
    click Globals "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/app/globals.css"
    click TailwindCfg "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/postcss.config.mjs"
    click NextCfg "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/next.config.mjs"
    click Public "https://github.com/bryaneaton13/shadcn-next-link-pagination/tree/main/public/"
    click Biome "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/biome.json"
    click Package "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/package.json"
    click TSConfig "https://github.com/bryaneaton13/shadcn-next-link-pagination/blob/main/tsconfig.json"

    %% Styles
    classDef server fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef client fill:#DFFFE0,stroke:#333,stroke-width:1px
    classDef utils fill:#FFE8A1,stroke:#333,stroke-width:1px
    classDef build fill:#FFD1D1,stroke:#333,stroke-width:1px
    classDef static fill:#E0E0E0,stroke:#333,stroke-width:1px
```
