# alexadark/ghl-cli architecture

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

- Interactive diagram: https://gitdiagram.com/alexadark/ghl-cli
- Repository: https://github.com/alexadark/ghl-cli

## Overview

GHL CLI exposes GoHighLevel CRM operations through domain-specific commands, authenticates with a token and location configuration, sends API requests, and formats results for terminal or JSON use. The README documents 17 command domains; all are represented below, including domains whose implementation was not excerpted. The command registration and representative command-to-client/output/config relationships are supported by the entry-point excerpt and SOURCE INDEX references; unsampled command internals were not inspected.

Main entry points: [`src/index.ts`](https://github.com/alexadark/ghl-cli/blob/main/src/index.ts) (GHL CLI), [`src/client.ts`](https://github.com/alexadark/ghl-cli/blob/main/src/client.ts) (API client), [`src/config.ts`](https://github.com/alexadark/ghl-cli/blob/main/src/config.ts) (Credential config), [`src/commands/contacts.ts`](https://github.com/alexadark/ghl-cli/blob/main/src/commands/contacts.ts) (Contacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["GHL CLI<br/>[index.ts]"]
  node_configcmd["Config commands<br/>[config-cmd.ts]"]
end

subgraph group_crm["CRM operations"]
  node_contacts["Contacts<br/>[contacts.ts]"]
  node_opportunities["Opportunities<br/>[opportunities.ts]"]
  node_conversations["Conversations<br/>[conversations.ts]"]
  node_calendar["Calendar<br/>[calendar.ts]"]
  node_locations["Locations<br/>[locations.ts]"]
end

subgraph group_business["Business operations"]
  node_invoices["Invoices<br/>[invoices.ts]"]
  node_estimates["Estimates<br/>[estimates.ts]"]
  node_payments["Payments<br/>[payments.ts]"]
  node_products["Products<br/>[products.ts]"]
  node_emails["Emails<br/>[emails.ts]"]
end

subgraph group_content["Content operations"]
  node_blog["Blog<br/>[blog.ts]"]
  node_social["Social<br/>[social.ts]"]
  node_media["Media<br/>[media.ts]"]
  node_objects["Objects<br/>[objects.ts]"]
  node_surveys["Surveys<br/>[surveys.ts]"]
  node_workflows["Workflows<br/>[workflows.ts]"]
end

subgraph group_shared["Shared services"]
  node_config["Credential config<br/>[config.ts]"]
  node_client["API client<br/>[client.ts]"]
  node_output["Output formatter<br/>[output.ts]"]
end

node_user(("Terminal user"))
node_ghl{{"GoHighLevel API"}}

node_user -->|"runs commands"| node_cli
node_cli -->|"registers"| node_contacts
node_cli -->|"registers"| node_opportunities
node_cli -->|"registers"| node_conversations
node_cli -->|"registers"| node_calendar
node_cli -->|"registers"| node_locations
node_cli -->|"registers"| node_invoices
node_cli -->|"registers"| node_estimates
node_cli -->|"registers"| node_payments
node_cli -->|"registers"| node_products
node_cli -->|"registers"| node_emails
node_cli -->|"registers"| node_blog
node_cli -->|"registers"| node_social
node_cli -->|"registers"| node_media
node_cli -->|"registers"| node_objects
node_cli -->|"registers"| node_surveys
node_cli -->|"registers"| node_workflows
node_cli -->|"registers"| node_configcmd
node_contacts -->|"calls API methods"| node_client
node_opportunities -->|"calls API methods"| node_client
node_conversations -->|"calls API methods"| node_client
node_calendar -->|"calls API methods"| node_client
node_locations -->|"calls API methods"| node_client
node_invoices -->|"calls API methods"| node_client
node_estimates -->|"calls API methods"| node_client
node_payments -->|"calls API methods"| node_client
node_products -->|"calls API methods"| node_client
node_emails -->|"calls API methods"| node_client
node_blog -->|"calls API methods"| node_client
node_social -->|"calls API methods"| node_client
node_media -->|"calls API methods"| node_client
node_objects -->|"calls API methods"| node_client
node_surveys -->|"calls API methods"| node_client
node_workflows -->|"calls API methods"| node_client
node_contacts -->|"reads credentials"| node_config
node_opportunities -->|"reads credentials"| node_config
node_conversations -->|"reads credentials"| node_config
node_calendar -->|"reads credentials"| node_config
node_locations -->|"reads credentials"| node_config
node_invoices -->|"reads credentials"| node_config
node_estimates -->|"reads credentials"| node_config
node_payments -->|"reads credentials"| node_config
node_products -->|"reads credentials"| node_config
node_emails -->|"reads credentials"| node_config
node_blog -->|"reads credentials"| node_config
node_social -->|"reads credentials"| node_config
node_media -->|"reads credentials"| node_config
node_objects -->|"reads credentials"| node_config

click node_cli "https://github.com/alexadark/ghl-cli/blob/main/src/index.ts"
click node_contacts "https://github.com/alexadark/ghl-cli/blob/main/src/commands/contacts.ts"
click node_opportunities "https://github.com/alexadark/ghl-cli/blob/main/src/commands/opportunities.ts"
click node_conversations "https://github.com/alexadark/ghl-cli/blob/main/src/commands/conversations.ts"
click node_calendar "https://github.com/alexadark/ghl-cli/blob/main/src/commands/calendar.ts"
click node_locations "https://github.com/alexadark/ghl-cli/blob/main/src/commands/locations.ts"
click node_invoices "https://github.com/alexadark/ghl-cli/blob/main/src/commands/invoices.ts"
click node_estimates "https://github.com/alexadark/ghl-cli/blob/main/src/commands/estimates.ts"
click node_payments "https://github.com/alexadark/ghl-cli/blob/main/src/commands/payments.ts"
click node_products "https://github.com/alexadark/ghl-cli/blob/main/src/commands/products.ts"
click node_emails "https://github.com/alexadark/ghl-cli/blob/main/src/commands/emails.ts"
click node_blog "https://github.com/alexadark/ghl-cli/blob/main/src/commands/blog.ts"
click node_social "https://github.com/alexadark/ghl-cli/blob/main/src/commands/social.ts"
click node_media "https://github.com/alexadark/ghl-cli/blob/main/src/commands/media.ts"
click node_objects "https://github.com/alexadark/ghl-cli/blob/main/src/commands/objects.ts"
click node_surveys "https://github.com/alexadark/ghl-cli/blob/main/src/commands/surveys.ts"
click node_workflows "https://github.com/alexadark/ghl-cli/blob/main/src/commands/workflows.ts"
click node_configcmd "https://github.com/alexadark/ghl-cli/blob/main/src/commands/config-cmd.ts"
click node_config "https://github.com/alexadark/ghl-cli/blob/main/src/config.ts"
click node_client "https://github.com/alexadark/ghl-cli/blob/main/src/client.ts"
click node_output "https://github.com/alexadark/ghl-cli/blob/main/src/output.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_cli,node_configcmd,node_user toneBlue
class node_contacts,node_opportunities,node_conversations,node_calendar,node_locations toneAmber
class node_invoices,node_estimates,node_payments,node_products,node_emails,node_ghl toneMint
class node_blog,node_social,node_media,node_objects,node_surveys,node_workflows toneRose
class node_config,node_client,node_output toneIndigo
```

## Components

### CLI entry

- [GHL CLI](https://github.com/alexadark/ghl-cli/blob/main/src/index.ts): `src/index.ts`
- [Config commands](https://github.com/alexadark/ghl-cli/blob/main/src/commands/config-cmd.ts): `src/commands/config-cmd.ts`

### CRM operations

- [Contacts](https://github.com/alexadark/ghl-cli/blob/main/src/commands/contacts.ts): `src/commands/contacts.ts`
- [Opportunities](https://github.com/alexadark/ghl-cli/blob/main/src/commands/opportunities.ts): `src/commands/opportunities.ts`
- [Conversations](https://github.com/alexadark/ghl-cli/blob/main/src/commands/conversations.ts): `src/commands/conversations.ts`
- [Calendar](https://github.com/alexadark/ghl-cli/blob/main/src/commands/calendar.ts): `src/commands/calendar.ts`
- [Locations](https://github.com/alexadark/ghl-cli/blob/main/src/commands/locations.ts): `src/commands/locations.ts`

### Business operations

- [Invoices](https://github.com/alexadark/ghl-cli/blob/main/src/commands/invoices.ts): `src/commands/invoices.ts`
- [Estimates](https://github.com/alexadark/ghl-cli/blob/main/src/commands/estimates.ts): `src/commands/estimates.ts`
- [Payments](https://github.com/alexadark/ghl-cli/blob/main/src/commands/payments.ts): `src/commands/payments.ts`
- [Products](https://github.com/alexadark/ghl-cli/blob/main/src/commands/products.ts): `src/commands/products.ts`
- [Emails](https://github.com/alexadark/ghl-cli/blob/main/src/commands/emails.ts): `src/commands/emails.ts`

### Content operations

- [Blog](https://github.com/alexadark/ghl-cli/blob/main/src/commands/blog.ts): `src/commands/blog.ts`
- [Social](https://github.com/alexadark/ghl-cli/blob/main/src/commands/social.ts): `src/commands/social.ts`
- [Media](https://github.com/alexadark/ghl-cli/blob/main/src/commands/media.ts): `src/commands/media.ts`
- [Objects](https://github.com/alexadark/ghl-cli/blob/main/src/commands/objects.ts): `src/commands/objects.ts`
- [Surveys](https://github.com/alexadark/ghl-cli/blob/main/src/commands/surveys.ts): `src/commands/surveys.ts`
- [Workflows](https://github.com/alexadark/ghl-cli/blob/main/src/commands/workflows.ts): `src/commands/workflows.ts`

### Shared services

- [Credential config](https://github.com/alexadark/ghl-cli/blob/main/src/config.ts): `src/config.ts`
- [API client](https://github.com/alexadark/ghl-cli/blob/main/src/client.ts): `src/client.ts`
- [Output formatter](https://github.com/alexadark/ghl-cli/blob/main/src/output.ts): `src/output.ts`

### Other components

- **Terminal user**
- **GoHighLevel API**

## Connections

- Terminal user → GHL CLI: runs commands (evidence: `README.md`)
- GHL CLI → Contacts: registers (evidence: `src/index.ts`)
- GHL CLI → Opportunities: registers (evidence: `src/index.ts`)
- GHL CLI → Conversations: registers (evidence: `src/index.ts`)
- GHL CLI → Calendar: registers (evidence: `src/index.ts`)
- GHL CLI → Locations: registers (evidence: `src/index.ts`)
- GHL CLI → Invoices: registers (evidence: `src/index.ts`)
- GHL CLI → Estimates: registers (evidence: `src/index.ts`)
- GHL CLI → Payments: registers (evidence: `src/index.ts`)
- GHL CLI → Products: registers (evidence: `src/index.ts`)
- GHL CLI → Emails: registers (evidence: `src/index.ts`)
- GHL CLI → Blog: registers (evidence: `src/index.ts`)
- GHL CLI → Social: registers (evidence: `src/index.ts`)
- GHL CLI → Media: registers (evidence: `src/index.ts`)
- GHL CLI → Objects: registers (evidence: `src/index.ts`)
- GHL CLI → Surveys: registers (evidence: `src/index.ts`)
- GHL CLI → Workflows: registers (evidence: `src/index.ts`)
- GHL CLI → Config commands: registers (evidence: `src/index.ts`)
- Contacts → API client: calls API methods (evidence: `src/commands/contacts.ts`)
- Opportunities → API client: calls API methods (evidence: `src/commands/opportunities.ts`)
- Conversations → API client: calls API methods (evidence: `src/commands/conversations.ts`)
- Calendar → API client: calls API methods (evidence: `src/commands/calendar.ts`)
- Locations → API client: calls API methods (evidence: `src/commands/locations.ts`)
- Invoices → API client: calls API methods (evidence: `src/commands/invoices.ts`)
- Estimates → API client: calls API methods (evidence: `src/commands/estimates.ts`)
- Payments → API client: calls API methods (evidence: `src/commands/payments.ts`)
- Products → API client: calls API methods (evidence: `src/commands/products.ts`)
- Emails → API client: calls API methods (evidence: `src/commands/emails.ts`)
- Blog → API client: calls API methods (evidence: `src/commands/blog.ts`)
- Social → API client: calls API methods (evidence: `src/commands/social.ts`)
- Media → API client: calls API methods (evidence: `src/commands/media.ts`)
- Objects → API client: calls API methods (evidence: `src/commands/objects.ts`)
- Surveys → API client: calls API methods (evidence: `src/commands/surveys.ts`)
- Workflows → API client: calls API methods (evidence: `src/commands/workflows.ts`)
- Contacts → Credential config: reads credentials (evidence: `src/commands/contacts.ts`)
- Opportunities → Credential config: reads credentials (evidence: `src/commands/opportunities.ts`)
- Conversations → Credential config: reads credentials (evidence: `src/commands/conversations.ts`)
- Calendar → Credential config: reads credentials (evidence: `src/commands/calendar.ts`)
- Locations → Credential config: reads credentials (evidence: `src/commands/locations.ts`)
- Invoices → Credential config: reads credentials (evidence: `src/commands/invoices.ts`)
- Estimates → Credential config: reads credentials (evidence: `src/commands/estimates.ts`)
- Payments → Credential config: reads credentials (evidence: `src/commands/payments.ts`)
- Products → Credential config: reads credentials (evidence: `src/commands/products.ts`)
- Emails → Credential config: reads credentials (evidence: `src/commands/emails.ts`)
- Blog → Credential config: reads credentials (evidence: `src/commands/blog.ts`)
- Social → Credential config: reads credentials (evidence: `src/commands/social.ts`)
- Media → Credential config: reads credentials (evidence: `src/commands/media.ts`)
- Objects → Credential config: reads credentials (evidence: `src/commands/objects.ts`)
