Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Locify

Locify β€” A Secure Password Manager

Your digital life, locked down.

One master password is all you need. Locify remembers everything else β€” securely, privately, and only for you.

React Node.js MongoDB JWT AES-256 Vite License


πŸ“– About

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.


✨ Features

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

πŸ› οΈ Tech Stack

Frontend

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

Backend

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

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites


1. Clone the Repository

git clone https://github.com/harshpatel0000/Lockify-project
cd locify

2. Setup Backend

cd Backend
npm install

Create 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_KEY must be exactly 32 characters for AES-256 to work correctly.

Start the backend server:

# Development (auto-restart with nodemon)
npm run dev

# Production
npm start

Backend runs at β†’ http://localhost:5000


3. Setup Frontend

cd Frontend
npm install
npm run dev

Frontend runs at β†’ http://localhost:5173


πŸ“‘ API Reference

Auth β€” /api/auth

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 βœ…

Vault β€” /api/vault

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 βœ…

πŸ” Security Architecture

AES-256-CBC Encryption

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

bcrypt Password Hashing

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().

JWT Authentication Flow

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

Two-Factor Authentication (2FA)

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.

Rate Limiting

Scope Limit
Global API (/api/) 100 requests / 15 min
Auth routes (/api/auth/) 10 attempts / 5 min

Additional Security

  • 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

πŸ—ΊοΈ Pages & Routes

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 βœ…

πŸ‘¨β€πŸ’» Author

Harsh Patel

  • πŸ“§ harshpketanbhai@gmail.com
  • πŸ“± +91 7433065770
  • πŸŽ“ B.E. Computer Science β€” New LJ Institute of Engineering and Technology, Ahmedabad
  • πŸ”— LinkedIn

πŸ“„ License

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

About

Secure full-stack password manager built with React, Node.js, Express, and MongoDB.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages