Zen Browser Documentation

repository·dev·Indexed 13 days ago

https://github.com/zen-browser/desktop

A Firefox-based web browser focused on user productivity. Documentation covers build tracks (Release and Twilight), configuration file structures, Live Folder provider implementations (RSS, GitHub, and REST API), and development guidelines including ESLint and SVGO configurations.

Tokens
3.8K
Snippets
10
Records
21
Agent score
49%

What's inside Zen Browser

  1. Understand the structure of Zen Browser configuration files

    dev

    Zen Browser configuration files are organized by their source or component. When looking for specific preference overrides, navigate the directory structure based on the following categories:

    • firefox/: Contains preferences used to override default Firefox behaviors.
    • zen/: Contains preferences specifically for configuring Zen-unique features.
    • privatefox/ & fastfox/: Contains a subset of preferences extracted from the Betterfox project for specialized browsing profiles.
  2. Understand Zen Browser Firefox versions

    dev

    Zen Browser provides two main build tracks based on Firefox versions:

    • Release: The stable build. Currently built using Firefox version 153.0.3.
    • Twilight: An experimental/preview build. Currently built using Firefox version RC 153.0.3.

    You can download these specific versions at zen-browser.app/download (use the ?twilight query parameter for the Twilight build).

  3. Understand the Zen Browser branch structure

    dev

    The repository uses a specific branching model to manage features and releases:

    • dev (main branch): The primary development branch and the default branch for the repository.
    • stable: The release branch, branched off from dev. It receives hotfixes (such as security patches) directly to avoid including unfinished features from other branches.
    • twilight: A feature branch branched off from dev.
    • features branches: Can be branched off from twilight or dev depending on the scope.

    This structure allows for applying critical patches to stable without being blocked by ongoing work in twilight or dev.

    dev (main branch)
     | |
     | \--->-- stable (release branch)
     |   ^
     ^   |
     |   \-<- Hotfix (hotfixes directly from stable)
     |
     \-<- (features branches)
  4. Understand the lifecycle of temporal Firefox patches

    dev

    The src/external-patches/firefox/ directory contains temporal patches applied to Firefox. These patches are imported from future Firefox versions to serve as temporary solutions.

    Critical Maintenance Rule: If these patches begin failing during new Firefox releases, they must be removed immediately. They are not intended to be permanent parts of the codebase and should only exist while waiting for official Firefox updates to include the relevant fixes.

  5. What are Zen Live Folders?

    dev
    Live Folders are dynamic, auto-updating folders in Zen that fetch and refresh their contents automatically from external sources like RSS feeds or APIs. Unlike static folders, they maintain an active connection to a data source. By default, Live Folders refresh every 30 minutes, though this interval is configurable in preferences.
  6. How LiveFolderProvider works

    dev

    The LiveFolderProvider is the abstract base class for all live folder implementations. It defines the contract for fetching items, managing update intervals, handling state serialization (cache and last update time), and providing metadata like icons and labels.

    Developers implementing a new provider must satisfy the following interface:

    interface FolderItem {
      id: string;
      title: string;
      url: string;
    }
    
    interface FolderMetadata {
      icon: string;
      label: string;
    }
    
    interface LiveFolderProvider {
      fetchItems(): Promise<FolderItem[]>;
      getMetadata(): FolderMetadata;
    }
  7. Understand LibreWolf patches in Zen Browser

    dev
    Zen Browser imports specific patches from LibreWolf to address issues or implement features that are present in LibreWolf but not yet available in upstream Firefox. These patches are maintained by the Zen team and will be removed once the changes are merged into Firefox or the underlying issue is resolved. These patches are intended to improve the browser experience by leveraging LibreWolf's proactive maintenance of Firefox forks.
  8. Configure a REST API Live Folder

    dev

    REST-based Live Folders fetch JSON data from an HTTP(S) endpoint and map it into folder items.

    Remote APIs

    For remote endpoints (https:// or http://), you can use a mapping configuration to tell Zen how to extract data from the JSON response.

    Localhost APIs

    For local endpoints (http://127.0.0.1 or http://localhost), the response must strictly follow Zen's Local REST Schema for security and consistency.

    Common Rules

    • All requests are GET.
    • Responses must be JSON.
    • CORS headers are ignored (Zen performs the fetch internally).
    • Max response size is 1 MB.
    • Items exceeding liveFolder.maxItems (default 100) will be automatically trimmed.
    {
      "type": "rest",
      "url": "https://api.example.com/posts",
      "mapping": {
        "items": "data.posts",
        "id": "id",
        "title": "headline",
        "url": "link"
      }
    }