How nerdylua/password-manager-web works
Project type and purpose
• This is a full-stack, client-heavy web application built with Next.js 15 (App Router) and TypeScript.
• It implements a zero-knowledge, end-to-end encrypted password manager (“CryptLock”) that uses Firebase for authentication and real-time data storage.
• Its core promise is that the master password never leaves the client, so all encryption/decryption happens in the browser.
File structure
• Top-level “app/” directory holds Next.js routes for auth (login/register/forgot-password), dashboard, vault, global layout and error pages.
• “components/” hosts reusable UI pieces, including shadcn/ui primitives under “components/ui”, custom modals, route guards, animations.
• “hooks/” contains React hooks: AuthContext for user state, a mobile-detection hook.
• “lib/” implements core logic: Firebase initialization, encryption utilities (PBKDF2, AES-256-CBC), vault-service (CRUD + sync), password strength analysis, generic helpers.
• Configuration files: next.config.ts, middleware.ts, Tailwind & PostCSS configs, tsconfig.json, ESLint config.
• Public assets under “public/”.
• Environment template and package manifests in root.
README for additional insights
• Tech stack: Next.js, Firebase Auth + Firestore + Hosting, CryptoJS, zxcvbn, React Hook Form, Tailwind CSS.
• Features emphasize offline support, real-time sync, route protection, cross-platform readiness.
Main components & interactions
a. Components
• User’s Browser & UI Layer (Next.js pages & React components)
• Frontend Service Layer (AuthContext, hooks, vault-service in lib/)
• Encryption Module (lib/encryption.ts + CryptoJS + PBKDF2)
• Firebase Services:
• Firebase Authentication
• Cloud Firestore
• Static Hosting / CDN (Vercel or Firebase Hosting)
• Optional: Local Cache (IndexedDB or in-memory for offline)
b. Relationships & Data Flow
• User ► enters master password ► Encryption Module ► derives key (PBKDF2) ► client-side encryption ► forms encrypted blob
• UI Layer ► calls vault-service ► writes/reads encrypted blob to/from Firestore
• AuthContext ► interacts with Firebase Auth ► provides JWT/session ► secured route access
• Firestore ► real-time sync pushes updates back to vault-service ► decryption then renders in UI
• Offline: service layer caches requests/blobs, syncs when online
c. Architectural Patterns & Principles
• Zero-Knowledge: encryption & decryption solely on client
• Separation of Concerns: UI components vs. service layer vs. crypto utils
• React Context for auth & session propagation
• Next.js App Router for SSR/CSR hybrid routing
• Component-based design (shadcn/ui primitives)
• Service abstraction (vault-service hides Firestore internals)
d. Key Technologies & Frameworks
• Next.js 15 (React, SSR/CSR)
• Firebase (Auth, Firestore, Hosting)
• CryptoJS & PBKDF2 for key derivation, AES-256-CBC encryption
• zxcvbn for password strength
• Tailwind CSS & shadcn/ui for styling
• React Hook Form for form state & validation
• Framer Motion for animations