TUTORIAL
Ejaz Shaikh•Jan 22, 2025•10 min read
Next.js App Router Patterns We Use in Production
The Next.js App Router introduced a new mental model for building React apps. Here are the patterns we use in every project.
Parallel Routes
Use parallel routes for modals that need their own URL:
app/
@modal/
(.)photo/[id]/
page.tsx
layout.tsxStreaming with Suspense
TSX
<Suspense fallback={<Skeleton />}>
<SlowComponent />
</Suspense>Server Actions
TS
'use server'
export async function createPost(data: FormData) {
await db.insert(posts).values({ title: data.get('title') })
revalidatePath('/blog')
}These patterns have dramatically improved our codebase quality.