# omidomidvari/webnet architecture

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

- Interactive diagram: https://gitdiagram.com/omidomidvari/webnet
- Repository: https://github.com/omidomidvari/webnet

## Overview

1. **Overall shape**
   - This is a very small **Electron desktop browser**. The architecture is centered in a single main entrypoint, `main.js`, which likely owns window creation, navigation policy, session setup, and security controls.
   - There are no separate backend services or large module boundaries visible in the repo; the app is essentially a **desktop shell around Electron’s browser primitives**.

2. **Primary runtime**
   - The runtime is **Node.js + Electron**.
   - `package.json` and `main.js` indicate the app starts from the Electron main process, with the browser UI and behavior managed locally on the desktop.

3. **Core user interface layer**
   - The UI is a **custom browser chrome** rather than a standard browser frame: URL bar plus Back and Reload controls.
   - This UI sits above an embedded page-rendering surface, forming a simple two-layer model: **app controls → web content view**.

4. **Navigation and search flow**
   - User input goes through a **navigation router** in the main app logic.
   - The app distinguishes between:
     - **direct URL navigation** for typed addresses
     - **DuckDuckGo search navigation** when the input is treated as a query
   - The search path is specialized with DuckDuckGo parameters (`&rpl=1&kp=1&ia=web`), which means search is an explicit architectural integration, not just a generic browser search box.

5. **Persistent browsing mode**
   - The default mode uses a **persistent session/cache**, so cookies, site data, and login state survive between launches.
   - Architecturally, this is the “normal profile” path and is optimized for convenience and faster revisits.

6. **Incognito / “Ghost” mode**
   - The app has a separate **memory-only session boundary** for Ghost mode.
   - This mode intentionally avoids persistent history and cookies, so it behaves like an isolated ephemeral profile rather than a regular tab state toggle.
   - For an architecture diagram, this is the key second browser profile alongside the default persistent session.

7. **Security controls**
   - The app enforces security policies at the browser engine layer:
     - **pop-up blocking**
     - **disabled dangerous hardware permissions by default**
   - These are not content features; they are runtime policy hooks that sit between web pages and the underlying Electron permissions APIs.

8. **External dependency boundary**
   - The only obvious external service is **DuckDuckGo**, used as the search backend for query-style navigation.
   - All other behavior is local to the desktop app and Electron runtime.

9. **Data persistence boundary**
   - The main architectural data boundary is **persistent local browser data vs. ephemeral in-memory data**.
   - Normal browsing writes cache/cookies/site state to disk through Electron’s default session; Ghost mode keeps those artifacts out of durable storage.

10. **Concurrency and component count**
   - This repo appears intentionally minimal: one app entrypoint, no separate services, no database, no API layer, no worker tier.
   - For diagramming, treat it as a **single-process orchestration app** that configures the Electron browser engine and exposes a custom browsing experience.

11. **Build/run boundary**
   - `npm install` and `npm start` suggest a standard local Electron development workflow.
   - There is no evidence of a separate build pipeline or deployment infrastructure in the repository snapshot.

12. **What matters most in the diagram**
   - The most important boxes are:
     - **Electron main process**
     - **Custom browser window / UI controls**
     - **Embedded web content**
     - **Persistent session**
     - **Ghost in-memory session**
     - **Navigation/search router**
     - **Security policy hooks**
   - The most important arrows are:
     - user input → navigation router
     - router → URL or DuckDuckGo
     - controls → browser content
     - browser content → session layer
     - security hooks → content permissions/popups

Main entry points: [`main.js`](https://github.com/omidomidvari/webnet/blob/main/main.js) (Main)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main["Main<br/>[main.js]"]
  node_window["Window"]
  node_chrome["Chrome<br/>ui controls"]
  node_router{{"Router<br/>nav logic"}}
  node_urlload["URL Load<br/>direct nav"]
  node_search["Search<br/>ddg query"]
  node_content["Web View<br/>embedded browser"]
  node_security{{"Security<br/>policy hooks"}}
end

subgraph group_profiles["Profiles"]
  node_persistent[("Normal Mode<br/>persistent session")]
  node_ghost["Ghost Mode<br/>memory session"]
end

subgraph group_external["External"]
  node_ddg["DuckDuckGo<br/>search backend"]
end

node_main -->|"creates"| node_window
node_main -->|"hosts"| node_chrome
node_main -->|"wires"| node_router
node_main -->|"manages"| node_content
node_main -->|"enforces"| node_security
node_chrome -->|"input"| node_router
node_router -->|"direct URL"| node_urlload
node_router -->|"query"| node_search
node_urlload -->|"loads"| node_content
node_search -->|"searches"| node_ddg
node_ddg -->|"returns results"| node_content
node_content -->|"default profile"| node_persistent
node_content -->|"ephemeral profile"| node_ghost
node_security -->|"limits"| node_content

click node_main "https://github.com/omidomidvari/webnet/blob/main/main.js"

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_main,node_window,node_chrome,node_router,node_urlload,node_search,node_content,node_security toneBlue
class node_persistent,node_ghost toneAmber
class node_ddg toneMint
```

## Components

### Runtime

Electron main-process orchestration and browser chrome.

- [Main](https://github.com/omidomidvari/webnet/blob/main/main.js): electron main · Main-process entrypoint that wires the app together. · `main.js`
- **Window**: browser window · Creates and manages the desktop browser shell.
- **Chrome**: ui controls · Custom URL bar and navigation controls.
- **Router**: nav logic · Decides whether input is a direct URL or a search query.
- **URL Load**: direct nav · Loads typed addresses directly into the web view.
- **Search**: ddg query · Transforms queries into DuckDuckGo search navigation.
- **Web View**: embedded browser · Rendered web content surface inside the app.
- **Security**: policy hooks · Applies popup blocking and restrictive permission handling.

### Profiles

Persistent and ephemeral browser session boundaries.

- **Normal Mode**: persistent session · Default profile with durable cookies, cache, and site state.
- **Ghost Mode**: memory session · Ephemeral profile with no durable browsing state.

### External

Outside service used for search navigation.

- **DuckDuckGo**: search backend · External search service used for query-style navigation.

## Connections

- Main → Window: creates · Main process creates the browser window.
- Main → Chrome: hosts · Main process wires the custom browser controls.
- Main → Router: wires · Main process connects input handling to navigation logic.
- Main → Web View: manages · Main process controls the embedded web content surface.
- Main → Security: enforces · Main process applies browser policy hooks.
- Chrome → Router: input · URL bar and buttons feed navigation requests to the router.
- Router → URL Load: direct URL · Typed addresses are loaded as direct navigation.
- Router → Search: query · Search terms are converted into DuckDuckGo navigation.
- URL Load → Web View: loads · Direct navigation updates the embedded page view.
- Search → DuckDuckGo: searches · Query navigation is sent to DuckDuckGo.
- DuckDuckGo → Web View: returns results · Search results are displayed in the web view.
- Web View → Normal Mode: default profile · Normal browsing uses durable session storage.
- Web View → Ghost Mode: ephemeral profile · Ghost mode uses an in-memory session boundary.
- Security → Web View: limits · Popup and permission policies constrain page behavior.
