A minimal example site demonstrating @netlify/identity authentication with Netlify Blobs for data persistence.
- Email/password signup and login
- OAuth login (GitHub)
- Protected routes with server-side auth checks
- Password recovery flow
- Bookmark CRUD with Netlify Blobs
- Session hydration and auth callback handling
- TanStack Start + React
- Tailwind CSS 4
- @netlify/identity — authentication
- @netlify/blobs — data persistence
Click the deploy button above, or fork this repo and connect it to Netlify.
Identity is enabled automatically when you deploy.
git clone https://github.com/netlify-templates/identity-demo.git
cd identity-demo
npm install
netlify devNote: Authentication requires a deployed Netlify site.
netlify devproxies your site but does not run the Identity backend locally. Deploy a branch preview to test auth flows.
- Go to Project configuration > Identity > Registration
- Under External providers, enable GitHub (or Google, GitLab, etc.)
src/
├── components/
│ └── CallbackHandler.tsx # Handles OAuth/email/recovery URL hashes
├── lib/
│ ├── auth.ts # getServerUser server function
│ ├── bookmarks.ts # Bookmark CRUD with Netlify Blobs
│ └── identity-context.tsx # React context for client-side auth state
└── routes/
├── __root.tsx # Root layout with IdentityProvider + branding
├── index.tsx # Landing page
├── login.tsx # Email/password + OAuth login
├── signup.tsx # Account creation
├── bookmarks.tsx # Protected: bookmark list with add/delete
├── forgot-password.tsx # Password recovery request
└── reset-password.tsx # Set new password after recovery
- Login and signup happen browser-side via
@netlify/identity getUser()runs server-side in route loaders to protect pages- OAuth and email callbacks are handled by
CallbackHandlerin the root layout - Full page navigations after auth changes ensure cookies are sent to the server
- Bookmarks are stored in Netlify Blobs, namespaced by user ID
- Server functions handle all reads and writes via
@netlify/blobs