Citadel is a modern, secure password manager built with Next.js 15, featuring client-side encryption, passkey authentication, and a beautiful user interface. Your passwords are encrypted on your device before being stored, ensuring maximum security and privacy.
- End-to-End Encryption: All vault items are encrypted client-side using AES-256-GCM encryption
- Passkey Support: Modern WebAuthn-based authentication with biometric support (Face ID, Touch ID, Windows Hello)
- Dark Mode: Full dark mode support with seamless theme switching
- Password Generator: Generate strong, customizable passwords with real-time strength indicators
- Responsive Design: Works perfectly on desktop, tablet, and mobile devices
- Vault Management: Store and organize passwords, notes, URLs, and tags
- Search & Filter: Quickly find vault items with search and tag filtering
- Performance: Built with Next.js 15
- Framework: Next.js 15 with App Router
- UI Library: React 19
- Styling: Tailwind CSS 4
- Animations: Framer Motion
- UI Components: Radix UI
- Visual Effects: @paper-design/shaders-react
- Icons: Lucide React
- Fonts: Geist Sans, Geist Mono, Outfit
- Authentication: Better Auth
- WebAuthn: @simplewebauthn/browser & @simplewebauthn/server
- Database: MongoDB with Mongoose
- Session Management: Better Auth with cookie-based sessions
- Encryption Algorithm: AES-256-GCM
- Key Derivation: PBKDF2 with SHA-256 (100,000 iterations)
- Client-Side Encryption: All vault data is encrypted in the browser before transmission
- Language: TypeScript
- Linter/Formatter: Biome
- Build Tool: Turbopack (Next.js 15)
- Analytics: Vercel Analytics
Before you begin, ensure you have the following installed:
- Node.js: Version 20.x or higher (Download here)
- npm, yarn, pnpm, or bun: Package manager of your choice
- MongoDB: Local instance or MongoDB Atlas account (Get started)
- Git: For cloning the repository
git clone https://github.com/Vashishta-Mithra-Reddy/citadel.git
cd citadelChoose your preferred package manager:
# Using npm
npm install
# Using yarn
yarn install
# Using pnpm
pnpm install
# Using bun
bun installCreate a .env.local file in the root directory:
touch .env.localAdd the following environment variables:
# MongoDB Connection String
MONGO_URI=your_mongodb_connection_string
# Better Auth Configuration
BETTER_AUTH_SECRET=your_random_secret_key
BETTER_AUTH_URL=http://localhost:3000
# Optional: For production deployment
# BETTER_AUTH_URL=https://yourdomain.comImportant Notes:
- Replace
your_mongodb_connection_stringwith your actual MongoDB connection string- Local MongoDB:
mongodb://localhost:27017/citadel - MongoDB Atlas:
mongodb+srv://<username>:<password>@cluster.mongodb.net/citadel
- Local MongoDB:
- Generate a secure random string for
BETTER_AUTH_SECRET(32+ characters recommended)- You can use:
openssl rand -base64 32
- You can use:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 in your browser to see Citadel in action! π
npm run build
npm startcitadel/
βββ app/ # Next.js App Router
β βββ (auth)/ # Authentication routes
β β βββ sign-in/ # Sign-in page
β β βββ sign-up/ # Sign-up page
β βββ api/ # API routes
β βββ dashboard/ # Dashboard page
β βββ password-generator/ # Password generator tool
β βββ providers/ # React context providers
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
βββ components/ # React components
β βββ ui/ # Reusable UI components
β βββ vault/ # Vault-related components
β βββ webauthn/ # Passkey/WebAuthn components
β βββ Header.tsx # Main header
β βββ HomeClient.tsx # Home page client component
β βββ PasswordGenerator.tsx # Password generator component
βββ lib/ # Utility libraries
β βββ auth-client.ts # Better Auth client configuration
β βββ crypto.ts # Encryption utilities
β βββ db.ts # MongoDB connection
β βββ utils.ts # General utilities
βββ types/ # TypeScript type definitions
βββ utils/ # Server-side utilities
β βββ auth.ts # Better Auth server configuration
βββ public/ # Static assets
βββ biome.json # Biome configuration
βββ next.config.ts # Next.js configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
The main vault component that displays all encrypted password items.
Features:
- Displays encrypted vault items in a grid layout
- Search functionality to filter items
- Tag-based filtering
- Click to reveal passwords temporarily
- Edit and delete vault items
- Animated transitions
Props:
interface VaultProps {
encryptedItems: {
_id: string;
ciphertext: string;
iv: string
}[];
}Modal form for adding/editing vault items.
Features:
- Add or edit passwords, notes, URLs, and tags
- Real-time validation
- Automatic encryption before saving
- Smooth modal animations
Password verification form to unlock the encrypted vault.
Features:
- Verifies master password
- Derives encryption key client-side
- Unlocks vault without exposing password to server
- Error handling for incorrect passwords
Advanced password generation tool with customization options.
Features:
- Adjustable password length (8-32 characters)
- Character type selection (uppercase, lowercase, numbers, symbols)
- Exclude similar characters option
- Real-time password strength indicator
- One-click copy to clipboard
- Smooth animations and visual feedback
Password Options:
interface PasswordOptions {
length: number;
includeUppercase: boolean;
includeLowercase: boolean;
includeNumbers: boolean;
includeSymbols: boolean;
excludeSimilar: boolean;
excludeSpecialChars: string[];
}Component for registering passkeys/WebAuthn credentials.
Features:
- Registers device for biometric authentication
- Auto-detects device type (browser and OS)
- Uses WebAuthn API
- Fallback to traditional password if not supported
WebAuthn-based login component.
Features:
- Biometric authentication (Face ID, Touch ID, Windows Hello)
- Platform authenticator support
- Secure and passwordless login
Main navigation header.
Features:
- User authentication status display
- Theme switcher integration
- Responsive navigation
- Smooth animations
Dark/light mode toggle.
Features:
- Persistent theme preference
- System theme detection
- Smooth theme transitions
Context provider for authentication state management.
Features:
- Session state management
- User data access throughout the app
- Protected route handling
Context provider for encryption key management.
Features:
- Manages encryption key lifecycle
- Vault lock/unlock state
- Secure key storage in memory only (never persisted)
All vault items are encrypted on the client side before being sent to the server:
- Key Derivation: User's master password is combined with a unique salt using PBKDF2 (100,000 iterations) to derive an AES-256 key
- Encryption: Vault items are encrypted using AES-256-GCM with a random IV for each item
- Storage: Only the ciphertext and IV are stored in the database
- Decryption: Happens client-side after successful authentication
- Uses the latest WebAuthn standard (Level 2)
- Supports platform authenticators (Touch ID, Face ID, Windows Hello)
- Phishing-resistant authentication
- No password exposure during passkey authentication
- Secure HTTP-only cookies
- Session caching for performance (10-minute cache)
- Automatic session expiration
- CSRF protection
- Cryptographically secure random number generation
- Customizable complexity
- Avoids ambiguous characters when selected
- Real-time strength assessment
npm run lintUses Biome for fast, modern linting and formatting.
npm run formatAutomatically formats code according to Biome rules.
TypeScript is configured with strict mode. Type check with:
npx tsc --noEmitThe easiest way to deploy Citadel is using Vercel:
- Push your code to GitHub
- Import your repository in Vercel
- Add environment variables:
MONGO_URIBETTER_AUTH_SECRETBETTER_AUTH_URL(set to your production domain)
- Deploy!
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Live Demo: https://citadel.v19.tech