A modern React application that generates secure passwords with customizable options. Built with React and styled with Tailwind CSS.
- Generate random passwords with customizable length (6-20 characters)
- Toggle options for including numbers and special characters
- Copy password to clipboard with a single click
- Clean and responsive UI with Tailwind CSS
- Real-time password generation as options change
Before you begin, ensure you have the following installed on your system:
- Node.js (v18.0.0 or higher recommended)
- npm (v9.0.0 or higher recommended)
Follow these steps to set up the project locally:
- Clone the repository:
git clone https://github.com/orewagaurav/passwordgenerator.git
cd passwordgenerator- Install dependencies:
npm installTo start the development server:
npm run devThis will start the Vite development server. Open your browser and navigate to http://localhost:5173 to view the application.
To create a production build:
npm run buildThe built files will be in the dist directory.
To preview the production build locally:
npm run preview- Adjust the password length using the slider (6-20 characters)
- Toggle the "Numbers" checkbox to include numbers in your password
- Toggle the "Characters" checkbox to include special characters
- Click the "Copy" button to copy the generated password to your clipboard
passwordgenerator/
├── public/ # Static assets
├── src/
│ ├── App.jsx # Main application component
│ ├── App.css # Component-specific styles
│ ├── index.css # Global styles with Tailwind imports
│ ├── main.jsx # Application entry point
│ └── assets/ # Images and other assets
├── index.html # HTML template
├── package.json # Project dependencies and scripts
├── vite.config.js # Vite configuration
└── README.md # Project documentation
- React - UI library
- Vite - Build tool and development server
- Tailwind CSS - Utility-first CSS framework
- ESLint - Code linting
To change the characters used in password generation, modify the passwordGenerator function in App.jsx:
const passwordGenerator = useCallback(() => {
let pass = "";
let str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (numberAllowed) {
str += "0123456789";
}
if (charAllowed) {
str += "!@#$%^&*()-_=+[]{},:|";
}
// Add or modify character sets here
// Password generation logic
// ...
}, [length, numberAllowed, charAllowed, setPassword]);The project uses Tailwind CSS for styling. You can modify the styles by:
- Editing the Tailwind classes directly in the JSX
- Creating custom styles in
App.css - Configuring Tailwind in a
tailwind.config.jsfile (if you need to extend the default configuration)
To deploy this project using GitHub Pages:
Install the GitHub Pages deployment package:
npm install gh-pages --save-devSpecify the GitHub Pages URL:
"homepage": "https://orewagaurav.github.io/Password_Generator"Inside the "scripts" section:
"predeploy": "npm run build",
"deploy": "gh-pages -d dist"In vite.config.js, add:
base: "/Password_Generator/",Make sure all files are committed:
git add .
git commit -m "Prepare for GitHub Pages deployment"
git push origin mainRun the deploy command:
npm run deployThis builds the app and pushes the dist/ folder to a new gh-pages branch.
- Go to your repository on GitHub
- Click on Settings > Pages
- Under Source, choose:
- Branch:
gh-pages - Folder:
/ (root)
- Branch:
- Click Save
After a minute or two, your site will be live at:
https://orewagaurav.github.io/Password_Generator/
Make sure dist/ is listed in .gitignore, and remove it from Git tracking:
git rm -r --cached dist/
git commit -m "Stop tracking dist folder"
git push