# adnanpal/remote-git architecture

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

- Interactive diagram: https://gitdiagram.com/adnanpal/remote-git
- Repository: https://github.com/adnanpal/remote-git

## Overview

Remote-Git lets a user pair a phone/web UI with a laptop agent, choose configured workspace repositories, inspect Git status, history and diffs, then commit selected files and push using the laptop’s Git credentials. The UI coordinates relay connections; the relay routes messages, while Git execution and workspace discovery remain local. The map preserves authentication and device/workspace selection as supporting capabilities. Source excerpts establish the main agent dispatch and UI orchestration; relay internals are only partly sampled, so its routing link is documented by the README.

Main entry points: [`apps/agent/src/index.ts`](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/index.ts) (Agent Runtime), [`apps/mobile/src/App.tsx`](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/App.tsx) (App Workflow), [`apps/relay/src/index.ts`](https://github.com/adnanpal/remote-git/blob/main/apps/relay/src/index.ts) (WebSocket Relay), [`apps/mobile/src/services/relay.ts`](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/services/relay.ts) (Relay Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Phone and Web UI"]
  node_app["App Workflow<br/>[App.tsx]"]
  node_auth["Account Auth<br/>[Login.tsx]"]
  node_pairscan["QR Pairing Scan<br/>[QRScanner.tsx]"]
  node_workspaceview["Workspace List<br/>[Workspacelist.tsx]"]
  node_repoview["Repository List<br/>[Repositorylist.tsx]"]
  node_repodash["Repository Dashboard"]
  node_gitstatusui["Status View<br/>[GitStatus.tsx]"]
  node_mobiletransport["Relay Client<br/>[relay.ts]"]
end

subgraph group_relay["Relay Transport"]
  node_relayserver["WebSocket Relay<br/>[index.ts]"]
  node_connections["Connection Registry<br/>[connections.ts]"]
end

subgraph group_agent["Local Agent"]
  node_agententry["Agent Runtime<br/>[index.ts]"]
  node_pairing["Pairing Credentials<br/>[token.ts]"]
  node_machine["Machine Metadata<br/>[machine-info.ts]"]
  node_workspaces[("Workspace Config<br/>[config.ts]")]
end

subgraph group_git["Local Git Operations"]
  node_repo_discovery["Repository Discovery<br/>[repositories.ts]"]
  node_status["Git Status<br/>[status.ts]"]
  node_diff["Git Diff<br/>[diff.ts]"]
  node_history["Commit History<br/>[log.ts]"]
  node_commit["Commit Changes<br/>[commit.ts]"]
  node_push["Push Changes<br/>[push.ts]"]
end

node_user(("Phone User"))
node_supabase["Supabase Auth"]
node_protocol["Message Protocol<br/>[messages.ts]"]
node_localrepo[("Local Git Repositories")]
node_github["GitHub Remote"]

node_user -->|"uses"| node_app
node_app -->|"shows"| node_auth
node_auth -->|"authenticates"| node_supabase
node_app -->|"starts scanning"| node_pairscan
node_app -->|"connects through"| node_mobiletransport
node_app -->|"renders"| node_workspaceview
node_app -->|"renders"| node_repoview
node_app -->|"renders"| node_repodash
node_repodash -->|"renders"| node_gitstatusui
node_mobiletransport -->|"encodes messages"| node_protocol
node_mobiletransport -.->|"sends WebSocket messages"| node_relayserver
node_relayserver -->|"tracks peers"| node_connections
node_relayserver -.->|"routes messages"| node_agententry
node_agententry -->|"loads token"| node_pairing
node_agententry -->|"reads metadata"| node_machine
node_agententry -->|"loads workspaces"| node_workspaces
node_agententry -.->|"provides pairing QR"| node_pairscan
node_agententry -->|"uses messages"| node_protocol
node_agententry -->|"connects to"| node_relayserver
node_relayserver -.->|"forwards messages"| node_mobiletransport
node_agententry -->|"dispatches discovery"| node_repo_discovery
node_agententry -->|"dispatches workspace list"| node_workspaces
node_agententry -->|"dispatches status"| node_status
node_agententry -->|"dispatches history"| node_history
node_agententry -->|"dispatches diff"| node_diff
node_agententry -->|"dispatches commit"| node_commit
node_agententry -->|"dispatches push"| node_push
node_repo_discovery -->|"reads configured roots"| node_workspaces
node_status -.->|"reads status"| node_localrepo
node_history -.->|"reads commits"| node_localrepo
node_diff -.->|"reads changes"| node_localrepo
node_commit -.->|"stages and commits"| node_localrepo
node_push -.->|"pushes repository"| node_localrepo
node_push -.->|"pushes via Git"| node_github
node_repodash -.->|"requests Git actions"| node_mobiletransport

click node_app "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/App.tsx"
click node_auth "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/auth/Login.tsx"
click node_pairscan "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/QRScanner.tsx"
click node_workspaceview "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/Workspacelist.tsx"
click node_repoview "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/Repositorylist.tsx"
click node_repodash "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/Repositorydashboard.tsx"
click node_gitstatusui "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/GitStatus.tsx"
click node_mobiletransport "https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/services/relay.ts"
click node_protocol "https://github.com/adnanpal/remote-git/blob/main/packages/protocol/src/messages.ts"
click node_relayserver "https://github.com/adnanpal/remote-git/blob/main/apps/relay/src/index.ts"
click node_connections "https://github.com/adnanpal/remote-git/blob/main/apps/relay/src/connections.ts"
click node_agententry "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/index.ts"
click node_pairing "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/pairing/token.ts"
click node_machine "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/machine/machine-info.ts"
click node_workspaces "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/workspace/config.ts"
click node_repo_discovery "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/repositories.ts"
click node_status "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/status.ts"
click node_diff "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/diff.ts"
click node_history "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/log.ts"
click node_commit "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/commit.ts"
click node_push "https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/push.ts"

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_app,node_auth,node_pairscan,node_workspaceview,node_repoview,node_repodash,node_gitstatusui,node_mobiletransport,node_user toneBlue
class node_relayserver,node_connections,node_localrepo toneAmber
class node_agententry,node_pairing,node_machine,node_workspaces toneMint
class node_repo_discovery,node_status,node_diff,node_history,node_commit,node_push toneRose
class node_supabase,node_github toneIndigo
class node_protocol toneTeal
```

## Components

### Phone and Web UI

- [App Workflow](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/App.tsx): `apps/mobile/src/App.tsx`
- [Account Auth](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/auth/Login.tsx): `apps/mobile/src/components/auth/Login.tsx`
- [QR Pairing Scan](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/QRScanner.tsx): `apps/mobile/src/components/QRScanner.tsx`
- [Workspace List](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/Workspacelist.tsx): `apps/mobile/src/components/Workspacelist.tsx`
- [Repository List](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/Repositorylist.tsx): `apps/mobile/src/components/Repositorylist.tsx`
- [Repository Dashboard](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/Repositorydashboard.tsx): `apps/mobile/src/components/Repositorydashboard.tsx`
- [Status View](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/components/GitStatus.tsx): `apps/mobile/src/components/GitStatus.tsx`
- [Relay Client](https://github.com/adnanpal/remote-git/blob/main/apps/mobile/src/services/relay.ts): `apps/mobile/src/services/relay.ts`

### Relay Transport

- [WebSocket Relay](https://github.com/adnanpal/remote-git/blob/main/apps/relay/src/index.ts): `apps/relay/src/index.ts`
- [Connection Registry](https://github.com/adnanpal/remote-git/blob/main/apps/relay/src/connections.ts): `apps/relay/src/connections.ts`

### Local Agent

- [Agent Runtime](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/index.ts): `apps/agent/src/index.ts`
- [Pairing Credentials](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/pairing/token.ts): `apps/agent/src/pairing/token.ts`
- [Machine Metadata](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/machine/machine-info.ts): `apps/agent/src/machine/machine-info.ts`
- [Workspace Config](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/workspace/config.ts): `apps/agent/src/workspace/config.ts`

### Local Git Operations

- [Repository Discovery](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/repositories.ts): `apps/agent/src/git/repositories.ts`
- [Git Status](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/status.ts): `apps/agent/src/git/status.ts`
- [Git Diff](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/diff.ts): `apps/agent/src/git/diff.ts`
- [Commit History](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/log.ts): `apps/agent/src/git/log.ts`
- [Commit Changes](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/commit.ts): `apps/agent/src/git/commit.ts`
- [Push Changes](https://github.com/adnanpal/remote-git/blob/main/apps/agent/src/git/push.ts): `apps/agent/src/git/push.ts`

### Other components

- **Phone User**
- **Supabase Auth**
- [Message Protocol](https://github.com/adnanpal/remote-git/blob/main/packages/protocol/src/messages.ts): `packages/protocol/src/messages.ts`
- **Local Git Repositories**
- **GitHub Remote**

## Connections

- Phone User → App Workflow: uses (evidence: `apps/mobile/src/App.tsx`)
- App Workflow → Account Auth: shows (evidence: `apps/mobile/src/App.tsx`)
- Account Auth → Supabase Auth: authenticates (evidence: `apps/mobile/src/components/auth/Login.tsx`)
- App Workflow → QR Pairing Scan: starts scanning (evidence: `apps/mobile/src/App.tsx`)
- App Workflow → Relay Client: connects through (evidence: `apps/mobile/src/App.tsx`)
- App Workflow → Workspace List: renders (evidence: `apps/mobile/src/App.tsx`)
- App Workflow → Repository List: renders (evidence: `apps/mobile/src/App.tsx`)
- App Workflow → Repository Dashboard: renders (evidence: `apps/mobile/src/App.tsx`)
- Repository Dashboard → Status View: renders (evidence: `apps/mobile/src/components/Repositorydashboard.tsx`)
- Relay Client → Message Protocol: encodes messages (evidence: `apps/mobile/src/services/relay.ts`)
- Relay Client → WebSocket Relay: sends WebSocket messages (evidence: `README.md`)
- WebSocket Relay → Connection Registry: tracks peers (evidence: `apps/relay/src/index.ts`)
- WebSocket Relay → Agent Runtime: routes messages (evidence: `README.md`)
- Agent Runtime → Pairing Credentials: loads token (evidence: `apps/agent/src/index.ts`)
- Agent Runtime → Machine Metadata: reads metadata (evidence: `apps/agent/src/index.ts`)
- Agent Runtime → Workspace Config: loads workspaces (evidence: `apps/agent/src/index.ts`)
- Agent Runtime → QR Pairing Scan: provides pairing QR
- Agent Runtime → Message Protocol: uses messages (evidence: `apps/agent/src/index.ts`)
- Agent Runtime → WebSocket Relay: connects to (evidence: `apps/agent/src/index.ts`)
- WebSocket Relay → Relay Client: forwards messages (evidence: `README.md`)
- Agent Runtime → Repository Discovery: dispatches discovery
- Agent Runtime → Workspace Config: dispatches workspace list (evidence: `apps/agent/src/index.ts`)
- Agent Runtime → Git Status: dispatches status
- Agent Runtime → Commit History: dispatches history
- Agent Runtime → Git Diff: dispatches diff
- Agent Runtime → Commit Changes: dispatches commit
- Agent Runtime → Push Changes: dispatches push
- Repository Discovery → Workspace Config: reads configured roots (evidence: `apps/agent/src/git/repositories.ts`)
- Git Status → Local Git Repositories: reads status
- Commit History → Local Git Repositories: reads commits
- Git Diff → Local Git Repositories: reads changes
- Commit Changes → Local Git Repositories: stages and commits
- Push Changes → Local Git Repositories: pushes repository
- Push Changes → GitHub Remote: pushes via Git (evidence: `README.md`)
- Repository Dashboard → Relay Client: requests Git actions
