How bryaneaton13/shadcn-next-link-pagination works
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