Self-host 2fa
v1.13.12FA code vault on Cloudflare Workers with WebDAV backups
- Stars
- 458
What is 2fa?
This project is a two-factor authentication key manager you publish as your own Cloudflare Worker, so the whole app runs serverlessly on the free Workers tier instead of a VPS. It generates TOTP and HOTP codes locally in the browser, and keys can be added by scanning a QR code with the camera, uploading, pasting or dragging a screenshot, or typing a Base32 secret with custom digits, period and algorithm. Bulk import works with exports from Google Authenticator migration QR codes, Aegis, 2FAS, Bitwarden, LastPass, andOTP and Ente Auth, and bulk export writes TXT, JSON, CSV, HTML or a scannable Google Authenticator migration QR code. Secrets are stored in a Workers KV namespace and, once the ENCRYPTION_KEY secret is set, encrypted with AES-GCM 256; automatic backups are kept (100 by default) and can be pushed to WebDAV, S3-compatible storage, OneDrive or Google Drive. A companion browser extension for Chrome, Edge and Firefox reads and autofills codes, and the web app installs as a PWA with offline add/edit/import that syncs later. Deployment is either the Cloudflare deploy button (upgrades run through the Sync Upstream workflow) or a wrangler command line path; there is no Docker image. Only a single management password protects the instance, and OTP can also be exposed through unauthenticated public /otp/ URLs, which is a deliberate but security-relevant design.
Should you self-host 2fa?
2fa scores 48/100 on selfhost.directory (how scoring works) and ranks #25 of 40 in Authentication. It has 458 GitHub stars.
It shipped 14 stable releases in the past year. The latest, v1.13.1, came out on 19 October 2026. New versions land roughly every 3 days.
Setup is easy: most people get it running in one sitting. It is MIT-licensed and written mostly in JavaScript.
Its closest alternative on selfhost.directory is keycloak (86/100, 37 571 stars). It scores higher overall, so compare the two before you pick. See 2fa vs keycloak side by side.
Features
- Automatic backup and restore
- Browser extension autofill
- Bulk export
- Bulk Import
- Customisable session lifetime
- Encrypted secret storageOptional: without the key data is stored in plain text in KV.
- HOTP support
- Multi-language UI
- Public OTP API
- QR code scanning and image recognition
- Remote backup sync
- Search and grouped key list
- TOTP code generation
- Utilities toolbox
2fa README
More in Backup
Alist-SyncAlist-Sync is a self-hosted, open-source web app for syncing files between Alist storage backends with a visual UI, cron scheduling, and configurable difference handling.
ANASANAS is a self-hosted, open-source storage layer for Proxmox VE adding native UI panels for ZFS pools, Hybrid RAID, SMB/NFS, iSCSI, snapshots, replication, PBS backup.
arkeepArkeep is an open-source, self-hosted backup management platform with a web dashboard for Restic/Rclone backups across multiple servers.
BackAppBackApp is a self-hosted, open-source backup automation tool with a React web UI that schedules and inspects remote server backups over SSH.
Backblaze_Personal_BackupSelf-hosted Docker container running Backblaze backup client via WINE on Linux. Provides VNC web GUI for setup and management.
BackrestSelf-hosted, open-source web UI and orchestrator that wraps restic for cron-scheduled backups, snapshot browsing, file restores, and repo maintenance.
BackupPCBackupPC is a self-hosted, open-source backup server that deduplicates and compresses backups from Linux, Windows, and macOS clients to a central disk with a web UI.
bareosOpen-source, cross-platform network backup and recovery suite (a Bacula fork) with Director/File/Storage daemons, PostgreSQL catalog, tape, S3 and a web UI.
barmanSelf-hosted, open-source disaster-recovery tool for PostgreSQL: remote backups, WAL archiving, point-in-time recovery, incremental, encrypted and cloud backups.
BeeCount CloudSelf-hosted sync cloud for BeeCount personal accounting app with real-time multi-device sync, shared ledgers, AI bookkeeping, and encrypted backup.
BichonSelf-hosted, open-source email archiver written in Rust that pulls mail over IMAP or OAuth2, indexes it for full-text search, and serves a WebUI and REST API.
borgbackupserverSelf-hosted web UI that centrally manages encrypted Borg backups on Linux, Windows, and macOS via agents that poll over HTTPS and push data over SSH.



0 comments