# rodkisten/userscripts-cf architecture

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

- Interactive diagram: https://gitdiagram.com/rodkisten/userscripts-cf
- Repository: https://github.com/rodkisten/userscripts-cf

## Overview

Userscripts CF is a Tampermonkey userscript suite: users install either a unified script or individual scripts, and the unified runtime activates configured modules according to URL rules, including SPA navigation. The product spans RodX Studio, social-site tools, a page REPL, and shared runtime/UI capabilities. The README documents lifecycle and routing; the source index confirms selected internal dependencies. Many feature implementations were not sampled, so their internal call relationships are omitted rather than inferred.

Main entry points: [`src/core/runtime.ts`](https://github.com/rodkisten/userscripts-cf/blob/main/src/core/runtime.ts) (URL router), [`src/userscripts/rodx-studio/index.js`](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/index.js) (RodX Studio), [`src/userscripts/rodx-studio/search/query-compiler.js`](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/query-compiler.js) (Search compiler), [`src/userscripts/rodx-studio/search/query-parser.js`](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/query-parser.js) (Search parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Userscript Runtime"]
  node_config["Module rules"]
  node_router["URL router<br/>[runtime.ts]"]
  node_match["Rule matching<br/>[script-manager.js]"]
  node_pagebridge["Page-context bridge<br/>[gm-bridge.ts]"]
  node_gmstore[("Persistent GM storage<br/>[gm-storage.ts]")]
  node_ui["Shared UI library"]
  node_formcontrols["Form controls"]
  node_defaults["Runtime defaults<br/>[defaults.js]"]
end

subgraph group_rodx["RodX Studio"]
  node_rodx["RodX Studio<br/>[index.js]"]
  node_searchconfig["Search configuration<br/>[search.js]"]
  node_queryparser["Search parser<br/>[query-parser.js]"]
  node_querycompiler["Search compiler<br/>[query-compiler.js]"]
  node_blocktree["Search blocks<br/>[blocks.js]"]
  node_localrules["Local feed rules<br/>[local-rules.js]"]
  node_lists["Lists and collections"]
  node_media["Media enhancements"]
  node_network["Network inspection"]
  node_rodxui["RodX interface"]
end

subgraph group_social["Site Integrations"]
  node_instagram["Instagram saved<br/>[index.tsx]"]
  node_github["GitHub tools<br/>[index.tsx]"]
  node_gonewild["Reddit and Soundgasm<br/>[index.tsx]"]
end

subgraph group_tools["Developer Tools"]
  node_repl["Page REPL<br/>[index.js]"]
  node_inspector["DOM inspector<br/>[index.tsx]"]
  node_mobilefab["Mobile editor FAB<br/>[index.tsx]"]
  node_example["Example-site script<br/>[index.js]"]
end

node_person(("Userscript user"))
node_manager["Tampermonkey"]

node_person -->|"installs"| node_manager
node_manager -->|"runs script"| node_router
node_config -->|"configures modules"| node_router
node_router -->|"checks rules"| node_match
node_router -->|"injects page modules"| node_pagebridge
node_router -->|"provides module storage"| node_gmstore
node_router -->|"activates on URL match"| node_rodx
node_router -->|"activates on URL match"| node_instagram
node_router -->|"activates on URL match"| node_github
node_router -->|"activates on URL match"| node_gonewild
node_router -->|"activates on URL match"| node_repl
node_router -->|"activates on URL match"| node_inspector
node_router -->|"activates on URL match"| node_mobilefab
node_router -->|"activates on URL match"| node_example
node_rodx -.->|"uses configuration"| node_searchconfig
node_querycompiler -->|"parses queries"| node_queryparser
node_querycompiler -->|"parses directives"| node_localrules
node_querycompiler -->|"compiles blocks"| node_blocktree
node_queryparser -->|"uses limits"| node_searchconfig
node_queryparser -->|"builds and validates"| node_blocktree
node_formcontrols -.->|"renders with"| node_ui
node_lists -.->|"supports collections"| node_rodx
node_media -.->|"enhances media"| node_rodx
node_network -.->|"inspects traffic"| node_rodx
node_rodxui -.->|"provides interface"| node_rodx
node_instagram -.->|"syncs collections"| node_person

click node_config "https://github.com/rodkisten/userscripts-cf/blob/main/userscripts.config.js"
click node_router "https://github.com/rodkisten/userscripts-cf/blob/main/src/core/runtime.ts"
click node_match "https://github.com/rodkisten/userscripts-cf/blob/main/src/core/script-manager.js"
click node_pagebridge "https://github.com/rodkisten/userscripts-cf/blob/main/src/runtime/gm-bridge.ts"
click node_gmstore "https://github.com/rodkisten/userscripts-cf/blob/main/src/runtime/gm-storage.ts"
click node_ui "https://github.com/rodkisten/userscripts-cf/tree/main/src/runtime/solid-ui"
click node_formcontrols "https://github.com/rodkisten/userscripts-cf/tree/main/src/runtime/solid-ui/form-controls"
click node_defaults "https://github.com/rodkisten/userscripts-cf/blob/main/src/config/defaults.js"
click node_rodx "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/index.js"
click node_searchconfig "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/config/search.js"
click node_queryparser "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/query-parser.js"
click node_querycompiler "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/query-compiler.js"
click node_blocktree "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/blocks.js"
click node_localrules "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/feeds/local-rules.js"
click node_lists "https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/lists"
click node_media "https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/media"
click node_network "https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/network"
click node_rodxui "https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/ui"
click node_instagram "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/instagram-saved/index.tsx"
click node_github "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/github-tools/index.tsx"
click node_gonewild "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/gonewild/index.tsx"
click node_repl "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/page-repl/index.js"
click node_inspector "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/dom-inspector/index.tsx"
click node_mobilefab "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/mobile-editor-fab/index.tsx"
click node_example "https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/example-site/index.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_config,node_router,node_match,node_pagebridge,node_gmstore,node_ui,node_formcontrols,node_defaults,node_person toneBlue
class node_rodx,node_searchconfig,node_queryparser,node_querycompiler,node_blocktree,node_localrules,node_lists,node_media,node_network,node_rodxui toneAmber
class node_instagram,node_github,node_gonewild toneMint
class node_repl,node_inspector,node_mobilefab,node_example toneRose
class node_manager toneIndigo
```

## Components

### Userscript Runtime

- [Module rules](https://github.com/rodkisten/userscripts-cf/blob/main/userscripts.config.js): `userscripts.config.js`
- [URL router](https://github.com/rodkisten/userscripts-cf/blob/main/src/core/runtime.ts): `src/core/runtime.ts`
- [Rule matching](https://github.com/rodkisten/userscripts-cf/blob/main/src/core/script-manager.js): `src/core/script-manager.js`
- [Page-context bridge](https://github.com/rodkisten/userscripts-cf/blob/main/src/runtime/gm-bridge.ts): `src/runtime/gm-bridge.ts`
- [Persistent GM storage](https://github.com/rodkisten/userscripts-cf/blob/main/src/runtime/gm-storage.ts): `src/runtime/gm-storage.ts`
- [Shared UI library](https://github.com/rodkisten/userscripts-cf/tree/main/src/runtime/solid-ui): `src/runtime/solid-ui`
- [Form controls](https://github.com/rodkisten/userscripts-cf/tree/main/src/runtime/solid-ui/form-controls): `src/runtime/solid-ui/form-controls`
- [Runtime defaults](https://github.com/rodkisten/userscripts-cf/blob/main/src/config/defaults.js): `src/config/defaults.js`

### RodX Studio

- [RodX Studio](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/index.js): `src/userscripts/rodx-studio/index.js`
- [Search configuration](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/config/search.js): `src/userscripts/rodx-studio/config/search.js`
- [Search parser](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/query-parser.js): `src/userscripts/rodx-studio/search/query-parser.js`
- [Search compiler](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/query-compiler.js): `src/userscripts/rodx-studio/search/query-compiler.js`
- [Search blocks](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/search/blocks.js): `src/userscripts/rodx-studio/search/blocks.js`
- [Local feed rules](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/rodx-studio/feeds/local-rules.js): `src/userscripts/rodx-studio/feeds/local-rules.js`
- [Lists and collections](https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/lists): `src/userscripts/rodx-studio/lists`
- [Media enhancements](https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/media): `src/userscripts/rodx-studio/media`
- [Network inspection](https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/network): `src/userscripts/rodx-studio/network`
- [RodX interface](https://github.com/rodkisten/userscripts-cf/tree/main/src/userscripts/rodx-studio/ui): `src/userscripts/rodx-studio/ui`

### Site Integrations

- [Instagram saved](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/instagram-saved/index.tsx): `src/userscripts/instagram-saved/index.tsx`
- [GitHub tools](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/github-tools/index.tsx): `src/userscripts/github-tools/index.tsx`
- [Reddit and Soundgasm](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/gonewild/index.tsx): `src/userscripts/gonewild/index.tsx`

### Developer Tools

- [Page REPL](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/page-repl/index.js): `src/userscripts/page-repl/index.js`
- [DOM inspector](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/dom-inspector/index.tsx): `src/userscripts/dom-inspector/index.tsx`
- [Mobile editor FAB](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/mobile-editor-fab/index.tsx): `src/userscripts/mobile-editor-fab/index.tsx`
- [Example-site script](https://github.com/rodkisten/userscripts-cf/blob/main/src/userscripts/example-site/index.js): `src/userscripts/example-site/index.js`

### Other components

- **Userscript user**
- **Tampermonkey**

## Connections

- Userscript user → Tampermonkey: installs
- Tampermonkey → URL router: runs script
- Module rules → URL router: configures modules
- URL router → Rule matching: checks rules (evidence: `src/core/script-manager.js`)
- URL router → Page-context bridge: injects page modules
- URL router → Persistent GM storage: provides module storage
- URL router → RodX Studio: activates on URL match
- URL router → Instagram saved: activates on URL match
- URL router → GitHub tools: activates on URL match
- URL router → Reddit and Soundgasm: activates on URL match
- URL router → Page REPL: activates on URL match
- URL router → DOM inspector: activates on URL match
- URL router → Mobile editor FAB: activates on URL match
- URL router → Example-site script: activates on URL match
- RodX Studio → Search configuration: uses configuration
- Search compiler → Search parser: parses queries (evidence: `src/userscripts/rodx-studio/search/query-compiler.js`)
- Search compiler → Local feed rules: parses directives (evidence: `src/userscripts/rodx-studio/search/query-compiler.js`)
- Search compiler → Search blocks: compiles blocks (evidence: `src/userscripts/rodx-studio/search/query-compiler.js`)
- Search parser → Search configuration: uses limits (evidence: `src/userscripts/rodx-studio/search/query-parser.js`)
- Search parser → Search blocks: builds and validates (evidence: `src/userscripts/rodx-studio/search/query-parser.js`)
- Form controls → Shared UI library: renders with (evidence: `src/runtime/solid-ui/form-controls/Combobox.tsx`)
- Lists and collections → RodX Studio: supports collections
- Media enhancements → RodX Studio: enhances media
- Network inspection → RodX Studio: inspects traffic
- RodX interface → RodX Studio: provides interface
- Instagram saved → Userscript user: syncs collections
