How ivaishnavraj/crx-blueprint works
1. Project type and boundary
- This is a Chromium browser extension for inspecting extension packages, not a server app.
- The whole system stays inside the browser: there is no backend, API, or external processing service in the architecture.
2. Top-level modules
- manifest.json defines the extension entrypoints and permissions.
- popup/ provides the user-facing launcher UI.
- background/ contains the long-lived orchestration logic.
- editor/ is the in-browser file/package viewer.
- lib/ bundles third-party parsing/rendering libraries.
- icons/ and legal/ are supporting assets and static compliance pages.
3. User entry points
- The extension appears to support two main entry flows:
- opening the popup from the browser toolbar,
- using the right-click/context-menu style flow described in the README.
- Both paths ultimately hand a selected .crx, .zip, or extension source package into the same processing pipeline.
4. Background orchestration layer
- background/background.js is the coordination boundary between browser events and the viewer UI.
- It likely receives the user’s selection, prepares package data, and opens or feeds the editor view.
- This layer is where browser-extension lifecycle concerns live: event handling, tab/window messaging, and package handoff.
5. Package ingestion and CRX handling
- A core architectural step is converting a CRX binary package into something the extension can inspect.
- The README indicates this is done with low-level binary parsing using DataView to read CRX headers and then extract the embedded ZIP payload.
- This creates an in-memory archive representation that is passed forward for inspection, without writing to a server.
6. Archive and file abstraction
- lib/jszip.js provides archive decompression and file enumeration.
- Once the package is unpacked, the system treats it as a virtual file tree, allowing the editor to browse files as separate documents.
- This is the main data model boundary: “package bytes” → “archive entries” → “rendered file views.”
7. Viewer/editor subsystem
- editor/viewer.html and editor/viewer.js implement the main inspection workspace.
- This is where the extension source is displayed, navigated, and rendered.
- The editor is responsible for choosing the right presentation mode per file type rather than treating all files as plain text.
8. Rendering pipeline
- The repo includes several specialized renderers in lib/:
- Prism.js and language grammars for syntax highlighting,
- beautify.js / beautify-html.js / beautify-css.js for formatting/minification reversal,
- prism-markdown.js and prism-json.js for common structured formats.
- The viewer likely routes files through this pipeline based on extension/MIME-like inference.
9. Asset preview subsystem
- The README describes support for images, audio, video, fonts, and document/data formats.
- Architecturally, this implies the editor has multiple preview modes:
- code viewer,
- image renderer,
- media player,
- font preview,
- raw text/data viewer.
- This is a key boundary for diagramming: a single package fan-outs into specialized renderers.
10. Local-only privacy model
- The extension’s security model is “zero persistence”: all unpacking and rendering happen in-browser and in-memory.
- Closing the viewer tab is intended to drop the extracted data.
- That means the architecture deliberately avoids storage, sync, or network dependencies in the processing path.
11. Static compliance and branding
- legal/privacy.html serves the privacy notice inside the extension context.
- icons/ provides browser UI branding and install-time visuals.
- These are supporting surfaces, not part of the package-processing pipeline.
12. Main data flow to capture in a diagram
- User action → popup/context/menu trigger → background orchestration → CRX/ZIP ingestion → binary header parsing / archive extraction → in-memory file tree → editor/viewer rendering → file-type-specific preview/formatting.
- The clearest architectural boundary is between package extraction and rendering, with the background script acting as the bridge.
13. Key technologies that materially shape the design
- The repo is built with vanilla JavaScript, HTML, and CSS.
- JSZip and DataView are foundational to the archive pipeline.
- Prism.js and beautifiers define the inspection experience.
- The absence of a backend is a core architectural property, not just an implementation detail.
Main entry points: manifest.json Manifest · viewer.js Viewer logic · background.js Background · viewer.html Viewer shell
Components 18
Entry points
Toolbar popup and extension entry surfaces
- Manifest · Declares extension entrypoints, permissions, and wiring
manifest.json - Popup UI · Toolbar entry point for starting inspection
popup/popup.html - Popup logic · Handles popup interactions and dispatches selection flow
popup/popup.js
Background orchestration
Browser event handling and package handoff
- Background · Long-lived coordination boundary for browser events and viewer handoff
background/background.js - Context flow · Right-click style entry path into the same package pipeline
- CRX parser · Reads CRX headers from bytes and extracts the embedded archive payload
- Archive model · Virtual file tree built from extracted package contents
Viewer and rendering
In-browser package inspection workspace
- Viewer shell · Main in-browser workspace for browsing and inspecting package files
editor/viewer.html - Viewer logic · Coordinates file selection, preview choice, and rendering
editor/viewer.js - Code render · Syntax highlighting for source and structured text files
- Preview modes · Specialized previews for images, audio, video, fonts, and documents
Parsing and render libs
Third-party and bundled rendering helpers
- JSZip · Unpacks archive entries and enumerates package files
lib/jszip.js - Prism · Core syntax highlighting engine
lib/prism.js - JSON grammar · Adds JSON highlighting support
lib/prism-json.js - Markdown grammar · Adds Markdown highlighting support
lib/prism-markdown.js - Beautify · Formatting helpers used to improve readable source display
lib/beautify.js
Support assets
Static compliance and branding assets
- Privacy page · In-extension privacy notice
legal/privacy.html - Branding · Extension icons and install-time visuals
icons
Connections 20
- Manifest → Popup UI: declares · Manifest wires the popup launcher
- Manifest → Background: declares · Manifest registers the background orchestration script
- Manifest → Viewer shell: declares · Manifest exposes the inspection workspace
- Popup UI → Popup logic: drives · Popup UI events are handled by popup script
- Popup logic → Background: launches · Popup sends the selected package into background orchestration
- Context flow → Background: routes to · Context-menu style entry also lands in background orchestration
- Background → CRX parser: parses · Background turns CRX bytes into an embedded archive payload
- CRX parser → JSZip: hands off · Extracted archive bytes are passed to archive handling
- JSZip → Archive model: builds · Archive entries become an in-memory file tree
- Background → Viewer shell: opens · Background hands the package off to the viewer workspace
- Viewer shell → Viewer logic: boots · Viewer page loads the inspection controller
- Viewer logic → Archive model: browses · Viewer reads the virtual file tree for navigation and selection
- Viewer logic → Code render: renders · Source and text files go through syntax-highlighted code views
- Viewer logic → Preview modes: renders · Binary and media assets use specialized preview modes
- Code render → Prism: uses · Syntax highlighting is provided by Prism core
- Code render → JSON grammar: extends · JSON files use a dedicated Prism grammar
- Code render → Markdown grammar: extends · Markdown files use a dedicated Prism grammar
- Viewer logic → Beautify: formats · Beautifiers improve readability before display
- Manifest → Privacy page: exposes · Privacy notice is part of the extension package
- Manifest → Branding: uses · Icons supply browser UI branding