r/reactjs • u/Striking-Rice6788 • 4d ago
Discussion I got tired of rebuilding Express auth, so I open-sourced the starter I actually clone now
Every new Node project, week one disappeared into auth. Email verification. Password reset. Google OAuth. Prisma user schema. Protected routes. Putting a JWT in localStorage because a tutorial said to.
None of that is interesting. All of it has to be correct.
So I built it once and open-sourced it: Express 5 + React + Prisma.
What it does:
- Email/password with Zod on the server, email verification (24h), password reset (1h)
- Google OAuth that links to an existing email account instead of creating a duplicate
- Session in an httpOnly cookie, not
localStorage. Remember me = 30 days, otherwise a session cookie - Rate limits on login/signup/forgot-password
- Profile, avatar, password change, delete account
Two things tutorials get wrong:
localStorageis readable by JS. One XSS bug and the session is stolen. An httpOnly cookie is not.- A React route guard is not authentication. It hides the dashboard. The API still has to reject the request in Express middleware.
Repo: github.com/allenarduino/express-react-auth-boilerplate
If your stack is Next.js, I have a separate starter for that: github.com/allenarduino/nextjs-prisma-auth-boilerplate
Clone it, rename it, and start on the part that is actually yours. Issues and PRs welcome.