Next.js 16 Project Setup & App Router: Your First Page
Step 1 — Create a Next.js 16 project from scratch, understand the App Router, file-based routing, Server Components, and build your first custom page.
A 31-step tutorial series for React developers who want to learn Next.js. We build a complete blog application — NextJs-FullStack-App-Blog-APP — with authentication, a real database, full CRUD operations, and deploy it to Vercel, one small step at a time.
Throughout this series you will build NextJs-FullStack-App-Blog-APP — a fullstack blog application where users can register, sign in, create, update, and delete their own posts. The project covers every layer of a modern web app: the React UI, the Next.js server, the Prisma ORM, a PostgreSQL database, and NextAuth.js authentication — all written in TypeScript and deployed on Vercel.
View the source code on GitHub — each step has its own branch (e.g. step1, step2, … step30). Step 31 is a theory reference with no branch.
Step 1 — Create a Next.js 16 project from scratch, understand the App Router, file-based routing, Server Components, and build your first custom page.
Step 2 — Learn how Next.js turns folders into URL routes. Create multiple pages, understand nested routing, and see 404 handling in action.
Step 3 — Extract the repeated header into a shared layout, build a navigation bar with the Link component, and learn the difference between Server and Client Components hands-on.
Step 4 — Install Prisma, understand what an ORM does, create a Prisma Postgres database, and configure the project to connect to it.
Step 5 — Define User and Post models in the Prisma schema, understand data types, relationships, and field attributes, then run your first migration to create real database tables.
Step 6 — Install bcrypt for password hashing, write a seed script that creates sample users and posts, and learn how to reset and re-seed the database.
Step 7 — Create a shared Prisma Client instance that your Next.js app uses to query the database. Understand why a singleton is necessary in a Node.js server.
Step 8 — Replace the placeholder posts page with a real database query. Learn how to use prisma.post.findMany() with relations and render the results in a Server Component.
Step 9 — A deep dive into Prisma query mechanics: include, select, nested relations, and performance philosophy — explained through the lens of Laravel Eloquent.
Step 10 — Build the post detail page using a dynamic route. Learn how Next.js maps URLs like /posts/1 to a [id] folder, and how to fetch a single record with Prisma.
Step 11 — Create JSON API endpoints using Next.js Route Handlers. Learn how to build GET and POST routes inside the app/api directory and return data from the database.
Step 12 — Learn the difference between Server and Client Components, build interactive pagination with useState and useEffect, and fetch data from the API endpoint we created in Step 11.
Step 13 — Install and configure NextAuth.js (Auth.js v5) with the Credentials provider. Set up password hashing, the auth config, and the API route that handles sign-in.
Step 14 — Build the login and register pages as interactive Client Components. Use NextAuth signIn(), handle form submissions, display errors, and redirect after authentication.
Step 15 — Read the session in Server Components with auth(), protect routes with middleware, and build a personalized UI that adapts to the logged-in user.
Step 16 — Build the "Create Post" form using Server Actions — a Next.js feature that lets you handle form submissions directly on the server without writing an API route.
Step 17 — Complete the CRUD cycle by adding a delete button to each post. Learn how to use Server Actions with arguments, authorize the delete operation, and revalidate the page after deletion.
Step 18 — Deploy your fullstack Next.js app to Vercel. Configure environment variables, run Prisma migrations on production, and go live with your Prisma Postgres database.
Step 19 — Add edit functionality to your fullstack Next.js app. Build an edit page with a pre-filled form, create an update Server Action, and use prisma.post.update() — completing full CRUD.
Step 20 — Replace client-side useEffect fetching with Server Components, Prisma queries, URL-based pagination, and React Suspense — improving performance, SEO, and code simplicity.
Step 21 — Build a "More by this author" feature using React 19's use() hook to stream a Prisma query from a Server Component into an interactive Client Component with Suspense.
Step 22 — Next.js 16 deprecated the middleware file convention. Learn what the new proxy convention is, why the rename happened, and how to migrate your NextAuth.js route protection from middleware.ts to proxy.ts.
Step 23 — Add error boundaries and custom 404 pages using Next.js file conventions. Handle unexpected errors gracefully and show meaningful not-found pages for missing posts.
Step 24 — Use the loading.tsx file convention to show instant loading states and skeleton UIs while pages load — the simplest way to add Suspense to your app.
Step 25 — Add dynamic page titles, descriptions, and Open Graph tags using the Metadata API. Improve search engine visibility and social media sharing for every page.
Step 26 — Add a search bar to the posts page using URL searchParams, server-side Prisma queries, and useSearchParams. Learn the URL-as-state pattern for shareable, bookmark-friendly search.
Step 27 — Refactor the create post form to use useActionState — the React 19 pattern for pending states, server validation errors, and progressive enhancement in forms.
Step 28 — Add type-safe input validation across the app using Zod — define schemas once, validate in server actions and API routes, and return structured errors to the UI.
Step 29 — Add author avatars using the next/image component. Learn how Next.js automatically optimizes, resizes, and lazy-loads images for better performance.
Step 30 — Identify slow queries, N+1 problems, and missing indexes in your Next.js app using the built-in Query Insights dashboard in Prisma Postgres.
Step 31 — A complete reference to every special file name in the Next.js 16 App Router — what each file does, where it goes, and which ones you actually need.