Marketplace next-js-patterns
Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.
install
source · Clone the upstream repo
git clone https://github.com/aiskillstore/marketplace
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/aiskillstore/marketplace "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/abdulsamad94/next-js-patterns" ~/.claude/skills/aiskillstore-marketplace-next-js-patterns && rm -rf "$T"
manifest:
skills/abdulsamad94/next-js-patterns/SKILL.mdsource content
Next.js Patterns
App Router
We use the Next.js 15 App Router located in
app/.
Pages
- Location:
app/[route]/page.tsx - Component: Default export function.
- Client vs Server: Use
directive at the top for components requiring state ("use client"
,useState
) or browser APIs. otherwise default to Server Components.useEffect
Layouts
- Location:
(Root),app/layout.tsx
(Nested).app/[route]/layout.tsx - Purpose: Wrappers for pages, holding navigation, fonts, and metadata.
Navigation
- Use
fromLink
for internal navigation.next/link - Use
fromuseRouter
for programmatic navigation (inside Client Components).next/navigation
import Link from "next/link"; import { useRouter } from "next/navigation"; // Link <Link href="/dashboard">Dashboard</Link> // Router const router = useRouter(); router.push('/login');
Data Fetching
- Server Components: Fetch directly using
or DB calls.await fetch() - Client Components: Use
or SWR/TanStack Query (if added later). Currently using standarduseEffect
infetch
.useEffect
Font Optimization
- We use
(e.g., Poppins) innext/font/google
.app/layout.tsx - Variable fonts are passed to
className.body
Metadata
- Define
inexport const metadata: Metadata = { ... }
orpage.tsx
for SEO.layout.tsx