# coingecko/coingecko-api-oas architecture

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

- Interactive diagram: https://gitdiagram.com/coingecko/coingecko-api-oas
- Repository: https://github.com/coingecko/coingecko-api-oas

## Overview

##### Project type and purpose
- This is an API‐specification repository, not an application codebase. It holds three OpenAPI 3.0 JSON specs for CoinGecko’s various API tiers:
- coingecko-public-api-v3.json (public/demo endpoints)
- coingecko-pro-api-v3.json (paid/pro endpoints)
- on-chain-dex-api-beta.json (on‐chain DEX endpoints)
- The README confirms it’s purely documentation/specification for downstream code generation, client SDKs, and API docs.

##### File structure
- Top level:
- README.md – high‐level overview and links
- \*.json – three OAS spec files
- readme-assets/ – images used by the README (banners)
- No source code, tests, or deployment scripts are present. The key artifacts are the spec files.

##### README for additional insights
- It points to raw URLs for each spec and to the public documentation portal (docs.coingecko.com).

##### Final advice
- Major flows (e.g., “Spec push”, “Client request/response”).
- Don’t over‐complicate: map each JSON spec to its service tier, then connect the dots through the CI/CD and API gateway layers.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Specification Pipeline
    subgraph "Specification Pipeline"
        GitRepo["Git Repository Root"]:::spec
        README["Project Overview and Links (README)"]:::spec
        PublicSpec["Public API Spec (coingecko-public-api-v3.json)"]:::spec
        ProSpec["Pro API Spec (coingecko-pro-api-v3.json)"]:::spec
        OnChainSpec["On-Chain DEX API Spec (on-chain-dex-api-beta.json)"]:::spec
        Assets["README Image Assets"]:::spec

        GitRepo -->|"includes specs & README"| README
        GitRepo --> PublicSpec
        GitRepo --> ProSpec
        GitRepo --> OnChainSpec
        GitRepo --> Assets

        GitRepo -->|"push changes"| CICD
    end

    %% CI/CD and Tooling
    subgraph "CI/CD & Tooling"
        CICD["CI/CD Pipeline"]:::spec
        Spectral["Spectral Validator"]:::spec
        CodeGen["OpenAPI Code Generator"]:::spec
        DocsRenderer["Docs Renderer (Swagger UI/Redoc)"]:::spec
        SDKs["Generated SDKs & Stubs"]:::spec
        DocsSite["Deployed Docs Site"]:::clients

        CICD --> Spectral
        Spectral -->|“valid specs”| CodeGen
        Spectral -->|“valid specs”| DocsRenderer
        CodeGen --> SDKs
        DocsRenderer --> DocsSite
    end

    %% Runtime API
    subgraph "Runtime/API Layer"
        APIGateway["API Gateway & Load Balancer"]:::runtime
        PublicSvc["Public API Service"]:::runtime
        ProSvc["Pro API Service"]:::runtime
        OnChainSvc["On-Chain DEX API Service"]:::runtime

        Clients --> APIGateway
        APIGateway -->|“route to public”| PublicSvc
        APIGateway -->|“route to pro w/auth”| ProSvc
        APIGateway -->|“route to on-chain”| OnChainSvc
    end

    %% Data Sources
    subgraph "Data Sources"
        DBCache["CoinGecko DB/Cache"]:::data
        Blockchain["External Blockchain Networks"]:::data

        PublicSvc --> DBCache
        ProSvc --> DBCache
        OnChainSvc --> Blockchain
    end

    %% Clients & Consumers
    subgraph "Clients & Consumers"
        WebDocs["Web Documentation (docs.coingecko.com)"]:::clients
        ThirdParty["Third-Party Apps & SDKs"]:::clients
        InternalDash["Internal Dashboards"]:::clients

        DocsSite --> WebDocs
        SDKs --> ThirdParty
        ThirdParty --> APIGateway
        InternalDash --> APIGateway
    end

    %% Click Events
    click GitRepo "https://github.com/coingecko/coingecko-api-oas/blob/main/."
    click README "https://github.com/coingecko/coingecko-api-oas/blob/main/README.md"
    click PublicSpec "https://github.com/coingecko/coingecko-api-oas/blob/main/coingecko-public-api-v3.json"
    click ProSpec "https://github.com/coingecko/coingecko-api-oas/blob/main/coingecko-pro-api-v3.json"
    click OnChainSpec "https://github.com/coingecko/coingecko-api-oas/blob/main/on-chain-dex-api-beta.json"
    click Assets "https://github.com/coingecko/coingecko-api-oas/tree/main/readme-assets/"

    %% Styles
    classDef spec fill:#D6E9FF,stroke:#4A90E2,color:#000;
    classDef runtime fill:#D4F1C5,stroke:#3C763D,color:#000;
    classDef data fill:#FFE5B4,stroke:#E67E22,color:#000;
    classDef clients fill:#E1D5E7,stroke:#8E44AD,color:#000;
```
