# xdevplatform/xurl architecture

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

- Interactive diagram: https://gitdiagram.com/xdevplatform/xurl
- Repository: https://github.com/xdevplatform/xurl

## Overview

xurl is a curl-like CLI for X API operations, multi-app authentication, media uploads, webhooks, shortcuts, and encrypted XChat. The main workflow starts in the CLI, selects credentials and request options, then sends requests to X; authentication commands acquire and persist tokens for later requests. Chat has a separate encrypted messaging workflow with locally stored keys. Several CLI capabilities are represented from the README and SOURCE INDEX, since their implementation was not excerpted; those links are documented or left unverified accordingly.

Main entry points: [`cli/root.go`](https://github.com/xdevplatform/xurl/blob/main/cli/root.go) (Command router), [`api/client.go`](https://github.com/xdevplatform/xurl/blob/main/api/client.go) (HTTP API client), [`main.go`](https://github.com/xdevplatform/xurl/blob/main/main.go) (Application startup), [`cli/chat.go`](https://github.com/xdevplatform/xurl/blob/main/cli/chat.go) (XChat commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI workflows"]
  node_main["Application startup<br/>[main.go]"]
  node_commands["Command router<br/>[root.go]"]
  node_authcmd["Auth commands<br/>[auth.go]"]
end

subgraph group_identity["Identity and configuration"]
  node_auth["Auth protocols<br/>[auth.go]"]
  node_config["Runtime config<br/>[config.go]"]
  node_tokens[("App token store<br/>[tokens.go]")]
end

subgraph group_operations["X API operations"]
  node_media["Media upload<br/>[media.go]"]
  node_shortcuts["API shortcuts<br/>[shortcuts.go]"]
  node_webhook["Webhook server<br/>[webhook.go]"]
  node_mcp["MCP interface<br/>[mcp.go]"]
  node_api["HTTP API client<br/>[client.go]"]
end

subgraph group_chat["Encrypted chat"]
  node_chatcmd["XChat commands<br/>[chat.go]"]
  node_chatkeys[("Chat key store<br/>[chatkeys.go]")]
  node_chatxdk["Chat crypto SDK"]
end

node_user(("CLI user"))
node_xapi(("X API"))

node_user -->|"runs"| node_main
node_main -->|"creates"| node_config
node_main -->|"creates"| node_auth
node_main -->|"executes"| node_commands
node_commands -.->|"routes auth"| node_authcmd
node_authcmd -->|"starts login"| node_auth
node_authcmd -->|"saves credentials"| node_tokens
node_auth -->|"loads tokens"| node_tokens
node_config -->|"resolves app"| node_tokens
node_api -->|"gets auth header"| node_auth
node_api -->|"uses endpoints"| node_config
node_api -->|"sends requests"| node_xapi
node_commands -.->|"issues requests"| node_api
node_media -->|"uploads chunks"| node_api
node_commands -.->|"offers uploads"| node_media
node_commands -.->|"offers shortcuts"| node_shortcuts
node_commands -.->|"offers webhooks"| node_webhook
node_commands -.->|"offers MCP"| node_mcp
node_user -->|"invokes chat"| node_chatcmd
node_chatcmd -->|"loads keys"| node_chatkeys
node_chatcmd -->|"calls chat API"| node_api
node_chatcmd -.->|"uses crypto"| node_chatxdk

click node_main "https://github.com/xdevplatform/xurl/blob/main/main.go"
click node_commands "https://github.com/xdevplatform/xurl/blob/main/cli/root.go"
click node_authcmd "https://github.com/xdevplatform/xurl/blob/main/cli/auth.go"
click node_media "https://github.com/xdevplatform/xurl/blob/main/api/media.go"
click node_shortcuts "https://github.com/xdevplatform/xurl/blob/main/cli/shortcuts.go"
click node_webhook "https://github.com/xdevplatform/xurl/blob/main/cli/webhook.go"
click node_mcp "https://github.com/xdevplatform/xurl/blob/main/cli/mcp.go"
click node_auth "https://github.com/xdevplatform/xurl/blob/main/auth/auth.go"
click node_config "https://github.com/xdevplatform/xurl/blob/main/config/config.go"
click node_tokens "https://github.com/xdevplatform/xurl/blob/main/store/tokens.go"
click node_api "https://github.com/xdevplatform/xurl/blob/main/api/client.go"
click node_chatcmd "https://github.com/xdevplatform/xurl/blob/main/cli/chat.go"
click node_chatkeys "https://github.com/xdevplatform/xurl/blob/main/store/chatkeys.go"

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_main,node_commands,node_authcmd,node_user toneBlue
class node_auth,node_config,node_tokens toneAmber
class node_media,node_shortcuts,node_webhook,node_mcp,node_api,node_xapi toneMint
class node_chatcmd,node_chatkeys,node_chatxdk toneRose
```

## Components

### CLI workflows

- [Application startup](https://github.com/xdevplatform/xurl/blob/main/main.go): `main.go`
- [Command router](https://github.com/xdevplatform/xurl/blob/main/cli/root.go): `cli/root.go`
- [Auth commands](https://github.com/xdevplatform/xurl/blob/main/cli/auth.go): `cli/auth.go`

### Identity and configuration

- [Auth protocols](https://github.com/xdevplatform/xurl/blob/main/auth/auth.go): `auth/auth.go`
- [Runtime config](https://github.com/xdevplatform/xurl/blob/main/config/config.go): `config/config.go`
- [App token store](https://github.com/xdevplatform/xurl/blob/main/store/tokens.go): `store/tokens.go`

### X API operations

- [Media upload](https://github.com/xdevplatform/xurl/blob/main/api/media.go): `api/media.go`
- [API shortcuts](https://github.com/xdevplatform/xurl/blob/main/cli/shortcuts.go): `cli/shortcuts.go`
- [Webhook server](https://github.com/xdevplatform/xurl/blob/main/cli/webhook.go): `cli/webhook.go`
- [MCP interface](https://github.com/xdevplatform/xurl/blob/main/cli/mcp.go): `cli/mcp.go`
- [HTTP API client](https://github.com/xdevplatform/xurl/blob/main/api/client.go): `api/client.go`

### Encrypted chat

- [XChat commands](https://github.com/xdevplatform/xurl/blob/main/cli/chat.go): `cli/chat.go`
- [Chat key store](https://github.com/xdevplatform/xurl/blob/main/store/chatkeys.go): `store/chatkeys.go`
- **Chat crypto SDK**

### Other components

- **CLI user**
- **X API**

## Connections

- CLI user → Application startup: runs (evidence: `main.go`)
- Application startup → Runtime config: creates (evidence: `main.go`)
- Application startup → Auth protocols: creates (evidence: `main.go`)
- Application startup → Command router: executes (evidence: `main.go`)
- Command router → Auth commands: routes auth
- Auth commands → Auth protocols: starts login (evidence: `cli/auth.go`)
- Auth commands → App token store: saves credentials (evidence: `cli/auth.go`)
- Auth protocols → App token store: loads tokens (evidence: `auth/auth.go`)
- Runtime config → App token store: resolves app (evidence: `config/config.go`)
- HTTP API client → Auth protocols: gets auth header (evidence: `api/client.go`)
- HTTP API client → Runtime config: uses endpoints (evidence: `api/client.go`)
- HTTP API client → X API: sends requests (evidence: `README.md`)
- Command router → HTTP API client: issues requests
- Media upload → HTTP API client: uploads chunks (evidence: `api/media.go`)
- Command router → Media upload: offers uploads
- Command router → API shortcuts: offers shortcuts
- Command router → Webhook server: offers webhooks
- Command router → MCP interface: offers MCP
- CLI user → XChat commands: invokes chat (evidence: `README.md`)
- XChat commands → Chat key store: loads keys (evidence: `cli/chat.go`)
- XChat commands → HTTP API client: calls chat API (evidence: `cli/chat.go`)
- XChat commands → Chat crypto SDK: uses crypto
