# zero-peak/zeroomega architecture

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

- Interactive diagram: https://gitdiagram.com/zero-peak/zeroomega
- Repository: https://github.com/zero-peak/zeroomega

## Overview

##### Project Identification
- ZeroOmega is a browser proxy management extension – a fork of SwitchyOmega – that supports building as a Chrome/Chromium extension and also as a Firefox Addon using the WebExtension API.
- Its primary purpose is to let users manage and quickly switch among multiple proxy profiles, including generating PAC (Proxy Auto-Config) scripts.

##### Main Components
- Build & Deployment:
– “omega-build”: Contains Grunt build files and package configurations that orchestrate installing dependencies and linking each module.
- PAC Generator Module:
– “omega-pac”: A standalone module that handles the profile model and compiles profiles into PAC scripts. It also includes a test suite.
- Core Options Manager (Backend Logic):
– “omega-target”: Contains browser-independent logic for managing options and applying profiles. It provides the abstract “OmegaTarget” base classes that can be subclassed.
- Web Configuration Interface:
– “omega-web”: A web-based configuration interface (in Angular) that uses components like controllers, views (jade/less files), and integrates with the backend logic via an external script (omega_target_web.js) that implements browser-dependent communication.
- Browser/Environment Specific Targets:
– “omega-target-chromium-extension”: Contains Chromium/Firefox-specific code—including background scripts, manifest files, and browser API integrations. This target extends the core classes with the required methods, e.g., via an implementation of the omega_target_web module.
- Localization Support:
– “omega-locales”: Holds message catalogs for many languages, which feeds into the user interface components.

##### Recommended Interaction & Data Flow
- The web UI (from the “omega-web” module) interacts with a browser-specific backend (omega-target and its target-specific implementations from “omega-target-chromium-extension”) by way of the custom angular module (omega_target_web.js).
- The PAC generation functionality is separate in “omega-pac” but operates on the same profiles/options data managed by “omega-target” (or via communication from the UI).
- The build pipeline (omega-build) ties these modules together, ensuring that when a target is built (for example, a Chromium extension), all modules (UI, backend logic, PAC generator) are correctly integrated.

##### Important Architectural Patterns & Design Principles
- Layered/MVC Approach – The project separates concerns by providing:
- A core business logic (omega-target) managing options/profiles,
- A standalone PAC generator (omega-pac) module,
- A specialized web-based presentation layer (omega-web),
- And environment-specific extensions (omega-target-chromium-extension).
- Modularity & Reusability – Each module has well-defined responsibilities and interacts through clear interfaces (such as the omega_target_web angular module example).
- Extensibility – The use of abstract base classes in “omega-target” and extended subclasses in target folders allow for easy addition of new browser targets.
- Build Automation – The Grunt-based build process ensures modules are linked, tested, and packaged consistently.

## Diagram (Mermaid)

```mermaid
graph TB
  subgraph "Build & Deployment"
    b["Build System (omega-build)"]:::deployment
  end

  subgraph "Frontend Layer"
    web["Web UI (omega-web)"]:::frontend
    loc["Localization (omega-locales)"]:::localization
  end

  subgraph "Backend Layer"
    core["Core Options Manager (omega-target)"]:::backend
    pac["PAC Generator (omega-pac)"]:::backend
    target["Browser Specific Target (omega-target-chromium-extension)"]:::backend
  end

  web -->|"via_omega_target_web.js"| core
  core -->|"generatePAC"| pac
  core -->|"executeAPI"| target
  loc -->|"i18n_usage"| web
  b --> web
  b --> core
  b --> pac
  b --> target

  click b "https://github.com/zero-peak/zeroomega/blob/master/omega-build/Gruntfile.coffee"
  click pac "https://github.com/zero-peak/zeroomega/blob/master/omega-pac/src/pac_generator.coffee"
  click core "https://github.com/zero-peak/zeroomega/blob/master/omega-target/index.coffee"
  click web "https://github.com/zero-peak/zeroomega/blob/master/omega-web/src/omega/app.coffee"
  click target "https://github.com/zero-peak/zeroomega/blob/master/omega-target-chromium-extension/src/coffee/omega_target_web.coffee"
  click loc "https://github.com/zero-peak/zeroomega/tree/master/omega-locales"

  classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
  classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
  classDef deployment fill:#fff3cd,stroke:#856404,stroke-width:2px;
  classDef localization fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
