Next.js App Router: A Practical Guide for Real Projects
Server components, layouts, loading states and caching explained with the decisions that matter when you ship a real Next.js site.
A tidy structure saves hours every week. Here is a layout that scales from a side project to a team.
project/
client/ Next.js app
server/ Express or NestJS API with Prisma
README.md
Keeping the two apps side by side makes it easy to run both and to share conventions.
server/src/
config/ env validation
common/ shared middleware, utils, errors
modules/
auth/
posts/
post.controller.ts
post.service.ts
post.validation.ts
post.routes.ts
Everything about posts lives in one folder. Controllers handle HTTP, services hold business logic and validation files hold schemas.
client/src/
app/ routes, layouts, metadata
components/ ui/, site/, dashboard/
lib/ api client, utils, types
Keep generic UI pieces separate from page-specific components.
Validation schemas can double as the source of types. If you do share code between client and server, keep it to pure types and schemas, with no framework imports.
dev, build, lint, db:push, db:seed.A README with install steps, required environment variables and the common commands lets anyone run the project in minutes.
Group by feature, keep layers thin, validate at the edges and automate checks. Structure is a kindness to your future self.
Server components, layouts, loading states and caching explained with the decisions that matter when you ship a real Next.js site.
Module boundaries, DTO validation, guards, exception filters and configuration: the NestJS structure that stays clean as your API grows.
Schema design, migrations, relations, transactions and performance tips for using Prisma with PostgreSQL, MySQL or MongoDB.