# conwnet/github1s architecture

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

- Interactive diagram: https://gitdiagram.com/conwnet/github1s
- Repository: https://github.com/conwnet/github1s

## Overview

#### Purpose and Runtime
GitHub1s is a browser-hosted, read-oriented VS Code experience for repositories addressed through `github1s.com`, with parallel GitLab and npm URL modes. The primary runtime is TypeScript/JavaScript in the browser, bundling a customized VS Code web workbench plus the GitHub1s extension. Static hosting starts from `public/index.html`; application bootstrap is `src/index.ts`.

#### Browser Bootstrap and Product Shell
The root app configures the page, product identity, notifications, and OAuth handoff before loading the VS Code web application.
- `src/index.ts`
- `src/config.ts`
- `src/product.ts`
- `src/github-auth.ts`
- `src/gitlab-auth.ts`
- `public/index.html`

#### Customized VS Code Web Workbench
`vscode-web` is a maintained subset/patch layer around VS Code’s browser workbench. It provides the editor UI, explorer, service contracts, extension host integration, and browser-oriented file/text services that GitHub1s consumes.
- `vscode-web/src/vs/workbench/browser/web.main.ts`
- `vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts`
- `vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts`

Build scripts clone, patch, package, and watch this runtime; a normal build can use the bundled version, while the full build rebuilds VS Code assets.
- `vscode-web/scripts/clone.js`
- `vscode-web/scripts/patch.js`
- `vscode-web/scripts/build/vscode.js`

#### GitHub1s Extension Entry and Orchestration
The core product behavior is a VS Code web extension. Its activation entry wires adapters, route and VS Code listeners, providers, commands, status bar elements, repository managers, and views. This is the principal control boundary between the workbench APIs and repository-specific behavior.
- `extensions/github1s/src/extension.ts`
- `extensions/github1s/src/listeners/index.ts`
- `extensions/github1s/src/providers/index.ts`
- `extensions/github1s/src/commands/index.ts`

#### URL Routing and Repository Context
Browser location determines host/provider, owner/project/package identity, revision, path, and UI intent. Router listeners react to navigation and synchronize explorer/editor state; repository managers retain branch/tag, commit, and review context.
- `extensions/github1s/src/router/index.ts`
- `extensions/github1s/src/listeners/router/index.ts`
- `extensions/github1s/src/adapters/manager.ts`
- `extensions/github1s/src/repository/index.ts`

#### Provider Adapter and Remote Data Boundary
A provider-adapter layer normalizes routing and data access across GitHub, GitLab, Bitbucket, npm, OSS Insight, and Sourcegraph. GitHub/GitLab adapters own REST/GraphQL fetching, authentication settings, token handling, and repository path parsing. Sourcegraph supplies code-intelligence operations such as definitions, hover, references, blame, and search.
- `extensions/github1s/src/adapters/github1s/index.ts`
- `extensions/github1s/src/adapters/github1s/graphql.ts`
- `extensions/github1s/src/adapters/gitlab1s/data-source.ts`
- `extensions/github1s/src/adapters/sourcegraph/data-source.ts`

OAuth callbacks are serverless API endpoints; browser-held tokens are used for private repository fetches.
- `functions/api/github-auth-callback.ts`
- `functions/api/gitlab-auth-callback.ts`

#### Virtual Repository and Editor Features
Remote adapter data is exposed as VS Code providers: virtual filesystem reads, file/text search, definitions, hovers, and references. Change handling adds quick diffs and source-control decorations. Commands and views surface commits, blame, ref switching, review, and Gitpod handoff.
- `extensions/github1s/src/providers/file-system/index.ts`
- `extensions/github1s/src/providers/text-search.ts`
- `extensions/github1s/src/changes/quick-diff.ts`
- `extensions/github1s/src/commands/code-review.ts`

#### Packaging and Built-in Language Support
Webpack and repository scripts assemble public assets, VS Code web artifacts, and extensions for deployment. The core GitHub1s extension is accompanied by lightweight language/syntax extensions for Elm, Nim, OCaml, and V.
- `webpack.config.js`
- `scripts/build.js`
- `extensions/github1s/webpack.config.js`
- `extensions/ocaml-web/package.json`

Main entry points: [`extensions/github1s/src/extension.ts`](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/extension.ts) (Extension activation), [`vscode-web/src/vs/workbench/browser/web.main.ts`](https://github.com/conwnet/github1s/blob/master/vscode-web/src/vs/workbench/browser/web.main.ts) (Web workbench), [`extensions/github1s/src/adapters/manager.ts`](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/manager.ts) (Provider adapters), [`src/index.ts`](https://github.com/conwnet/github1s/blob/master/src/index.ts) (App bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser App"]
  node_html["Static entry page<br/>HTML entry<br/>[index.html]"]
  node_bootstrap["App bootstrap<br/>TypeScript entry<br/>[index.ts]"]
  node_shell["Product and auth shell<br/>browser configuration<br/>[config.ts]"]
  node_oauth["OAuth browser flows<br/>auth handlers<br/>[github-auth.ts]"]
end

subgraph group_workbench["VS Code Web Runtime"]
  node_webmain["Web workbench<br/>VS Code browser runtime<br/>[web.main.ts]"]
  node_textfiles["Browser text files<br/>workbench service<br/>[textFileService.ts]"]
  node_builtinextensions["Built-in extensions<br/>extension scanner"]
end

subgraph group_extension["GitHub1s Extension"]
  node_extensionentry{{"Extension activation<br/>VS Code extension entry<br/>[extension.ts]"}}
  node_routing["URL routing<br/>repository route parser<br/>[index.ts]"]
  node_routelisteners["Navigation sync<br/>router listener<br/>[index.ts]"]
  node_repository["Repository context<br/>repository manager<br/>[index.ts]"]
  node_providers["Virtual repository providers<br/>VS Code providers<br/>[index.ts]"]
  node_quickdiff["Quick diff<br/>change provider<br/>[quick-diff.ts]"]
  node_commands["Repository commands<br/>commands and views<br/>[index.ts]"]
end

subgraph group_remote["Remote Services"]
  node_adapters{{"Provider adapters<br/>remote data abstraction<br/>[manager.ts]"}}
  node_githubdata["GitHub data access<br/>REST and GraphQL adapter<br/>[graphql.ts]"]
  node_gitlabdata["GitLab data access<br/>remote data adapter<br/>[data-source.ts]"]
  node_sourcegraph["Code intelligence<br/>Sourcegraph adapter<br/>[data-source.ts]"]
  node_callbacks{{"OAuth callbacks<br/>serverless API endpoints"}}
end

subgraph group_build["Build &amp; Packaging"]
  node_build["Deployment build<br/>repository build pipeline<br/>[build.js]"]
  node_vscodebuild["VS Code asset build<br/>patched runtime build<br/>[vscode.js]"]
  node_webpack["Webpack assembly<br/>bundler configuration<br/>[webpack.config.js]"]
end

node_html -->|"loads"| node_bootstrap
node_bootstrap -->|"configures"| node_shell
node_shell -->|"starts auth"| node_oauth
node_bootstrap -->|"loads"| node_webmain
node_webmain -->|"uses"| node_textfiles
node_webmain -->|"discovers"| node_builtinextensions
node_webmain -->|"activates"| node_extensionentry
node_extensionentry -->|"initializes"| node_routing
node_extensionentry -->|"registers"| node_routelisteners
node_extensionentry -->|"registers"| node_providers
node_extensionentry -->|"registers"| node_commands
node_routing -->|"selects context"| node_repository
node_routelisteners -->|"reacts to navigation"| node_routing
node_repository -->|"uses"| node_adapters
node_providers -->|"fetches through"| node_adapters
node_providers -->|"supplies changes"| node_quickdiff
node_adapters -->|"GitHub mode"| node_githubdata
node_adapters -->|"GitLab mode"| node_gitlabdata
node_adapters -->|"intelligence queries"| node_sourcegraph
node_oauth -->|"OAuth callback"| node_callbacks
node_build -->|"runs"| node_webpack
node_build -.->|"optionally rebuilds"| node_vscodebuild
node_vscodebuild -.->|"produces runtime assets"| node_webmain
node_webpack -.->|"emits deployable assets"| node_html

click node_html "https://github.com/conwnet/github1s/blob/master/public/index.html"
click node_bootstrap "https://github.com/conwnet/github1s/blob/master/src/index.ts"
click node_shell "https://github.com/conwnet/github1s/blob/master/src/config.ts"
click node_oauth "https://github.com/conwnet/github1s/blob/master/src/github-auth.ts"
click node_webmain "https://github.com/conwnet/github1s/blob/master/vscode-web/src/vs/workbench/browser/web.main.ts"
click node_textfiles "https://github.com/conwnet/github1s/blob/master/vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts"
click node_builtinextensions "https://github.com/conwnet/github1s/blob/master/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts"
click node_extensionentry "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/extension.ts"
click node_routing "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/router/index.ts"
click node_routelisteners "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/listeners/router/index.ts"
click node_repository "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/repository/index.ts"
click node_providers "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/providers/index.ts"
click node_quickdiff "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/changes/quick-diff.ts"
click node_commands "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/commands/index.ts"
click node_adapters "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/manager.ts"
click node_githubdata "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/github1s/graphql.ts"
click node_gitlabdata "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/gitlab1s/data-source.ts"
click node_sourcegraph "https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/sourcegraph/data-source.ts"
click node_callbacks "https://github.com/conwnet/github1s/blob/master/functions/api/github-auth-callback.ts"
click node_build "https://github.com/conwnet/github1s/blob/master/scripts/build.js"
click node_vscodebuild "https://github.com/conwnet/github1s/blob/master/vscode-web/scripts/build/vscode.js"
click node_webpack "https://github.com/conwnet/github1s/blob/master/webpack.config.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_html,node_bootstrap,node_shell,node_oauth toneBlue
class node_webmain,node_textfiles,node_builtinextensions toneAmber
class node_extensionentry,node_routing,node_routelisteners,node_repository,node_providers,node_quickdiff,node_commands toneMint
class node_adapters,node_githubdata,node_gitlabdata,node_sourcegraph,node_callbacks toneRose
class node_build,node_vscodebuild,node_webpack toneIndigo
```

## Components

### Browser App

- [Static entry page](https://github.com/conwnet/github1s/blob/master/public/index.html): HTML entry · `public/index.html`
- [App bootstrap](https://github.com/conwnet/github1s/blob/master/src/index.ts): TypeScript entry · Configures the shell and loads the web workbench. · `src/index.ts`
- [Product and auth shell](https://github.com/conwnet/github1s/blob/master/src/config.ts): browser configuration · `src/config.ts`
- [OAuth browser flows](https://github.com/conwnet/github1s/blob/master/src/github-auth.ts): auth handlers · `src/github-auth.ts`

### VS Code Web Runtime

- [Web workbench](https://github.com/conwnet/github1s/blob/master/vscode-web/src/vs/workbench/browser/web.main.ts): VS Code browser runtime · Customized editor, explorer, service, and extension-host runtime. · `vscode-web/src/vs/workbench/browser/web.main.ts`
- [Browser text files](https://github.com/conwnet/github1s/blob/master/vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts): workbench service · `vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts`
- [Built-in extensions](https://github.com/conwnet/github1s/blob/master/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts): extension scanner · `vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts`

### GitHub1s Extension

- [Extension activation](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/extension.ts): VS Code extension entry · Principal boundary between workbench APIs and repository behavior. · `extensions/github1s/src/extension.ts`
- [URL routing](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/router/index.ts): repository route parser · Derives provider, repository identity, revision, path, and UI intent. · `extensions/github1s/src/router/index.ts`
- [Navigation sync](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/listeners/router/index.ts): router listener · Synchronizes route changes with explorer and editor state. · `extensions/github1s/src/listeners/router/index.ts`
- [Repository context](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/repository/index.ts): repository manager · Retains branch, tag, commit, and review context. · `extensions/github1s/src/repository/index.ts`
- [Virtual repository providers](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/providers/index.ts): VS Code providers · Exposes remote files, search, and code-intelligence results to VS Code. · `extensions/github1s/src/providers/index.ts`
- [Quick diff](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/changes/quick-diff.ts): change provider · `extensions/github1s/src/changes/quick-diff.ts`
- [Repository commands](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/commands/index.ts): commands and views · Surfaces review, refs, blame, commits, and Gitpod actions. · `extensions/github1s/src/commands/index.ts`

### Remote Services

- [Provider adapters](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/manager.ts): remote data abstraction · Normalizes GitHub, GitLab, Bitbucket, npm, OSS Insight, and Sourcegraph. · `extensions/github1s/src/adapters/manager.ts`
- [GitHub data access](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/github1s/graphql.ts): REST and GraphQL adapter · `extensions/github1s/src/adapters/github1s/graphql.ts`
- [GitLab data access](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/gitlab1s/data-source.ts): remote data adapter · `extensions/github1s/src/adapters/gitlab1s/data-source.ts`
- [Code intelligence](https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/adapters/sourcegraph/data-source.ts): Sourcegraph adapter · Provides definitions, hover, references, blame, and search. · `extensions/github1s/src/adapters/sourcegraph/data-source.ts`
- [OAuth callbacks](https://github.com/conwnet/github1s/blob/master/functions/api/github-auth-callback.ts): serverless API endpoints · Exchanges OAuth callbacks for browser authentication flows. · `functions/api/github-auth-callback.ts`

### Build & Packaging

- [Deployment build](https://github.com/conwnet/github1s/blob/master/scripts/build.js): repository build pipeline · Assembles public assets, VS Code artifacts, and extensions. · `scripts/build.js`
- [VS Code asset build](https://github.com/conwnet/github1s/blob/master/vscode-web/scripts/build/vscode.js): patched runtime build · Clones, patches, packages, and rebuilds VS Code web assets. · `vscode-web/scripts/build/vscode.js`
- [Webpack assembly](https://github.com/conwnet/github1s/blob/master/webpack.config.js): bundler configuration · `webpack.config.js`

## Connections

- Static entry page → App bootstrap: loads
- App bootstrap → Product and auth shell: configures
- Product and auth shell → OAuth browser flows: starts auth
- App bootstrap → Web workbench: loads
- Web workbench → Browser text files: uses
- Web workbench → Built-in extensions: discovers
- Web workbench → Extension activation: activates
- Extension activation → URL routing: initializes
- Extension activation → Navigation sync: registers
- Extension activation → Virtual repository providers: registers
- Extension activation → Repository commands: registers
- URL routing → Repository context: selects context
- Navigation sync → URL routing: reacts to navigation
- Repository context → Provider adapters: uses
- Virtual repository providers → Provider adapters: fetches through
- Virtual repository providers → Quick diff: supplies changes
- Provider adapters → GitHub data access: GitHub mode
- Provider adapters → GitLab data access: GitLab mode
- Provider adapters → Code intelligence: intelligence queries
- OAuth browser flows → OAuth callbacks: OAuth callback
- Deployment build → Webpack assembly: runs
- Deployment build → VS Code asset build: optionally rebuilds
- VS Code asset build → Web workbench: produces runtime assets
- Webpack assembly → Static entry page: emits deployable assets
