# revan-02/website-blocker-python. architecture

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

- Interactive diagram: https://gitdiagram.com/revan-02/website-blocker-python.
- Repository: https://github.com/revan-02/website-blocker-python.

## Overview

##### Project type and purpose
- This is a desktop full-stack (single-machine) productivity app written in Python with a Tkinter GUI.
- Purpose: block/unblock websites by editing the system hosts file, with password protection, multi-user profiles, scheduling, and logging.

##### File structure
- The repository contains only README.md and website_blocker.py.
- All functionality lives inside the monolithic Python script: GUI, business logic, configuration, scheduling, file I/O, and logging.
- No separate “backend” or “frontend” services—everything runs in one process on the user’s machine.

##### README for additional insights
- Core modules implied:
- GUI (Tkinter)
- Authentication (password check, profile management)
- Blocking engine (hosts file modifier + DNS flush)
- Scheduler (time-based activation)
- Temporary-block timer
- Logging (action history)
- Cross-platform considerations: Windows, macOS, Linux.

##### Detailed checklist
- Data flow: e.g., “block request”, “hosts file update”, “DNS flush”.
- Multi-user support: Profile Manager reads from per-user config.
- Password protection flow: Authentication Manager gatekeeping the Controller.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User["User"]:::external

    %% Application Layers
    subgraph "Application Process"
        direction TB

        %% UI Layer
        GUI["GUI Layer\n(Tkinter windows & controls)"]:::ui

        %% Core Logic Layer
        subgraph "Controller / Application Core"
            direction TB
            Auth["Authentication Manager"]:::logic
            Profile["Profile Manager"]:::logic
            BlockEngine["Block Engine"]:::logic
            Scheduler["Scheduler & Timer Module"]:::logic
            Logger["Logger"]:::logic
        end

        %% Persistence Layer
        subgraph "Persistence Layer"
            direction TB
            Config["Configuration Persistence\n(user profiles, schedules)"]:::persistence
            Logs["Logs\n(action history)"]:::persistence
        end
    end

    %% External OS Resources
    HostsFile["Hosts File"]:::external
    DNSCache["DNS Cache\n(subsystem)"]:::external
    README["README / Documentation"]:::external

    %% Connections
    User -->|"interacts with"| GUI
    GUI -->|"commands"| Auth
    Auth -->|"on success"| Profile
    Profile -->|"load config"| Config
    Profile -->|"save config"| Config
    Auth -->|"denies"| GUI

    Profile -->|"user context"| BlockEngine
    Scheduler -.->|"timer trigger"| BlockEngine
    GUI -->|"block/unblock request"| BlockEngine
    BlockEngine -->|"modify file"| HostsFile
    BlockEngine -->|"flush DNS"| DNSCache

    BlockEngine -->|"log action"| Logger
    Scheduler -->|"log schedule event"| Logger
    Logger -->|"write logs"| Logs

    Config -->|"read/write"| Profile
    Config -->|"loaded by"| Scheduler

    README

    %% Click Events
    click GUI "https://github.com/revan-02/website-blocker-python./blob/main/website_blocker.py"
    click Auth "https://github.com/revan-02/website-blocker-python./blob/main/website_blocker.py"
    click Profile "https://github.com/revan-02/website-blocker-python./blob/main/website_blocker.py"
    click BlockEngine "https://github.com/revan-02/website-blocker-python./blob/main/website_blocker.py"
    click Scheduler "https://github.com/revan-02/website-blocker-python./blob/main/website_blocker.py"
    click Logger "https://github.com/revan-02/website-blocker-python./blob/main/website_blocker.py"
    click Config "https://github.com/revan-02/website-blocker-python./blob/main/website_blocker.py"
    click README "https://github.com/revan-02/website-blocker-python./blob/main/README.md"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1B4F72,color:#1B2631;
    classDef logic fill:#ABEBC6,stroke:#196F3D,color:#1D5125;
    classDef persistence fill:#F9E79F,stroke:#B9770E,color:#784212;
    classDef external fill:#D5DBDB,stroke:#616A6B,color:#1B2631;
```
