Created by Hamed Panjeh

Welcome to NextJs-FullStack-App-Blog-APP

A fullstack blog application built with Next.js 16, React 19, Prisma ORM, PostgreSQL, and NextAuth.js — with TypeScript, Tailwind CSS, Server Actions, and JWT authentication.

Want to build this app from scratch? Follow the 31-step tutorial series

Create an account or sign in to create and manage blog posts and do experiment with a NextJs fullstack app!

20

Posts

6

Users

Blog Posts

Create, read, update, and delete blog posts stored in a PostgreSQL database via Prisma ORM.

Authentication

Register and sign in with NextAuth.js v5. Passwords are hashed with bcrypt. Sessions use JWT.

Server Actions

Create and delete posts using Server Actions — no API routes needed for mutations.

Route Protection

Middleware protects authenticated routes. Only post owners can delete their own posts.

Technology Stack

  • Next.js 16 — App Router, Server Components
  • React 19 — Server & Client Components
  • TypeScript — static type safety
  • Prisma ORM — type-safe database access
  • PostgreSQL — relational database
  • Prisma Accelerate — connection pooling
  • NextAuth.js v5 — authentication
  • Tailwind CSS — utility-first styling
  • Vercel — deployment

Tools

Next.js Features Covered

  • App Router — file-based routing
  • Server Components — default rendering
  • Client Components — "use client" directive
  • Layouts — shared UI with layout.tsx
  • Dynamic Routes — [id] segments
  • Route Handlers — API endpoints
  • Server Actions — form mutations
  • Proxy (Middleware) — route protection
  • Streaming & Suspense — progressive rendering
  • loading.tsx — skeleton loading states
  • error.tsx — error boundaries
  • not-found.tsx — custom 404 pages
  • generateMetadata — dynamic SEO
  • Open Graph tags — social sharing
  • searchParams — URL-based state
  • next/image — image optimization
  • next/link — client-side navigation
  • next/navigation — redirect, notFound, useRouter, usePathname
  • next/font — font optimization
  • Title template — consistent page titles
  • remotePatterns — external image config

React 19 Features Covered

  • Server Components — async components with direct data access
  • Client Components — interactive UI with hooks
  • use() hook — read promises during render
  • useActionState — form state with server actions
  • useFormStatus — pending state for forms
  • <Suspense> — loading boundaries & streaming
  • useState — client-side state management
  • useEffect — side effects & data fetching
  • useSession — client-side session access
  • useRouter — programmatic navigation
  • useSearchParams — reading URL search params
  • useRef — mutable refs (debounce timers)
  • form action — server action as form handler

Next.js Imports Used in This App

Every import from Next.js packages actually used across the codebase.

ImportFromUsed in
NextConfignextnext.config.ts
Metadatanextlayout.tsx, posts/page.tsx, posts/[id]/page.tsx, posts/[id]/edit/page.tsx, posts/new/page.tsx
Geistnext/font/googlelayout.tsx
Geist_Mononext/font/googlelayout.tsx
Linknext/linkpage.tsx, Header.tsx, not-found.tsx, login/page.tsx, register/page.tsx, posts/PostList.tsx, posts/[id]/page.tsx
notFoundnext/navigationposts/[id]/page.tsx, posts/[id]/edit/page.tsx
redirectnext/navigationactions.ts, posts/[id]/edit/page.tsx, posts/new/page.tsx
useRouternext/navigationlogin/page.tsx, register/page.tsx, posts/SearchBar.tsx
usePathnamenext/navigationHeader.tsx
useSearchParamsnext/navigationposts/SearchBar.tsx
NextResponsenext/serverapi/auth/register/route.ts, api/posts/route.ts

How This App Was Built

This application was created following a 31-step tutorial series. Each step builds on the previous one — from an empty Next.js project to a fully deployed CRUD application with authentication.

View the source code on GitHub — each step has its own branch.

StepTopicLinks
01Your First Next.js PageTutorialBranch
02File-Based RoutingTutorialBranch
03Layouts & NavigationTutorialBranch
04Introduction to Prisma ORMTutorialBranch
05Modeling Your DataTutorialBranch
06Seeding Test DataTutorialBranch
07Connecting to the DatabaseTutorialBranch
08Rendering Posts from the DatabaseTutorialBranch
09Advanced Prisma QueriesTutorial
10Dynamic RoutesTutorialBranch
11Building an APITutorialBranch
12Client Components & PaginationTutorialBranch
13Adding AuthenticationTutorialBranch
14Login & RegisterTutorialBranch
15Session & Protected UITutorialBranch
16Creating PostsTutorialBranch
17Deleting PostsTutorialBranch
18Deploy to VercelTutorialBranch
19Updating PostsTutorialBranch
20Refactoring PaginationTutorialBranch
21The use() Hook in PracticeTutorialBranch
22Middleware to Proxy MigrationTutorialBranch
23Error HandlingTutorialBranch
24Loading UI & SkeletonsTutorialBranch
25Dynamic Metadata & SEOTutorialBranch
26Search & FilteringTutorialBranch
27useActionState for FormsTutorialBranch
28Input Validation with ZodTutorialBranch
29Image OptimizationTutorialBranch
30Profiling Queries with Prisma Query InsightsTutorial
31Next.js 16 File ConventionsTutorial

Commands Reference

All terminal commands used throughout the tutorial series.

CommandPurposeTutorial Step(s)
pnpm create next-app@latestScaffold a new Next.js projectStep 1
pnpm devStart dev server with TurbopackStep 1
pnpm add @prisma/client @prisma/adapter-pgInstall Prisma client and adapterStep 4
pnpm add -D prisma tsxInstall Prisma CLI and tsx runnerStep 4
npx prisma initInitialize Prisma in the projectStep 4
npx prisma init --dbInitialize Prisma and create a Prisma Postgres databaseStep 4
npx prisma generateGenerate the Prisma ClientStep 4Step 6
npx prisma studioOpen database GUI in browserStep 4Step 5Step 6
npx prisma migrate dev --name <name>Create and apply a migrationStep 5Step 6
npx prisma db pullPull schema from live databaseStep 5Step 6
pnpm add bcryptjsInstall bcrypt for password hashingStep 6
npx prisma db seedSeed database with test dataStep 6Step 8
npx prisma migrate resetReset, re-migrate, and re-seedStep 6
pnpm add next-auth@betaInstall NextAuth.jsStep 13
openssl rand -base64 32Generate a secure AUTH_SECRETStep 13Step 18
npx prisma migrate deployApply pending migrations (production)Step 6Step 18