Overview
The server provides three endpoints:POST /enroll- Register a new user credentialGET /challenge- Generate authentication challengesPOST /verify- Verify authentication attempts
Quick Start
Installation from Scratch
Create a New Project
Create the Server
Create the file structure:src/db.js
Database layer using Bunβs SQLite:
src/routes/enroll.js
src/routes/challenge.js
src/routes/verify.js
src/index.js
Main server file:
Environment Variables
Create a.env file:
Deployment
Railway
Fly.io
Vercel (Serverless)
Createapi/index.js:
Testing the Server
Manual Testing
Database Management
The SQLite database is stored inbiokey.db.
Backup
Inspect
Reset
Security Considerations
- HTTPS Required - Always use HTTPS in production. WebAuthn requires secure contexts.
-
CORS Configuration - Restrict CORS to your domain in production:
-
Rate Limiting - Add rate limiting to prevent abuse:
-
Challenge Expiry - Challenges expire after 5 minutes by default. Adjust in
db.jsif needed. - Database Encryption - Consider encrypting the database file for additional security.
Monitoring
Add basic logging:- Sentry for error tracking
- LogTail for log management
- Uptime Robot for availability monitoring
Next Steps
Browser SDK
Connect your client to the server
React Integration
Use with React applications
Offline Mode
Build without a server
API Reference
Full server API documentation