A secure, zero-knowledge password manager built with Next.js, featuring client-side encryption, Google Drive backup, and robust deletion protection.
- π Client-side encryption: Passwords are encrypted before leaving your device.
- π Folder-based organization: Organize passwords in folders.
- ποΈ Deletion password protection: Prevent accidental or unauthorized deletions.
- βοΈ Google Drive backup: Automatic, redundant backups for disaster recovery.
- π€ User authentication: JWT-based login, email verification.
- π¨ Simple UI: Responsive, themeable interface.
- Node.js 18+
- MongoDB (local or remote)
- Google Cloud account (for Drive backup)
- NPM
git clone https://github.com/mahaveer1013/kavalan.git
cd kavalannpm installCreate a .env file in the root directory with the following variables:
# Database
MONGODB_URI = "" // Atlas URI
# JWT Secret
JWT_SECRET = "<secure random string>"
# Deletion Password
DELETION_PASSWORD = "<required while deleting a password>"
DELETION_PASSWORD_FOR_FOLDER = "<required while deleting a folder>"
# Google Drive Backup
GOOGLE_DRIVE_BACKUP = "true" // true or false
GOOGLE_DRIVE_CLIENT_ID = "<refer drive documentation>"
GOOGLE_DRIVE_CLIENT_SECRET = "<refer drive documentation>"
GOOGLE_DRIVE_REFRESH_TOKEN = "<refer drive documentation>"Note:
DELETION_PASSWORDis required to delete individual passwords.DELETION_PASSWORD_FOR_FOLDERis required to delete entire folders.- If you do not want Google Drive backup, set
GOOGLE_DRIVE_BACKUP=falseor omit the related variables.
npm install googleapis- Go to Google Cloud Console
- Create a new project or select an existing one.
- Enable the Google Drive API.
- Create OAuth 2.0 credentials (Web application).
- Add authorized redirect URI:
http://localhost:3000/oauth2callback
- Fill in
GOOGLE_DRIVE_CLIENT_IDandGOOGLE_DRIVE_CLIENT_SECRETin your.env. - Run the script to get your refresh token:
node src/scripts/get-refresh-token.js- Follow the prompts, authorize, and paste the code.
- Copy the refresh token output and add it to your
.envasGOOGLE_DRIVE_REFRESH_TOKEN.
There is no public registration endpoint. To add an initial user:
- Add these variables to your
.env(temporarily):
USER_EMAIL=your@email.com
PASSWORD=yourpassword- Run:
node src/scripts/add-user.js- Remove
USER_EMAILandPASSWORDfrom your.envafter the user is created.
npm run devVisit http://localhost:3000 in your browser.
- Client-side encryption: All sensitive data is encrypted before being sent to the server.
- Deletion password: Required for deleting passwords and folders (set via environment variables).
- Google Drive backup: All changes are redundantly backed up (if enabled).
- JWT authentication: Secure, stateless sessions.
- Email verification: Prevents unauthorized access.
- Automatic: Every create/delete triggers a backup.
- Redundant: MongoDB is primary, Google Drive is backup.
- Versioned: Each backup is timestamped.
- Recovery: Restore from Google Drive if MongoDB fails.
/api/auth/loginβ Login/api/auth/logoutβ Logout/api/auth/verify-userβ Verify session/api/foldersβ CRUD for folders/api/passwordsβ CRUD for passwords
You can easily deploy Kavalan to Vercel:
- Go to your project in the Vercel Dashboard.
- Navigate to Settings > Environment Variables.
- Add all the environment variables listed in the ".env" section above (e.g.,
MONGODB_URI,JWT_SECRET,DELETION_PASSWORD, etc.). - Make sure to set them for the correct environment (Production, Preview, Development) as needed.
- If you are using MongoDB Atlas, you must allow Vercel to access your database:
- Go to your MongoDB Atlas dashboard.
- Navigate to Network Access.
- Add an IP address rule:
- To allow public access (not recommended for production), add
0.0.0.0/0. - For better security, restrict access to Vercel's IP ranges (see Vercel IP documentation).
- To allow public access (not recommended for production), add
- Push your code to GitHub/GitLab/Bitbucket and import the repository into Vercel.
- Vercel will automatically detect the Next.js app and deploy it.
Note:
- Ensure all required environment variables are set in Vercel before deploying.
- For Google Drive backup, make sure the credentials and refresh token are valid and present in the environment variables.
- After deployment, test your app to confirm database and backup connectivity.
- MongoDB connection errors: Check
MONGODB_URI. - Google Drive errors: Check all Google Drive env vars and refresh token.
- User not found: Ensure you added a user via the script.
See CONTRIBUTING.md.
MIT