How hking0o1/cybergeeta-encryption-tool works
Project type and purpose
• SecureVault is a full-stack web application built with Next.js 14.
• It provides client-side and server-side encryption features (symmetric/asymmetric/file hashing), user authentication, and a personal vault backed by a database.
File structure
• Top-level “app/” folder holds Next.js 14 server-components and pages:
• app/page.tsx (home)
• app/encrypt/page.tsx & app/decrypt/page.tsx
• app/layout.tsx, app/globals.css
• “components/” contains reusable UI bits (navbar, footer, encryption-type cards) and a “components/ui” subfolder with shadcn/ui primitives.
• “hooks/” holds custom React hooks (use-mobile, use-toast).
• “lib/utils.ts” contains shared helper functions (e.g., crypto wrappers).
• Configuration: next.config.mjs, tailwind.config.ts, postcss.config.mjs, tsconfig.json.
• No visible “prisma/” folder, but README cites Prisma + NextAuth.js API routes for backend.
README
• Tech stack:
• Frontend: Next.js, React, Tailwind CSS, shadcn/ui
• Backend: Next.js API Routes, Prisma ORM, NextAuth.js
• DB: SQLite in development, PostgreSQL in production
• Encryption engine: Web Crypto API
• Features: AES-256, RSA, file encryption, SHA-256/512 hashing, vault storage, dark mode.
Core components & their interactions
a. Frontend Browser (React)
• Pages rendered via Next.js – SSR/ISR for public pages; CSR for vault interactions.
• Client-side Web Crypto API calls for encryption/decryption before any server call.
• UI components (shadcn/ui) wrapped by ThemeProvider for dark/light mode.
b. Next.js Server
• API Routes (e.g., /api/vault/create, /api/vault/fetch)
• NextAuth.js for session management
• Prisma ORM layer communicating with the database
c. Database
• SQLite (dev) or PostgreSQL (prod) stores user credentials, encrypted payloads, metadata.
d. External services
• Vercel (hosting)
• (Optional) Postgres cloud provider in production
Architectural patterns and design principles
• Hybrid rendering: Next.js SSR for initial pages, CSR for encryption-heavy workflows.
• API-route microservice pattern: discrete endpoints for vault CRUD.
• Context pattern for theme and toast notifications.
• Separation of concerns: UI logic in components/, business logic in lib/, data access in Prisma.
Diagramming guidance
• Client (Browser) – e.g., blue rectangle
• External Services – gray cloud
1. User ↔ Next.js pages (HTTP/SSR)
2. Client-side: Next.js page → Web Crypto API (encrypt/decrypt)
3. Encrypted payload → API Route → Prisma → Database
4. Database → Prisma → API Route → NextAuth session validation
5. Next.js pages display decrypted data after fetching
• UI components under a “shadcn/ui” boundary; group hooks and utils as “client logic.”