Next.js Full Stack Auth: Secure JWT, Cookies & Sessions with Custom Backend
Автор: Indian Coders
Загружено: 2025-03-01
Просмотров: 9114
check out: Login with Google using Node.js OAuth2.0 • Build a Secure Google Login System with No...
🔒 Master *Next.js Authentication* without third-party services!
Learn how to build a *secure JWT-based auth system* using cookies & sessions without relying on Firebase, Supabase, or any third-party service**!
🚀 Say goodbye to third-party auth services and take full control of your authentication system!
In this step-by-step tutorial, we cover:
✅ JWT-based authentication
✅ HttpOnly Cookies for enhanced security
✅ Session handling & best practices
✅ Protecting routes and APIs
✅ Preventing CSRF, XSS, and token theft
🚀 Tech Stack Used:
🔥 Next.JS 15 With App Router, Server Actions, Middleware
🔥 Framer Motion For Animations
🔥 Scalable Server/Client Components
🔥 Node.JS Express Backend Authentication Server
🔥 Redis for Caching
🔥 MySQL for storing User details
🔥 Docker and Docker Compose for Services of all apps
System Design Basics: • Messaging Queues in System Design | Produc...
Timestamps:
0:00 Introduction and Demo
04:02 Setting up Next.JS 15 app
06:00 Setup Nodejs app from GitHub repo
11:48 Add initial services for Backend using express
15:36 Run MySQL container on Docker with volumes
21:22 Run Redis container on Docker
23:14 Connect application to MySQL and Redis and Create tables
41:15 Building API for Create/Get user and add SQL Query for that
1:10:35 Hash passwords with bcryptjs and add login/signup routes
1:37:01 Generating and sending JWT Tokens for Auth
1:56:02 Encrypt Refresh tokens with crypto and store in Redis Cache with TTL
2:30:12 Set tokens in HTTP-Only cookies
2:54:36 Starting Next.JS app on frontend and creating login/signup pages
3:06:08 Introduction to Form Actions (Server Actions and Client Actions)
3:09:30 Creating Schema using ZOD schema
3:23:24 Creating Login and Signup Server Actions (Form Actions) with axios interceptors
3:46:18 Set cookies manually using set-cookie-parser
3:59:14 Validate cookies and access/refresh tokens by adding middleware on backend and frontend
5:09:30 Creating profile access route with middleware on backend.
5:23:04 Designing webpages with framer-motion
5:59:36 Optimizing app
6:07:04 Creating Dockerfile for backend and frontend
6:15:34 Creating docker-compose.yml for Nextjs, nodejs apps with adding separate envs for db
6:26:14 Summary and Next Steps
📌 *Source Code:*
Template: https://github.com/Nikhilthadani/Node...
Full Code: https://github.com/Nikhilthadani/Next...
📌 *Linkedin:* / indiancoders
🔔 *Subscribe for More Full-Stack Tutorials!*
👍 *Like & Comment* if this helped you!
Video tags:
Nextjs 15 Authentication project,nextjs authentication, nextjs jwt authentication, nextjs auth tutorial,
nodejs authentication, secure nextjs auth,
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: