Your digital life, locked down.
One master password is all you need. Locify remembers everything else β securely, privately, and only for you.
Locify is a full-stack secure password manager web application that allows users to store, manage, and retrieve passwords for multiple accounts and services in an encrypted, user-friendly environment.
All stored passwords are encrypted using AES-256-CBC encryption before being saved to the database β meaning even if the database is compromised, your passwords remain unreadable. The app features two-factor authentication (2FA) via OTP email on every login, JWT-based session management, and a clean dashboard with password strength scoring, categories, favorites, and search.
Built as a full-stack project to demonstrate secure web application development using the MERN stack.
| Feature | Description |
|---|---|
| π OTP Email Verification | Account registration requires email OTP verification |
| π 2FA on Every Login | A 6-digit OTP is sent to your email on each login |
| π AES-256-CBC Encryption | All vault passwords encrypted before saving to MongoDB |
| π§ bcrypt Hashing | User account passwords hashed with salt round of 12 |
| πͺ JWT Authentication | Stateless auth with 7-day token expiry |
| π Password Vault | Full CRUD β add, view, edit, delete passwords |
| π·οΈ Categories & Tags | Organize passwords by Work, Personal, Finance, etc. |
| β Quick Access (Favorites) | Pin important passwords for one-click copy |
| πͺ Password Strength Meter | Real-time scoring β Critical / Weak / Good / Strong |
| π Search & Filter | Search by name, username, email, URL, or tags |
| π Dashboard Stats | Security score, total/weak/strong password counts |
| π Dark / Light Theme | Smooth theme toggle across the entire app |
| π Forgot Password | Reset password via OTP email flow |
| π‘οΈ Rate Limiting | Brute force protection on all auth routes |
| Technology | Version | Purpose |
|---|---|---|
| React | 19 | UI library |
| React Router DOM | 7 | Client-side routing |
| Vite | 7 | Build tool & dev server |
| Context API | β | Global state (Vault, Theme) |
| CSS | β | Styling & theming |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | β | Runtime environment |
| Express.js | 4 | REST API framework |
| MongoDB + Mongoose | 8 | Database & ODM |
| jsonwebtoken | 9 | JWT authentication |
| bcryptjs | 2 | Password hashing |
Node.js crypto |
built-in | AES-256-CBC encryption |
| Nodemailer | 6 | OTP email sending |
| Helmet | 7 | Secure HTTP headers |
| express-rate-limit | 7 | Rate limiting |
| express-validator | 7 | Input validation |
| dotenv | 16 | Environment variables |
| Morgan | β | HTTP request logging |
Locify/
βββ Backend/
β βββ config/
β β βββ db.js # MongoDB connection
β βββ controllers/
β β βββ authController.js # Register, Login, OTP, Reset Password
β β βββ vaultController.js # Vault CRUD operations
β βββ middleware/
β β βββ auth.js # JWT verification middleware
β βββ models/
β β βββ User.js # User schema (bcrypt + OTP methods)
β β βββ VaultItem.js # Vault schema (AES encryption hooks)
β βββ routes/
β β βββ auth.js # /api/auth routes
β β βββ vault.js # /api/vault routes
β βββ utils/
β β βββ email.js # Nodemailer OTP sender
β β βββ encryption.js # AES-256-CBC encrypt/decrypt
β βββ .env # Environment variables
β βββ package.json
β βββ server.js # Express app entry point
β
βββ Frontend/
βββ src/
β βββ components/
β β βββ Navbar.jsx
β β βββ Footer.jsx
β β βββ Icons.jsx
β βββ context/
β β βββ ThemeContext.jsx # Dark/Light global state
β β βββ VaultContext.jsx # Vault data global state
β βββ pages/
β β βββ Home.jsx
β β βββ Register.jsx
β β βββ Login.jsx
β β βββ VerifyOtp.jsx
β β βββ ForgotPassword.jsx
β β βββ Dashboard.jsx
β β βββ AddPassword.jsx
β β βββ EditPassword.jsx
β β βββ ViewPassword.jsx
β β βββ Settings.jsx
β βββ App.jsx
β βββ main.jsx
βββ index.html
βββ vite.config.js
βββ package.json
- Node.js v18+
- MongoDB (local or MongoDB Atlas)
- A Gmail account with App Password enabled (for OTP emails)
git clone https://github.com/harshpatel0000/Lockify-project
cd locifycd Backend
npm installCreate a .env file in the Backend/ folder:
# Server
PORT=5000
NODE_ENV=development
# MongoDB
MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/locify
# JWT
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRES_IN=7d
# AES Encryption β must be exactly 32 characters
ENCRYPTION_KEY=your_32_character_encryption_key_
# Email (Gmail + App Password)
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_gmail_app_password
# Frontend URL (for CORS)
CLIENT_URL=http://localhost:5173
β οΈ ENCRYPTION_KEYmust be exactly 32 characters for AES-256 to work correctly.
Start the backend server:
# Development (auto-restart with nodemon)
npm run dev
# Production
npm startBackend runs at β http://localhost:5000
cd Frontend
npm install
npm run devFrontend runs at β http://localhost:5173
| Method | Endpoint | Description | Protected |
|---|---|---|---|
POST |
/register |
Register & send verification OTP | β |
POST |
/verify-otp |
Verify OTP (email verify or 2FA) | β |
POST |
/resend-otp |
Resend OTP to email | β |
POST |
/login |
Login & send 2FA OTP | β |
POST |
/forgot-password |
Send password reset OTP | β |
POST |
/reset-password |
Reset password using OTP | β |
GET |
/me |
Get current user info | β |
PUT |
/update-profile |
Update display name | β |
PUT |
/change-password |
Change account password | β |
DELETE |
/delete-account |
Delete account and all vault data | β |
| Method | Endpoint | Description | Protected |
|---|---|---|---|
GET |
/ |
Get all passwords (search, filter, sort) | β |
POST |
/ |
Add a new password | β |
GET |
/stats |
Dashboard statistics | β |
GET |
/favorites |
Get starred passwords | β |
GET |
/:id |
Get a single password (decrypted) | β |
PUT |
/:id |
Update a password | β |
PATCH |
/:id/favorite |
Toggle favorite/pin | β |
DELETE |
/:id |
Delete a single password | β |
DELETE |
/ |
Delete all passwords in vault | β |
All vault passwords are encrypted using Node.js's built-in crypto module before saving to MongoDB. A random IV (Initialization Vector) is generated on every encryption operation, ensuring that identical passwords always produce different ciphertext. Data is stored as iv:encryptedData in the database.
Plain Password β encrypt(AES-256-CBC, random IV) β iv:encryptedHex β MongoDB
MongoDB β iv:encryptedHex β decrypt(AES-256-CBC, iv) β Plain Password
User account passwords are hashed using bcrypt with a salt round of 12 via a Mongoose pre-save hook. Passwords are never stored in plain text, and comparison is done using bcrypt.compare().
Login β OTP Email β Verify OTP β Server signs JWT (7d expiry)
β Client stores token β Sent as "Authorization: Bearer <token>"
β auth middleware verifies on every protected route
Every login triggers a 6-digit OTP sent to the user's registered email. The OTP has a 10-minute expiry and is cleared from the database immediately after use.
| Scope | Limit |
|---|---|
Global API (/api/) |
100 requests / 15 min |
Auth routes (/api/auth/) |
10 attempts / 5 min |
- Helmet.js β Secure HTTP response headers (XSS, clickjacking, MIME sniffing protection)
- CORS β Restricted to the configured frontend URL only
- Input Validation β All inputs validated with
express-validator - Request Size Limit β JSON body limited to
10kb
| Route | Page | Auth Required |
|---|---|---|
/ |
Landing / Home | β |
/register |
Register | β |
/login |
Login | β |
/verify-otp |
OTP Verification | β |
/forgot-password |
Forgot Password | β |
/dashboard |
Dashboard | β |
/add-password |
Add Password | β |
/edit-password/:id |
Edit Password | β |
/passwords |
All Passwords | β |
/settings |
Account Settings | β |
Harsh Patel
- π§ harshpketanbhai@gmail.com
- π± +91 7433065770
- π B.E. Computer Science β New LJ Institute of Engineering and Technology, Ahmedabad
- π LinkedIn
This project is open-source and available under the MIT License.
β If you found this project helpful, please give it a star! β
Made with β€οΈ by Harsh Patel