# kev1nweng/myphlex architecture

> Architecture diagram of the GitHub repository kev1nweng/myphlex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kev1nweng/myphlex
- Repository: https://github.com/kev1nweng/myphlex

## Overview

##### Project type and purpose
- This is a full-stack, cross-platform password-generation solution (“秘符灵匣 Myphlex”), split into two submodules:
- myph – the server side (REST/HTTP API, business logic, storage)
- lex  – the client side (web UI for configuration and password retrieval)
- Purpose: securely generate and serve user-specific passwords on demand, protected by a time-based dynamic passcode.

##### File structure
- Top level:
- .github/workflows – CI/CD pipelines (submodule_release.yml)
- .gitmodules – points to myph and lex
- README.md, LICENSE, .gitignore
- Submodules:
- myph – server implementation (API controllers, auth module, password-engine, persistence)
- lex  – client implementation (HTML/CSS/JS or framework code, UI components, HTTP client)

##### README for additional insights
- Architecture implied: browser-based UI (lex) calls server endpoints (myph)
- Key flows: initial configuration → dynamic passcode rules + static seed setup → subsequent password requests authenticated via dynamic code → server returns generated password
- Server must handle sessions (10-minute auto-logout), rule parsing, seed storage, password derivation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (Client)"
        direction TB
        Client["Client (lex)"]:::frontend
        ConfigurationUI["Configuration UI"]:::frontend
        DynamicPasscode["Dynamic Passcode Input"]:::frontend
        PasswordUI["Password Display & Clipboard"]:::frontend
        ClipboardUtility["Clipboard Utility"]:::frontend
    end

    %% API Boundary
    API["REST API"]:::boundary

    %% Backend Layer
    subgraph "Backend (Server)"
        direction TB
        Server["Server (myph)"]:::backend
        AuthController["Auth Controller (/auth)"]:::backend
        RuleParser["Rule Parser"]:::backend
        SessionManager["Session Manager"]:::backend
        PasswordEngine["Password Engine (/generate)"]:::backend
        UserStore[(User Store)]:::datastore
    end

    %% External Artifacts
    subgraph "Project Artifacts"
        direction TB
        SubmoduleConfig[".gitmodules"]:::external
        CICDPipeline[".github/workflows/submodule_release.yml"]:::external
        README["README.md"]:::external
        LICENSE["LICENSE"]:::external
    end

    %% Frontend Flow
    Client --> ConfigurationUI
    ConfigurationUI --> DynamicPasscode
    DynamicPasscode -->|POST /auth| API
    API --> AuthController
    AuthController --> RuleParser
    AuthController --> UserStore
    AuthController --> SessionManager
    SessionManager --> AuthController
    AuthController -->|200 OK + Token| API
    API --> DynamicPasscode

    DynamicPasscode -->|POST /generate| API
    API --> PasswordEngine
    PasswordEngine --> RuleParser
    PasswordEngine --> UserStore
    PasswordEngine -->|Generated Password| API
    API --> PasswordUI
    PasswordUI -.->|"copy to clipboard"| ClipboardUtility

    %% Backend containment
    AuthController --> Server
    RuleParser --> Server
    SessionManager --> Server
    PasswordEngine --> Server
    UserStore --> Server

    %% Click Events
    click Client "https://github.com/kev1nweng/myphlex/tree/main/lex/"
    click Server "https://github.com/kev1nweng/myphlex/tree/main/myph/"
    click CICDPipeline "https://github.com/kev1nweng/myphlex/blob/main/.github/workflows/submodule_release.yml"
    click SubmoduleConfig "https://github.com/kev1nweng/myphlex/blob/main/.gitmodules"
    click README "https://github.com/kev1nweng/myphlex/blob/main/README.md"
    click LICENSE "https://github.com/kev1nweng/myphlex/tree/main/LICENSE"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px
    classDef datastore fill:#FFD580,stroke:#000,stroke-width:1px
    classDef boundary fill:#D3D3D3,stroke:#000,stroke-dasharray: 5 5
    classDef external fill:#EEEEEE,stroke:#888,stroke-dasharray: 2 2
```
