This is one of the most important videos in the series. By the end you will have a fully working registration, email verification, and login flow connecting your Next.js frontend to your Laravel backend — all built with Claude AI.
Here is exactly what we cover step by step:
We start by creating a dedicated CustomerAuthController in Laravel — separate from the admin controller — with two API routes: one to register a new customer and one to verify their email via a hash link. SMTP credentials are already in the Laravel .env using Bravo, so the verification email sends straight away.
We then connect the Next.js frontend to the new backend API. The initial code used JavaScript's native fetch, but we switched to Axios as a proper API service layer — a better pattern for token handling and interceptors.
With Axios in place we test the full registration flow using a yelpmail.com address. The verification email arrives, we click the link, the frontend confirms success, and the database shows the account as verified.
Next we build the login API with proper validation responses for email not found, wrong password, and success. Laravel generates a Sanctum token which is stored in the frontend and passed via an Axios token interceptor on every request.
We then create a CustomerAuthProvider and AuthContext that wraps the entire Next.js app so every route knows whether the user is logged in or not. The header is updated to show the user's name and a logout button when authenticated, and switches back to sign-in and register when logged out.
Finally, we add the verification check to the login controller so only verified users can log in. Unverified users see an error and a resend verification email button — a feature Claude suggested on its own.
——————————————————
🕐 CHAPTERS
00:00 Customer registration API setup
01:49 API routes and verification email
05:13 Connect frontend to backend
08:29 Switch to Axios API calls
10:40 Create login with validations
15:56 Auth provider and header updates
20:01 Ensure email verified login
——————————————————
🛠️ TECH STACK
Laravel 12 · Laravel Sanctum · Next.js · Axios · MySQL · Claude AI · SMTP / Bravo
——————————————————
📌 Part of the Cod Car Rentals Series — building a full-stack Car Fleet and Rental app with Laravel, React, MySQL and Claude AI from scratch.
🔔 Subscribe so you don't miss the next episode!