Next.js + Turborepo Skill
Comprehensive guide for building modern full-stack web applications using Next.js, Turborepo, and RemixIcon.
Overview
This skill group combines three powerful tools for web development:
Next.js - React framework with SSR, SSG, RSC, and optimization features
Turborepo - High-performance monorepo build system for JavaScript/TypeScript
RemixIcon - Icon library with 3,100+ outlined and filled style icons
When to Use This Skill Group
- Building new full-stack web applications with modern React
- Setting up monorepos with multiple apps and shared packages
- Implementing server-side rendering and static generation
- Optimizing build performance with intelligent caching
- Creating consistent UI with professional iconography
- Managing workspace dependencies across multiple projects
- Deploying production-ready applications with proper optimization
Stack Selection Guide
Single Application: Next.js + RemixIcon
Use when building a standalone application:
- E-commerce sites
- Marketing websites
- SaaS applications
- Documentation sites
- Blogs and content platforms
Setup:
npx create-next-app@latest my-app
cd my-app
npm install remixicon
Monorepo: Next.js + Turborepo + RemixIcon
Use when building multiple applications with shared code:
- Microfrontends
- Multi-tenant platforms
- Internal tools with shared component library
- Multiple apps (web, admin, mobile-web) sharing logic
- Design system with documentation site
Setup:
npx create-turbo@latest my-monorepo
# Then configure Next.js apps in apps/ directory
# Install remixicon in shared UI packages
Framework Features Comparison
| Feature |
Next.js |
Turborepo |
RemixIcon |
| Primary Use |
Web framework |
Build system |
UI icons |
| Best For |
SSR/SSG apps |
Monorepos |
Consistent iconography |
| Performance |
Built-in optimization |
Caching & parallel tasks |
Lightweight fonts/SVG |
| TypeScript |
Full support |
Full support |
Type definitions available |
Quick Start
Next.js Application
# Create new project
npx create-next-app@latest my-app
cd my-app
# Install RemixIcon
npm install remixicon
# Import in layout
# app/layout.tsx
import 'remixicon/fonts/remixicon.css'
# Start development
npm run dev
Turborepo Monorepo
# Create monorepo
npx create-turbo@latest my-monorepo
cd my-monorepo
# Structure:
# apps/web/ - Next.js application
# apps/docs/ - Documentation site
# packages/ui/ - Shared components with RemixIcon
# packages/config/ - Shared configs
# turbo.json - Pipeline configuration
# Run all apps
npm run dev
# Build all packages
npm run build
RemixIcon Integration
// Webfont (HTML/CSS)
<i className="ri-home-line"></i>
<i className="ri-search-fill ri-2x"></i>
// React component
import { RiHomeLine, RiSearchFill } from "@remixicon/react"
<RiHomeLine size={24} />
<RiSearchFill size={32} color="blue" />
Reference Navigation
Next.js References:
- App Router Architecture - Routing, layouts, pages, parallel routes
- Server Components - RSC patterns, client vs server, streaming
- Data Fetching - fetch API, caching, revalidation, loading states
- Optimization - Images, fonts, scripts, bundle analysis, PPR
Turborepo References:
RemixIcon References:
Common Patterns & Workflows
Pattern 1: Full-Stack Monorepo
my-monorepo/
├── apps/
│ ├── web/ # Customer-facing Next.js app
│ ├── admin/ # Admin dashboard Next.js app
│ └── docs/ # Documentation site
├── packages/
│ ├── ui/ # Shared UI with RemixIcon
│ ├── api-client/ # API client library
│ ├── config/ # ESLint, TypeScript configs
│ └── types/ # Shared TypeScript types
└── turbo.json # Build pipeline
turbo.json:
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
},
"dev": {
"cache": false,
"persistent": true
},
"lint": {},
"test": {
"dependsOn": ["build"]
}
}
}
Pattern 2: Shared Component Library
// packages/ui/src/button.tsx
import { RiLoader4Line } from "@remixicon/react"
export function Button({ children, loading, icon }) {
return (
<button>
{loading ? <RiLoader4Line className="animate-spin" /> : icon}
{children}
</button>
)
}
// apps/web/app/page.tsx
import { Button } from "@repo/ui/button"
import { RiHomeLine } from "@remixicon/react"
export default function Page() {
return <Button icon={<RiHomeLine />}>Home</Button>
}
Pattern 3: Optimized Data Fetching
// app/posts/[slug]/page.tsx
import { notFound } from 'next/navigation'
// Static generation at build time
export async function generateStaticParams() {
const posts = await getPosts()
return posts.map(post => ({ slug: post.slug }))
}
// Revalidate every hour
async function getPost(slug: string) {
const res = await fetch(`https://api.example.com/posts/${slug}`, {
next: { revalidate: 3600 }
})
if (!res.ok) return null
return res.json()
}
export default async function Post({ params }: { params: { slug: string } }) {
const post = await getPost(params.slug)
if (!post) notFound()
return <article>{post.content}</article>
}
Pattern 4: Monorepo CI/CD Pipeline
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm install
- run: npx turbo run build test lint
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
Utility Scripts
Python utilities in scripts/ directory:
nextjs-init.py - Initialize Next.js project with best practices
turborepo-migrate.py - Convert existing monorepo to Turborepo
Usage examples:
# Initialize new Next.js app with TypeScript and recommended setup
python scripts/nextjs-init.py --name my-app --typescript --app-router
# Migrate existing monorepo to Turborepo with dry-run
python scripts/turborepo-migrate.py --path ./my-monorepo --dry-run
# Run tests
cd scripts/tests
pytest
Best Practices
Next.js:
- Default to Server Components, use Client Components only when needed
- Implement proper loading and error states
- Use Image component for automatic optimization
- Set proper metadata for SEO
- Leverage caching strategies (force-cache, revalidate, no-store)
Turborepo:
- Structure monorepo with clear separation (apps/, packages/)
- Define task dependencies correctly (^build for topological)
- Configure outputs for proper caching
- Enable remote caching for team collaboration
- Use filters to run tasks on changed packages only
RemixIcon:
- Use line style for minimal interfaces, fill for emphasis
- Maintain 24x24 grid alignment for crisp rendering
- Provide aria-labels for accessibility
- Use currentColor for flexible theming
- Prefer webfonts for multiple icons, SVG for single icons
Resources
Implementation Checklist
Building with this stack:
1---2name: nextjs-turborepo3description: Full-stack web development with Next.js and Turborepo. Stack: Next.js 14+ (App Router, RSC, Server Actions, PPR, SSR, SSG, ISR), Turborepo (monorepo, pipelines, remote caching), RemixIcon (3100+ icons). Capabilities: server components, API routes, middleware, caching strategies, build optimization, monorepo management. Actions: create, build, deploy, optimize Next.js apps, setup monorepo, configure caching. Keywords: Next.js, App Router, Server Components, RSC, Server Actions, SSR, SSG, ISR, PPR, Turborepo, monorepo, remote cache, build pipeline, parallel execution, workspace, pnpm, icons. Use when: building Next.js apps, implementing SSR/SSG, setting up monorepos, optimizing build performance, configuring caching strategies, managing shared dependencies.4license: MIT5---6
7# Next.js + Turborepo Skill
8
9Comprehensive guide for building modern full-stack web applications using Next.js, Turborepo, and RemixIcon.
10
11## Overview
12
13This skill group combines three powerful tools for web development:
14
15**Next.js** - React framework with SSR, SSG, RSC, and optimization features
16**Turborepo** - High-performance monorepo build system for JavaScript/TypeScript
17**RemixIcon** - Icon library with 3,100+ outlined and filled style icons
18
19## When to Use This Skill Group
20
21- Building new full-stack web applications with modern React
22- Setting up monorepos with multiple apps and shared packages
23- Implementing server-side rendering and static generation
24- Optimizing build performance with intelligent caching
25- Creating consistent UI with professional iconography
26- Managing workspace dependencies across multiple projects
27- Deploying production-ready applications with proper optimization
28
29## Stack Selection Guide
30
31### Single Application: Next.js + RemixIcon
32
33Use when building a standalone application:
34- E-commerce sites
35- Marketing websites
36- SaaS applications
37- Documentation sites
38- Blogs and content platforms
39
40**Setup:**
41```bash
42npx create-next-app@latest my-app
43cd my-app
44npm install remixicon
45```
46
47### Monorepo: Next.js + Turborepo + RemixIcon
48
49Use when building multiple applications with shared code:
50- Microfrontends
51- Multi-tenant platforms
52- Internal tools with shared component library
53- Multiple apps (web, admin, mobile-web) sharing logic
54- Design system with documentation site
55
56**Setup:**
57```bash
58npx create-turbo@latest my-monorepo
59# Then configure Next.js apps in apps/ directory
60# Install remixicon in shared UI packages
61```
62
63### Framework Features Comparison
64
65| Feature | Next.js | Turborepo | RemixIcon |
66|---------|---------|-----------|-----------|
67| Primary Use | Web framework | Build system | UI icons |
68| Best For | SSR/SSG apps | Monorepos | Consistent iconography |
69| Performance | Built-in optimization | Caching & parallel tasks | Lightweight fonts/SVG |
70| TypeScript | Full support | Full support | Type definitions available |
71
72## Quick Start
73
74### Next.js Application
75
76```bash
77# Create new project
78npx create-next-app@latest my-app
79cd my-app
80
81# Install RemixIcon
82npm install remixicon
83
84# Import in layout
85# app/layout.tsx
86import 'remixicon/fonts/remixicon.css'
87
88# Start development
89npm run dev
90```
91
92### Turborepo Monorepo
93
94```bash
95# Create monorepo
96npx create-turbo@latest my-monorepo
97cd my-monorepo
98
99# Structure:
100# apps/web/ - Next.js application
101# apps/docs/ - Documentation site
102# packages/ui/ - Shared components with RemixIcon
103# packages/config/ - Shared configs
104# turbo.json - Pipeline configuration
105
106# Run all apps
107npm run dev
108
109# Build all packages
110npm run build
111```
112
113### RemixIcon Integration
114
115```tsx
116// Webfont (HTML/CSS)
117<i className="ri-home-line"></i>
118<i className="ri-search-fill ri-2x"></i>
119
120// React component
121import { RiHomeLine, RiSearchFill } from "@remixicon/react"
122<RiHomeLine size={24} />
123<RiSearchFill size={32} color="blue" />
124```
125
126## Reference Navigation
127
128**Next.js References:**
129- [App Router Architecture](./references/nextjs-app-router.md) - Routing, layouts, pages, parallel routes
130- [Server Components](./references/nextjs-server-components.md) - RSC patterns, client vs server, streaming
131- [Data Fetching](./references/nextjs-data-fetching.md) - fetch API, caching, revalidation, loading states
132- [Optimization](./references/nextjs-optimization.md) - Images, fonts, scripts, bundle analysis, PPR
133
134**Turborepo References:**
135- [Setup & Configuration](./references/turborepo-setup.md) - Installation, workspace config, package structure
136- [Task Pipelines](./references/turborepo-pipelines.md) - Dependencies, parallel execution, task ordering
137- [Caching Strategies](./references/turborepo-caching.md) - Local cache, remote cache, cache invalidation
138
139**RemixIcon References:**
140- [Integration Guide](./references/remix-icon-integration.md) - Installation, usage, customization, accessibility
141
142## Common Patterns & Workflows
143
144### Pattern 1: Full-Stack Monorepo
145
146```
147my-monorepo/
148├── apps/
149│ ├── web/ # Customer-facing Next.js app
150│ ├── admin/ # Admin dashboard Next.js app
151│ └── docs/ # Documentation site
152├── packages/
153│ ├── ui/ # Shared UI with RemixIcon
154│ ├── api-client/ # API client library
155│ ├── config/ # ESLint, TypeScript configs
156│ └── types/ # Shared TypeScript types
157└── turbo.json # Build pipeline
158```
159
160**turbo.json:**
161```json
162{
163 "$schema": "https://turbo.build/schema.json",
164 "pipeline": {
165 "build": {
166 "dependsOn": ["^build"],
167 "outputs": [".next/**", "!.next/cache/**", "dist/**"]
168 },
169 "dev": {
170 "cache": false,
171 "persistent": true
172 },
173 "lint": {},
174 "test": {
175 "dependsOn": ["build"]
176 }
177 }
178}
179```
180
181### Pattern 2: Shared Component Library
182
183```tsx
184// packages/ui/src/button.tsx
185import { RiLoader4Line } from "@remixicon/react"
186
187export function Button({ children, loading, icon }) {
188 return (
189 <button>
190 {loading ? <RiLoader4Line className="animate-spin" /> : icon}
191 {children}
192 </button>
193 )
194}
195
196// apps/web/app/page.tsx
197import { Button } from "@repo/ui/button"
198import { RiHomeLine } from "@remixicon/react"
199
200export default function Page() {
201 return <Button icon={<RiHomeLine />}>Home</Button>
202}
203```
204
205### Pattern 3: Optimized Data Fetching
206
207```tsx
208// app/posts/[slug]/page.tsx
209import { notFound } from 'next/navigation'
210
211// Static generation at build time
212export async function generateStaticParams() {
213 const posts = await getPosts()
214 return posts.map(post => ({ slug: post.slug }))
215}
216
217// Revalidate every hour
218async function getPost(slug: string) {
219 const res = await fetch(`https://api.example.com/posts/${slug}`, {
220 next: { revalidate: 3600 }
221 })
222 if (!res.ok) return null
223 return res.json()
224}
225
226export default async function Post({ params }: { params: { slug: string } }) {
227 const post = await getPost(params.slug)
228 if (!post) notFound()
229
230 return <article>{post.content}</article>
231}
232```
233
234### Pattern 4: Monorepo CI/CD Pipeline
235
236```yaml
237# .github/workflows/ci.yml
238name: CI
239on: [push, pull_request]
240
241jobs:
242 build:
243 runs-on: ubuntu-latest
244 steps:
245 - uses: actions/checkout@v4
246 - uses: actions/setup-node@v4
247 with:
248 node-version: 18
249 - run: npm install
250 - run: npx turbo run build test lint
251 env:
252 TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
253 TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
254```
255
256## Utility Scripts
257
258Python utilities in `scripts/` directory:
259
260**nextjs-init.py** - Initialize Next.js project with best practices
261**turborepo-migrate.py** - Convert existing monorepo to Turborepo
262
263Usage examples:
264```bash
265# Initialize new Next.js app with TypeScript and recommended setup
266python scripts/nextjs-init.py --name my-app --typescript --app-router
267
268# Migrate existing monorepo to Turborepo with dry-run
269python scripts/turborepo-migrate.py --path ./my-monorepo --dry-run
270
271# Run tests
272cd scripts/tests
273pytest
274```
275
276## Best Practices
277
278**Next.js:**
279- Default to Server Components, use Client Components only when needed
280- Implement proper loading and error states
281- Use Image component for automatic optimization
282- Set proper metadata for SEO
283- Leverage caching strategies (force-cache, revalidate, no-store)
284
285**Turborepo:**
286- Structure monorepo with clear separation (apps/, packages/)
287- Define task dependencies correctly (^build for topological)
288- Configure outputs for proper caching
289- Enable remote caching for team collaboration
290- Use filters to run tasks on changed packages only
291
292**RemixIcon:**
293- Use line style for minimal interfaces, fill for emphasis
294- Maintain 24x24 grid alignment for crisp rendering
295- Provide aria-labels for accessibility
296- Use currentColor for flexible theming
297- Prefer webfonts for multiple icons, SVG for single icons
298
299## Resources
300
301- Next.js: https://nextjs.org/docs/llms.txt
302- Turborepo: https://turbo.build/repo/docs
303- RemixIcon: https://remixicon.com
304
305## Implementation Checklist
306
307Building with this stack:
308
309- [ ] Create project structure (single app or monorepo)
310- [ ] Configure TypeScript and ESLint
311- [ ] Set up Next.js with App Router
312- [ ] Configure Turborepo pipeline (if monorepo)
313- [ ] Install and configure RemixIcon
314- [ ] Implement routing and layouts
315- [ ] Add loading and error states
316- [ ] Configure image and font optimization
317- [ ] Set up data fetching patterns
318- [ ] Configure caching strategies
319- [ ] Add API routes as needed
320- [ ] Implement shared component library (if monorepo)
321- [ ] Configure remote caching (if monorepo)
322- [ ] Set up CI/CD pipeline
323- [ ] Configure deployment platform