How to Add Signup and Login to Your Vibe-Coded NextJS App

Adding signup and login to your vibe-coded app sounds daunting. This is where things get serious, where you start exploring dashboards, and where you commit to showing the world what you've built.
I was scared, too.
Then, I met with a good friend that was further along in his founder journey. All of his apps had login. It was then that I knew it was possible, and decided to write guides to help other vibe-coders like myself to build production-ready apps.
In this guide, I break everything down in a way that even non-technical founders can understand, and include prompts that you can use to have AI do most of the work for you.
By the end, your app will allow users to create an account, sign out, and sign back in.
Before You Start
This guide uses a managed login provider, Supabase Auth. In English, managed login providers like Supabase handle the sensitive account machinery that lives 'under the hood'; instead of asking you to invent it.
If you know about them, you're good to go. I'll take you through the setup.
Otherwise, read my guide about what they are and whether you should use one: Should You Build Your Own Login or Use Managed Auth?
Step 01Initialize your session
If you work on multiple projects, the first thing you need to do is make sure you're working in the right one. I know it sounds silly, but I'm saving you from a lesson I learned the hard way, three days into learning how to add signup to my app.
Start with this one. Your AI will tell you which project it has open. It won't change anything yet:
Next, let's make sure this guide is written for your app. This prompt will tell you whether it uses Next.JS App Router and which version is installed:
If it isn't, stay tuned for my upcoming guide on this process for adding login to other types of apps.
If it is, use this last setup prompt. Your AI will make sure the app works before we touch it, find anything that could get in the way, and show you its plan:
Step 02Have your AI build the account flow and screens
We are going to build the chair that Supabase sits in before inviting it into the room.
Copyable Prompt: Prepare the App for Supabase
Before we invite Supabase into our project, we're going to build the chair that it sits in. This is called building a 'seam', which is like a socket that another service plugs in to.
This prompt will build that seam, keep the app working without Supabase connected, and show you exactly what changed:
Copyable Prompt: Add supabase to your project
Now that the chair is built, it's time to plug Supabase in. This prompt will add the Supabase pieces and build the signup and login screens. The screens won't work yet. That's okay. We'll connect them to your real project in the next steps:
Copyable Prompt: Finish the login experience
There's a few finishing touches that need to be done.
Signup and login screens are only the visible part. Your app also needs to remember who signed in after a reload, finish the verification link safely, keep one page private, and sign the person out when they ask. Your AI will add those pieces now, while Supabase is still unplugged.
When it finishes, the screens and sign-in behavior will be ready. It will also give you the exact app addresses and setting names we need in Supabase next:
I use this exact stack in Doogle (opens in a new tab): an existing Next.js App Router app with Supabase Auth for signup and login.
Step 03Create or choose your Supabase project
If you are new to Supabase, create the project in the Supabase Dashboard (opens in a new tab). If the app already uses Supabase for something else, make sure you are changing the correct project instead of accidentally creating another one.
This is where browser control from providers like Claude, Codex, and Perplexity get useful.
Copyable prompt: Set up the right Supabase project
Some AI coding tools can control a browser because their working environment gives them a browser-control or Computer Use tool. This prompt will find out what yours can do. If it can use the browser, it will show you the project choices there. If it can't, it will walk you through them one click at a time. Either way, you'll finish with the right Supabase project selected:
Step 04Connect your app to Supabase
Your app is ready and the Supabase project exists. Now your AI can connect the two without rebuilding the login experience.
Supabase provides a project URL and publishable key for this job. A secret or service-role key does not belong in your app's browser-facing settings.
Copyable Prompt: Connect the Supabase Project
This prompt will take the project you just selected and connect it to the app. When it's done, the app should stop saying accounts aren't configured, and your AI will confirm that it is talking to the right project:
Step 05Set up the verification email
When someone creates an account, Supabase needs to send them a verification link and bring them back to the right place in your app.
For this controlled test, Supabase's built-in sender works only with pre-authorized addresses from the project's organization team. Supabase limits that sender to two emails per hour and says it is not for real users. This guide does not add Resend, another custom email sender, or six-digit codes. Those belong to a separate walkthrough.
Copyable Prompt: Configure the Verification Link
This prompt will set the addresses Supabase uses for verification emails and walk through the dashboard setup. At the end, your AI will help you create one test account and follow the verification link back into your app:
Step 06Test signup and login
Forms are not the finish line. A real person has to create an account, verify it, return later, stay signed in, reach the right page, and sign out without borrowing another browser's account.
Copyable Prompt: Test the Complete Account Flow
This prompt will run the whole signup and login process, from creating an account to signing out and logging back in. You'll get a clear result for every step, including anything that still doesn't work:
Step 07Make it work on your published app
Local proof belongs to the local app. If the app is already published, its real address needs the matching Supabase and hosting settings, followed by the same account test on that address.
There is one more honest limit. Supabase's built-in email sender is for controlled testing, not real users. Until the app has a separately configured custom SMTP provider, mark public verification email blocked.
Do not treat this section as automatic permission to publish. The AI should stop after the plan unless you separately approve the outside changes and publication.
Copyable Prompt: Prepare the Live Setup
This prompt will turn the local setup into a plan for your published app. It will give you the exact settings and addresses to add, then run the same signup and login test on the real site:
Step 08Save the setup
The last job is making sure this setup survives the current AI conversation. Save a short handoff so the next AI session does not have to rediscover the whole account system.
Copyable Prompt: Document What Changed
This final prompt will save the setup in a short handoff. A future AI session should be able to see what changed, what works, and what is still left without reading this whole conversation:
TroubleshootingIf Something Breaks
Start with what you can see. The symptom usually points back to one step.
Your AI opened the wrong app
Stop. Return to Step 1 and ask for the exact project path, app title, package manager, and current public page before allowing another edit.
The app already has login code
Do not install a second account system beside it. Ask the AI to identify the current owner and explain whether the work is an integration or a migration before continuing.
The app says Supabase is not configured
Return to Step 4. Confirm that the project URL and publishable key are in the app's expected local settings and that the app was restarted afterward. Do not replace them with a secret key.
The signup form appears, but no user is created
Confirm that the app is connected to the Supabase project you are watching. Then ask the AI to inspect what Supabase sent back instead of treating the rendered form as success.
The verification email never arrives
Check the address and spam folder, then inspect the Supabase user and email result. Request a fresh email after any settings change. Custom email delivery is separate from this guide.
The verification link opens the wrong address
Return to Step 5. Compare the exact app address, Supabase Site URL, allowed return address, and verification page. One wrong address, path, or slash is enough to break the return.
The verification link has expired
Request a new email and try once. Do not reuse an old one-time link after changing the URL or email settings.
Login works until you reload
Return to Step 2. Ask the AI to inspect the current request-time account refresh and prove that the same account reaches the server-owned page after a hard reload.
A signed-out visitor can still open the account page
The page needs a server-owned account check. Hiding the link or redirecting only in browser code is not protection.
Sign-out finishes, but the private page still opens
Open the account URL directly after sign-out. Ask the AI to inspect the fresh server result and private cache behavior instead of trusting the navigation menu.
The app works locally but not on its published address
Return to Step 7. The published app needs its own hosting values and exact Supabase addresses. Local settings do not travel to the live app by themselves.
Your AI asks you to paste a secret into chat
Do not paste it. Ask for the setting name and protected destination. If a secret was already exposed, stop and rotate it without repeating the value in the incident note.
Still having trouble?
Pull me into your project with @Vlad, your virtual co-founder. Or, if you'd rather work with the real me, set up a call.
Summary
Your app now gives people a way to create an account, verify their email, sign out, and sign back in.
Your AI did most of the building and browser work. You stayed in control of the accounts, passwords, outside changes, and the final call on whether the experience actually works.
Login tells your app who the person is. It does not finish the rules that decide which database records that person can use. That is a separate job.
The built-in Supabase email sender was enough for this controlled test, but it is not ready for arbitrary real users. Custom SMTP and the separate six-digit-code experience belong in another guide.
Common Questions
Do I need to know whether my app uses Next.js?
No. The first prompt asks your AI to inspect the project. This walkthrough continues only when it confirms a Next.js App Router app.
Do I need an existing Supabase project?
No. The guide includes creating a fresh project. If the app already uses Supabase, your AI should verify the correct project instead of creating another one.
Can my AI create and configure Supabase for me?
Often, yes. It may be able to drive your signed-in browser, create the approved project, and change the approved settings. It should still show the action first, wait for approval, and read the saved result back.
Should I paste Supabase keys into my AI chat?
No. Let the AI open the correct protected destination, then enter the value there while capture is paused. This guide's browser-facing setup uses the project URL and publishable key, never a secret or service-role key.
Why does a new user need to verify their email?
The verification link proves that the person controls the address used for the account. Until that step finishes, the app should show a clear check-your-email result instead of pretending the person is signed in.
Do I need Resend for this guide?
Not for the controlled project-team test. Supabase's built-in sender is restricted and is not meant for real users. Before arbitrary people sign up, the app needs a custom SMTP provider such as Resend. That setup and the separate six-digit-code method belong to another guide.
Does login protect all of my users' data?
No. Login identifies the account. Your app and database still need separate permission checks, including Row Level Security where browser-accessible data requires it.
Does a local test mean login will work after I publish?
No. The published address needs its own hosting values and Supabase settings, followed by the same signup, verification, reload, login, private-page, and sign-out test.
Sources
23 references- Supabase Next.js Auth quickstart (opens in a new tab)supabase.com
- Supabase server-side client setup for Next.js (opens in a new tab)supabase.com
- Supabase Auth Helpers migration (opens in a new tab)supabase.com
- Supabase API keys (opens in a new tab)supabase.com
- Supabase password authentication (opens in a new tab)supabase.com
- Supabase custom SMTP (opens in a new tab)supabase.com
- Supabase Auth rate limits (opens in a new tab)supabase.com
- Supabase signUp reference (opens in a new tab)supabase.com
Show 15 more references
- Supabase redirect URLs (opens in a new tab)supabase.com
- Supabase sign-out (opens in a new tab)supabase.com
- Supabase advanced server-side auth guide (opens in a new tab)supabase.com
- Supabase secure data and Row Level Security (opens in a new tab)supabase.com
- Next.js authentication guide (opens in a new tab)nextjs.org
- Next.js Proxy guide (opens in a new tab)nextjs.org
- Next.js data security guide (opens in a new tab)nextjs.org
- Next.js 16 upgrade guide (opens in a new tab)nextjs.org
- Next.js async cookies reference (opens in a new tab)nextjs.org
- OpenAI Computer Use (opens in a new tab)learn.chatgpt.com
- Claude in Chrome (opens in a new tab)support.claude.com
- Perplexity browser and app controls (opens in a new tab)perplexity.ai
- Official Supabase browser client example (opens in a new tab)github.com
- Official Supabase server client example (opens in a new tab)github.com
- Official Supabase Proxy example (opens in a new tab)github.com
Choose your next move
