# cybertron288/cookie-copier architecture

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

- Interactive diagram: https://gitdiagram.com/cybertron288/cookie-copier
- Repository: https://github.com/cybertron288/cookie-copier

## Overview

##### Project type and purpose
- This is a browser-extension project (Chrome Extension) named “Cookie Copier.”
- Purpose: Let developers/testers copy HTTP cookies from one domain and paste them into another directly from the browser.

##### File structure
- Top-level files:
- manifest.json – declares extension metadata, permissions, and entry points
- popup.js – stores the business logic that reads/writes cookies via Chrome’s Cookie API
- No backend service or databases—everything runs client-side in the browser context.

##### README for additional insights
- Chrome installation steps confirm this is a pure client-side extension.
- Usage flow:
b) “Copy” action reads cookies from the current domain
c) User navigates to a second domain → “Apply” action writes those cookies to the new domain

a. Main components:
– User (in browser UI)
– Chrome Browser (extension host)
– Extension Manifest & Permissions
– Popup UI (HTML/CSS)
– Extension Logic (popup.js)
– Chrome Cookies API (chrome.cookies)
– Domain A (source site) & Domain B (target site)
b. Relationships & interactions:
2) popup.js requests cookies from Domain A via chrome.cookies.getAll()
3) Cookies are held temporarily (in-memory or chrome.storage.local)
4) After navigation, popup.js calls chrome.cookies.set() on Domain B
c. Architectural patterns/design principles:
– Single-page popup UI following event-driven callbacks
– Separation of concerns: UI layer (popup.html/CSS), logic layer (popup.js), and platform layer (Chrome API)
– Permission-driven security: only domains granted in manifest.json can be read/written
d. Key technologies/frameworks:
– Chrome Extensions Manifest v2/v3 (depending on manifest.json version)
– JavaScript (ES6) for popup logic
– Chrome Extension APIs (cookies, storage, activeTab)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interaction
    User["User (Browser UI)"]:::user

    subgraph "Chrome Browser (Extension Host)"
        Manifest["manifest.json\nPermissions"]:::manifest
        PopupUI["popup.html\nUI (HTML/CSS)"]:::ui
        Logic["popup.js\nLogic: read/write cookies"]:::logic
        CookiesAPI["chrome.cookies API"]:::api
        Storage["chrome.storage.local"]:::api
        Icons["icons/"]:::assets
        Readme["README.md\nInstallation Steps"]:::docs
    end

    subgraph "External Domains"
        DomainA["Domain A (source site)"]:::domain
        DomainB["Domain B (target site)"]:::domain
    end

    %% Flow
    User -->|"click extension icon"| PopupUI
    PopupUI -->|"load popup.html"| Logic
    Logic -->|"chrome.cookies.getAll() from Domain A"| CookiesAPI
    CookiesAPI -->|"return cookies from Domain A"| Logic
    Logic -->|"store cookies"| Storage
    User -->|"navigate to Domain B"| DomainB
    Logic -->|"chrome.cookies.set() on Domain B"| CookiesAPI
    CookiesAPI -->|"cookies applied on Domain B"| DomainB

    %% Manifest Relations
    Manifest --> PopupUI
    Manifest --> Logic
    Manifest --> Icons
    Readme --> Manifest

    %% Click Events
    click Manifest "https://github.com/cybertron288/cookie-copier/blob/main/manifest.json"
    click PopupUI "https://github.com/cybertron288/cookie-copier/blob/main/popup.html"
    click Logic "https://github.com/cybertron288/cookie-copier/blob/main/popup.js"
    click Icons "https://github.com/cybertron288/cookie-copier/tree/main/icons/"
    click Readme "https://github.com/cybertron288/cookie-copier/blob/main/readme.md"

    %% Styles
    classDef user fill:#D0E6A5,stroke:#333,stroke-width:1px
    classDef manifest fill:#FFD97D,stroke:#333,stroke-width:1px
    classDef ui fill:#A0C8F0,stroke:#333,stroke-width:1px
    classDef logic fill:#F1A0A0,stroke:#333,stroke-width:1px
    classDef api fill:#F7C59F,stroke:#333,stroke-width:1px
    classDef assets fill:#B39CD0,stroke:#333,stroke-width:1px
    classDef docs fill:#C2D0D4,stroke:#333,stroke-width:1px
    classDef domain fill:#95D9DA,stroke:#333,stroke-width:1px
```
