Environment Variables
The server supports the following environment variables:Port number for the HTTP server to listen on
Railway Deployment
BioKey Server includes arailway.json configuration file for seamless deployment to Railway.
Configuration
Therailway.json file at packages/biokey-server/railway.json:1 specifies:
Deploy Steps
-
Install Railway CLI
-
Login to Railway
-
Initialize Project
-
Deploy
-
Add Domain (Optional)
Persistent Storage
Railway deployments are ephemeral by default. To persist the SQLite database:- Go to your Railway project dashboard
- Add a volume to your service
- Mount it to the application directory where
biokey.dbis created - Set the volume mount path to
/appor configureDB_PATHif you add that environment variable
Docker Deployment
While the repository doesn’t include a Dockerfile, you can create one:Build and Run
Docker Compose
Manual Deployment
Requirements
- Bun v1.0 or later
- Linux, macOS, or Windows with WSL
Steps
-
Install Dependencies
-
Set Environment Variables
-
Run Server
Production Mode
For production, use a process manager like PM2:Vercel/Netlify Deployment
BioKey Server uses Hono, which supports serverless deployment:-
Install the appropriate adapter:
- Create a serverless entry point following the platform’s requirements
- Note: SQLite database may not persist in serverless environments. Consider using a hosted database service.
Health Check
The server exposes a health check endpoint:CORS Configuration
The server enables CORS for all origins by default (implemented inpackages/biokey-server/src/index.js:9).
For production, consider restricting CORS:
Security Checklist
- Use HTTPS in production (Railway provides this automatically)
- Configure CORS to allow only trusted origins
- Set up rate limiting to prevent abuse
- Monitor database size and implement cleanup policies
- Regularly backup the SQLite database file
- Consider using a managed database service for high-traffic applications
- Set up logging and monitoring (Railway provides built-in logs)
Scaling Considerations
For high-traffic deployments:- SQLite is suitable for moderate loads (thousands of requests per second)
- For larger scale, consider migrating to PostgreSQL or MySQL
- Run multiple server instances behind a load balancer
- Implement Redis or another cache for challenge storage
- Monitor database file size and implement archival strategies