# kumarasakti/passgen architecture

> Architecture diagram of the GitHub repository kumarasakti/passgen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kumarasakti/passgen
- Repository: https://github.com/kumarasakti/passgen

## Overview

passgen is a Go CLI for generating configurable passwords, transforming words into password variations, and checking password strength. The principal flow is a user command through the CLI handler and application service, then domain generation and analysis, with results formatted for terminal display. The README also documents presets, batch generation, no-repeat generation, and strength suggestions. Application and several domain implementations were not sampled, so links into those subsystems are limited to calls visible in the CLI and documented behavior.

Main entry points: [`internal/infrastructure/cli/handler.go`](https://github.com/kumarasakti/passgen/blob/master/internal/infrastructure/cli/handler.go) (Command handler), [`internal/application/password_service.go`](https://github.com/kumarasakti/passgen/blob/master/internal/application/password_service.go) (Password service), [`internal/domain/services/password_analyzer.go`](https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/password_analyzer.go) (Password analyzer), [`main.go`](https://github.com/kumarasakti/passgen/blob/master/main.go) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI"]
  node_entry["CLI entry<br/>[main.go]"]
  node_handler["Command handler<br/>[handler.go]"]
  node_formatter["Result formatter<br/>[formatter.go]"]
end

subgraph group_application["Application"]
  node_app["Password service"]
end

subgraph group_generation["Password generation"]
  node_config["Password config<br/>[password.go]"]
  node_charset["Character sets<br/>[charset.go]"]
  node_generator["Password generator"]
  node_wordgen["Word generator"]
  node_wordpattern["Word transformations<br/>[word_pattern.go]"]
end

subgraph group_analysis["Password analysis"]
  node_analyzer["Password analyzer"]
  node_strength["Strength checker"]
  node_patterns["Pattern detector"]
end

node_user(("User"))
node_terminal["Terminal output"]
node_random["Crypto randomness"]

node_user -->|"runs command"| node_entry
node_entry -->|"creates handler"| node_handler
node_handler -->|"requests generation"| node_app
node_handler -->|"requests word generation"| node_app
node_handler -->|"requests strength check"| node_app
node_handler -->|"formats results"| node_formatter
node_formatter -->|"prints output"| node_terminal
node_config -->|"configures categories"| node_charset
node_generator -->|"draws random values"| node_random
node_wordgen -->|"transforms word"| node_wordpattern
node_analyzer -->|"checks strength"| node_strength
node_analyzer -->|"detects patterns"| node_patterns

click node_entry "https://github.com/kumarasakti/passgen/blob/master/main.go"
click node_handler "https://github.com/kumarasakti/passgen/blob/master/internal/infrastructure/cli/handler.go"
click node_formatter "https://github.com/kumarasakti/passgen/blob/master/internal/infrastructure/cli/formatter.go"
click node_app "https://github.com/kumarasakti/passgen/blob/master/internal/application/password_service.go"
click node_config "https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/password.go"
click node_charset "https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/charset.go"
click node_generator "https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/password_generator.go"
click node_wordgen "https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/word_password_generator.go"
click node_wordpattern "https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/word_pattern.go"
click node_analyzer "https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/password_analyzer.go"
click node_strength "https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/password_strength_checker.go"
click node_patterns "https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/pattern_detector.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_handler,node_formatter,node_user toneBlue
class node_app toneAmber
class node_config,node_charset,node_generator,node_wordgen,node_wordpattern toneMint
class node_analyzer,node_strength,node_patterns toneRose
class node_terminal,node_random toneIndigo
```

## Components

### CLI

- [CLI entry](https://github.com/kumarasakti/passgen/blob/master/main.go): `main.go`
- [Command handler](https://github.com/kumarasakti/passgen/blob/master/internal/infrastructure/cli/handler.go): `internal/infrastructure/cli/handler.go`
- [Result formatter](https://github.com/kumarasakti/passgen/blob/master/internal/infrastructure/cli/formatter.go): `internal/infrastructure/cli/formatter.go`

### Application

- [Password service](https://github.com/kumarasakti/passgen/blob/master/internal/application/password_service.go): `internal/application/password_service.go`

### Password generation

- [Password config](https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/password.go): `internal/domain/entities/password.go`
- [Character sets](https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/charset.go): `internal/domain/entities/charset.go`
- [Password generator](https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/password_generator.go): `internal/domain/services/password_generator.go`
- [Word generator](https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/word_password_generator.go): `internal/domain/services/word_password_generator.go`
- [Word transformations](https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/word_pattern.go): `internal/domain/entities/word_pattern.go`

### Password analysis

- [Password analyzer](https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/password_analyzer.go): `internal/domain/services/password_analyzer.go`
- [Strength checker](https://github.com/kumarasakti/passgen/blob/master/internal/domain/services/password_strength_checker.go): `internal/domain/services/password_strength_checker.go`
- [Pattern detector](https://github.com/kumarasakti/passgen/blob/master/internal/domain/entities/pattern_detector.go): `internal/domain/entities/pattern_detector.go`

### Other components

- **User**
- **Terminal output**
- **Crypto randomness**

## Connections

- User → CLI entry: runs command
- CLI entry → Command handler: creates handler
- Command handler → Password service: requests generation
- Command handler → Password service: requests word generation
- Command handler → Password service: requests strength check
- Command handler → Result formatter: formats results
- Result formatter → Terminal output: prints output
- Password config → Character sets: configures categories
- Password generator → Crypto randomness: draws random values
- Word generator → Word transformations: transforms word
- Password analyzer → Strength checker: checks strength
- Password analyzer → Pattern detector: detects patterns
