RandPassGen is a password generator built with Next.js.
You choose the password length and character types (uppercase, lowercase, numbers, symbols), generate a password, see its strength, and copy it to your clipboard.
- Generate passwords with configurable rules
- Strength indicator (
Too Weak,Weak,Medium,Strong) - Copy to clipboard with toast feedback
- Form validation with sensible defaults
- Lightweight, keyboard-friendly UI built on Radix primitives
- Theme-aware styling with Tailwind utility classes
- Core:
- Next.js 14 (patched 14.2.x line)
- React 18 + TypeScript
- Tailwind CSS
- UI and state:
- Radix UI
- Zustand
- Sonner (toasts)
- Lucide React (icons)
- Forms and validation:
- React Hook Form
- Zod
- Testing:
- Vitest
- Testing Library
src/lib/constants: static copy and fixed config valuessrc/lib/helpers: pure utility functionssrc/lib/hooks: orchestration and side effects (store, toast, clipboard)src/components/custom-reusable: render-focused application components
These conventions are not just folder preferences. They make the code easier to change safely.
- Reuse: shared copy/config lives in constants, and pure logic in helpers can be reused by multiple hooks/components without duplication.
- Testability: helpers are side-effect free, so tests can assert input/output behavior directly; hook logic is isolated and easier to mock when needed.
- Presentational components: custom-reusable components mostly render UI and bind values/handlers from hooks, which keeps JSX files small and predictable.
- Type safety consistency: strength values are modeled with a const-union (
PASSWORD_STRENGTH+PasswordStrengthtype), so schemas, store, helpers, and UI all use the same source of truth.
npm install
npm run devOpen http://localhost:3000.
To build and run production mode:
npm run build
npm run startnpm run dev
npm run build
npm run start
npm run lint
npm run test
npm run test:watch- Set password length with the slider.
- Choose which character groups to include.
- Click
Generate. - Click the copy icon to copy the result.
- Too Weak: red
- Weak: orange
- Medium: yellow
- Strong: green
Tests are unit-focused and live in __tests__ folders near the modules they cover.
Examples:
src/lib/helpers/__tests__/helpers.test.tssrc/lib/helpers/__tests__/generatorForm.test.ts
Run tests with:
npm run test- Next.js is pinned to a patched 14.x release line for recent RSC-related advisories.
- Transitive lockfile updates were applied for
cross-spawnandbraces. - Some upstream advisories may still appear in
npm auditand require broader dependency upgrades.
Password generation currently uses Math.random(). That is fine for demo/general use, but it is not cryptographically secure for high-security production requirements.



