A sample implementation of passwordless authentication using Passkeys (WebAuthn).
This project demonstrates how to implement passwordless authentication using biometric authentication or security keys.
- Implementation example using SimpleWebAuthn
- Complete Passkey registration and authentication flows
- Both client-side and server-side code examples
# 1. Install dependencies
npm install
# 2. Configure environment variables
cp .env.example .env
# 3. Start development server
npm run devThe application will be available at http://localhost:5173.
- User accesses the Passkey registration page
- Fetches challenge and options from
/api/passkey-registration-options - Creates a Passkey using WebAuthn API on the client
- Verifies and saves the Passkey via
/api/passkey-verifications
- User accesses the sign-in page
- Fetches challenge and options from
/api/passkey-authentication-options - Authenticates using WebAuthn API on the client
- Verifies the authentication via
/api/passkey-authentication
- app/routes/passkey-registration.tsx - Passkey registration page
- app/routes/signin.tsx - Sign-in page
- app/routes/api.passkey-registration-options.ts - Registration options API
- app/routes/api.passkey-verifications.ts - Registration verification API
- app/routes/api.passkey-authentication-options.ts - Authentication options API
- app/routes/api.passkey-authentication.ts - Authentication verification API
- app/helper/passkey.ts - Passkey helper functions
npm run dev- Start development servernpm run build- Build for productionnpm run start- Run production buildnpm run typecheck- Run TypeScript type checking
This is a demonstration project. For production use:
- Replace the in-memory storage (db.server.ts) with a proper database
- Ensure Passkey credentials are stored securely