Skip to content

A Flask-based password generator showcasing Clean Architecture, SOLID principles, and modern web development — featuring customizable password generation, strength analysis, and a minimalist dark UI.

License

Notifications You must be signed in to change notification settings

benorbiato/password-generate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Password Generator

A minimalist, secure password generator built with Python Flask following Clean Architecture principles, featuring a clean dark theme with orange/red accents and no external dependencies.

Features

  • Clean Architecture: Follows SOLID principles with clear separation of concerns
  • Minimalist Design: Clean, dark interface with orange/red accents
  • Theme Toggle: Switch between dark and light modes
  • Customizable Password Generation: Configure length, character types, and advanced options
  • Real-time Strength Analysis: Visual feedback on password security
  • Multiple Password Generation: Generate several passwords at once
  • Copy to Clipboard: One-click password copying with notifications
  • Responsive Design: Works on desktop and mobile devices
  • No External Dependencies: Pure Python implementation
  • Testable Code: Unit tests for all business logic

Quick Start

Prerequisites

  • Python 3.7+
  • pip (Python package manager)

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/password-generate.git
    cd password-generate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the application:

    python main.py
  4. Access the application:

    http://localhost:3000
    

Architecture

This project follows Clean Architecture principles with clear separation of concerns:

Domain Layer (src/domain/)

  • Entities: Core business objects (Password, PasswordConfig, PasswordStrengthAnalysis)
  • Repositories: Abstract interfaces for data access
  • Services: Domain-specific business logic (PasswordStrengthService)

Application Layer (src/application/)

  • Use Cases: Application-specific business rules
  • Interfaces: Contracts for external dependencies

Infrastructure Layer (src/infrastructure/)

  • Repositories: Concrete implementations of domain repositories
  • Web Services: External service implementations
  • Configuration: Application settings and configuration

Presentation Layer (src/presentation/)

  • Web: Flask web application and controllers
  • CLI: Command-line interface (future enhancement)

Key Benefits:

  • Testability: Each layer can be tested independently
  • Maintainability: Clear separation of concerns
  • Flexibility: Easy to swap implementations
  • SOLID Principles: Follows all SOLID design principles

Technologies Used

Backend

  • Framework: Python Flask
  • Language: Python 3.7+
  • Architecture: Clean Architecture
  • Dependencies: Flask, Flask-CORS
  • Testing: pytest (for unit tests)

Frontend

  • Framework: Flask with embedded HTML/CSS/JavaScript
  • Styling: Custom CSS with dark theme
  • Interactivity: Vanilla JavaScript
  • Responsive: Mobile-first design

Project Structure

password-generate/
├── src/
│   ├── domain/               # Domain layer (business logic)
│   │   ├── entities/         # Business entities
│   │   ├── repositories/     # Repository interfaces
│   │   └── services/         # Domain services
│   ├── application/          # Application layer (use cases)
│   │   ├── use_cases/        # Business use cases
│   │   └── interfaces/       # Application interfaces
│   ├── infrastructure/       # Infrastructure layer
│   │   ├── repositories/     # Repository implementations
│   │   ├── web/             # Web service implementations
│   │   └── config/          # Configuration
│   └── presentation/         # Presentation layer
│       └── web/             # Web interface (Flask)
├── tests/                    # Unit tests
├── requirements.txt          # Python dependencies
├── main.py                  # Application entry point
└── README.md

How to Use

Generating Passwords

  1. Configure length: Use the slider to set password size (4-50 characters)
  2. Select character types:
    • ✅ Uppercase Letters (A-Z)
    • ✅ Lowercase Letters (a-z)
    • ✅ Numbers (0-9)
    • ✅ Symbols (!@#$%^&*)
  3. Advanced options:
    • Exclude similar characters (0, O, 1, l, I)
    • Exclude ambiguous characters ({ } [ ] ( ) / \ ' " ` ~ , ; . < >)
  4. Click "Generate Single Password" or "Generate 5 Passwords"

Checking Password Strength

  1. Enter a password in the "Password Strength Checker" field
  2. View detailed analysis with color-coded feedback and suggestions

Theme Toggle

  • Click the sun/moon icon in the top-right corner
  • The theme will automatically detect your system preference
  • Toggle between light and dark modes

API Endpoints

POST /generate

Generates a new password based on provided parameters.

Request Body:

{
  "length": 12,
  "use_uppercase": true,
  "use_lowercase": true,
  "use_numbers": true,
  "use_symbols": true,
  "exclude_similar": false,
  "exclude_ambiguous": false
}

Response:

{
  "success": true,
  "password": "Kx9#mP2$vL8@",
  "strength": {
    "score": 8,
    "level": "Good",
    "percentage": 80,
    "feedback": [],
    "has_upper": true,
    "has_lower": true,
    "has_digit": true,
    "has_symbol": true,
    "length": 12
  }
}

POST /strength

Checks the strength of an existing password.

Request Body:

{
  "password": "mypassword123"
}

Response:

{
  "success": true,
  "strength": {
    "score": 4,
    "level": "Fair",
    "percentage": 40,
    "feedback": ["Avoid sequential numbers", "Consider adding symbols"],
    "has_upper": false,
    "has_lower": true,
    "has_digit": true,
    "has_symbol": false,
    "length": 13
  }
}

Development

Frontend Development

# Start development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Run linting
npm run lint

Backend Development

# Start Flask development server
cd backend
python app.py

# Install new dependencies
pip install package-name
pip freeze > requirements.txt

Adding New Components

The project uses shadcn/ui components. To add new components:

npx shadcn-ui@latest add component-name

Deployment

Frontend Deployment

The frontend can be deployed to:

  • Vercel (recommended for Next.js)
  • Netlify
  • AWS Amplify
  • Any static hosting service

Backend Deployment

The backend can be deployed to:

  • Heroku
  • Railway
  • AWS EC2
  • Google Cloud Run
  • Any Python hosting service

Docker Deployment

Create a Dockerfile for the backend:

FROM python:3.9-slim
WORKDIR /app
COPY backend/ .
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]

Security

  • Passwords are generated using Python's random module with secure algorithms
  • No passwords are stored or transmitted to external servers
  • All password generation happens on the backend
  • CORS is properly configured for secure cross-origin requests
  • Code is open source and can be audited

Contributing

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/lorem)
  3. Commit your changes (git commit -m 'Add some lorem')
  4. Push to the branch (git push origin feature/lorem)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

If you encounter any issues or have suggestions:

  1. Open an issue
  2. Contact via email: norbiato.dev@gmail.com

About

A Flask-based password generator showcasing Clean Architecture, SOLID principles, and modern web development — featuring customizable password generation, strength analysis, and a minimalist dark UI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages