Web Frameworks Mastery
Build modern full-stack applications with Next.js App Router and Turborepo monorepo.
Framework Selection
| Need |
Choose |
| Single full-stack app |
Next.js standalone |
| Multiple apps sharing code |
Next.js + Turborepo monorepo |
| Static marketing site |
Next.js with SSG |
| SaaS with dashboard |
Next.js App Router + RSC |
| API-only backend |
Use Rust-backend-advance (Axum) instead |
Quick Start
# Single app
npx create-next-app@latest my-app
cd my-app && npm run dev
# Monorepo
npx create-turbo@latest my-monorepo
cd my-monorepo && npm run dev
Reference Navigation
Next.js
- App Router Architecture — Routing, layouts, pages, loading/error states, parallel routes
- Server Components — RSC patterns, client vs server, streaming, use client/server
- Data Fetching — fetch, caching, revalidation, server actions, loading.tsx
- Optimization — Images, fonts, scripts, bundle analysis, PPR, metadata/SEO
Turborepo
- Monorepo Setup — Workspace config, package structure, shared dependencies
- Pipelines & Caching — Task dependencies, remote cache, parallel execution
Key Patterns
App Router Structure
app/
├── layout.tsx # Root layout (wraps all pages)
├── page.tsx # Home page (/)
├── loading.tsx # Loading UI
├── error.tsx # Error boundary
├── not-found.tsx # 404 page
├── dashboard/
│ ├── layout.tsx # Dashboard layout
│ ├── page.tsx # /dashboard
│ └── settings/
│ └── page.tsx # /dashboard/settings
└── api/
└── users/
└── route.ts # API route handler
Server Component (default)
// app/users/page.tsx — Server Component (no "use client")
export default async function UsersPage() {
const users = await fetch('https://api.example.com/users', {
next: { revalidate: 3600 } // ISR: refresh every hour
}).then(r => r.json())
return (
<main>
<h1>Users</h1>
{users.map(u => <UserCard key={u.id} user={u} />)}
</main>
)
}
Client Component
"use client"
import { useState } from 'react'
export function Counter() {
const [count, setCount] = useState(0)
return <button => setCount(c => c + 1)}>Count: {count}</button>
}
Monorepo Structure
my-monorepo/
├── apps/
│ ├── web/ # Customer-facing Next.js
│ ├── admin/ # Admin dashboard Next.js
│ └── docs/ # Documentation
├── packages/
│ ├── ui/ # Shared components
│ ├── config/ # ESLint, TypeScript configs
│ └── types/ # Shared types
├── turbo.json
└── package.json
Best Practices
Next.js: Default to Server Components, use "use client" only when needed. Implement proper loading/error states. Use Image component for optimization. Set metadata for SEO.
Turborepo: Clear separation (apps/ + packages/). Define task dependencies correctly. Enable remote caching. Use --filter for targeted builds.
Related Skills
1---2name: nextjs-turborepo3description: Full-stack web frameworks — Next.js 15 (App Router, Server Components, RSC, PPR, SSR/SSG/ISR), Turborepo (monorepo, task pipelines, remote caching). Use for building React applications, server-side rendering, monorepo management, build optimization, and full-stack TypeScript projects.4license: MIT5---67# Web Frameworks Mastery89Build modern full-stack applications with Next.js App Router and Turborepo monorepo.1011## Framework Selection1213| Need | Choose |14|------|--------|15| Single full-stack app | Next.js standalone |16| Multiple apps sharing code | Next.js + Turborepo monorepo |17| Static marketing site | Next.js with SSG |18| SaaS with dashboard | Next.js App Router + RSC |19| API-only backend | Use `Rust-backend-advance` (Axum) instead |2021## Quick Start2223```bash24# Single app25npx create-next-app@latest my-app26cd my-app && npm run dev2728# Monorepo29npx create-turbo@latest my-monorepo30cd my-monorepo && npm run dev31```3233## Reference Navigation3435### Next.js36- **[App Router Architecture](references/nextjs-app-router.md)** — Routing, layouts, pages, loading/error states, parallel routes37- **[Server Components](references/nextjs-server-components.md)** — RSC patterns, client vs server, streaming, use client/server38- **[Data Fetching](references/nextjs-data-fetching.md)** — fetch, caching, revalidation, server actions, loading.tsx39- **[Optimization](references/nextjs-optimization.md)** — Images, fonts, scripts, bundle analysis, PPR, metadata/SEO4041### Turborepo42- **[Monorepo Setup](references/turborepo-setup.md)** — Workspace config, package structure, shared dependencies43- **[Pipelines & Caching](references/turborepo-pipelines.md)** — Task dependencies, remote cache, parallel execution4445## Key Patterns4647### App Router Structure48```49app/50├── layout.tsx # Root layout (wraps all pages)51├── page.tsx # Home page (/)52├── loading.tsx # Loading UI53├── error.tsx # Error boundary54├── not-found.tsx # 404 page55├── dashboard/56│ ├── layout.tsx # Dashboard layout57│ ├── page.tsx # /dashboard58│ └── settings/59│ └── page.tsx # /dashboard/settings60└── api/61 └── users/62 └── route.ts # API route handler63```6465### Server Component (default)66```tsx67// app/users/page.tsx — Server Component (no "use client")68export default async function UsersPage() {69 const users = await fetch('https://api.example.com/users', {70 next: { revalidate: 3600 } // ISR: refresh every hour71 }).then(r => r.json())7273 return (74 <main>75 <h1>Users</h1>76 {users.map(u => <UserCard key={u.id} user={u} />)}77 </main>78 )79}80```8182### Client Component83```tsx84"use client"85import { useState } from 'react'8687export function Counter() {88 const [count, setCount] = useState(0)89 return <button onClick={() => setCount(c => c + 1)}>Count: {count}</button>90}91```9293### Monorepo Structure94```95my-monorepo/96├── apps/97│ ├── web/ # Customer-facing Next.js98│ ├── admin/ # Admin dashboard Next.js99│ └── docs/ # Documentation100├── packages/101│ ├── ui/ # Shared components102│ ├── config/ # ESLint, TypeScript configs103│ └── types/ # Shared types104├── turbo.json105└── package.json106```107108## Best Practices109110**Next.js:** Default to Server Components, use `"use client"` only when needed. Implement proper loading/error states. Use Image component for optimization. Set metadata for SEO.111112**Turborepo:** Clear separation (apps/ + packages/). Define task dependencies correctly. Enable remote caching. Use `--filter` for targeted builds.113114## Related Skills115116| Skill | When to Use |117|-------|-------------|118| [ui-styling](../ui-styling/SKILL.md) | Tailwind CSS, shadcn/ui components |119| [frontend-design](../frontend-design/SKILL.md) | Design tokens, typography, color systems |120| [authentication](../authentication/SKILL.md) | Next.js authentication setup |121| [testing](../testing/SKILL.md) | E2E testing with Playwright |122| [devops](../devops/SKILL.md) | Deployment, Vercel, Docker |