# aws/language-servers architecture

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

- Interactive diagram: https://gitdiagram.com/aws/language-servers
- Repository: https://github.com/aws/language-servers

## Overview

##### Project’s Main Purpose and Type
- The README and file structure reveal a monorepo that provides multiple Language Server Protocol (LSP) implementations for different AWS services (BuildSpec, CloudFormation, CodeWhisperer, S3, JSON, YAML, etc.).
- The project integrates with various IDEs (JetBrains, Visual Studio, VSCode) by providing both server-side implementations and sample client integrations.
- It is a full-stack system in the sense that the “backend” language server implementations (in /server) and runtime applications (in /app) work in tandem with client-side extensions to deliver language intelligence to developers.

##### File Structure for Architectural Clues
- Top-level directories include:
– app: Contains bundled runtime applications (each one wrapping a specific LSP such as aws-lsp-buildspec-runtimes, aws-lsp-cloudformation-runtimes, etc.).
– client: Provides sample IDE integrations for testing language servers (subdirectories for JetBrains, Visual Studio, and VSCode).
– core: Contains the shared and supporting libraries (aws-lsp-core) that underpin the Language Server logic.
– server: Hosts the primary language server implementations. Each service (buildspec, cloudformation, codewhisperer, s3, json, yaml, etc.) is implemented in its own package.
– script: Contains helper scripts used for build or dependency management.
- The presence of configuration files, test folders, and build scripts indicates that good practices are in place for integration, automated packaging, and CI/CD.

a. Main Components
– Clients: Represented by IDE integrations available in the client directory (JetBrains, Visual Studio, VSCode).
– Language Servers/Application Runtimes: The implementations in the server and app directories (each tailored to a specific AWS service).
– Core Library: The aws-lsp-core in the core directory, which serves as the backbone of the language servers.
– External Services/Dependencies: Underlying frameworks such as ANTLR (for language parsing), JSON schema services, and potentially AWS authentication modules.
b. Relationships and Interactions
– Client IDE Extensions communicate with Language Servers over standard LSP protocols.
– The Language Servers (both in the “server” and release runtime “app” variants) rely on the core library for common functionalities such as content handling, credentials, HTTP requests, and language service utilities.
– There is a build and deployment pipeline (scripts and CI config in .github/workflows, release-please, etc.) that ties the development and release of these components.
c. Architectural Patterns and Design Principles
– Modular, multi-package monorepo layout that segregates concerns (each LSP has a dedicated package).
– Emphasis on separation of concerns: distinct components for client, server, and core shared libraries.
– Use of layered abstraction where the client uses the LSP protocol to access server functionalities, which in turn make use of a common core for shared operations.
d. Relevant Technologies and Frameworks
– Node.js/TypeScript is heavily used in both server and client code.
– Tools like ESLint, Prettier, and Husky for code quality.
– Build tools (webpack, tsconfig configuration) and testing frameworks (Mocha, Jest) for ensuring robust development.
– ANTLR for generating parsers (e.g., in the aws-lsp-antlr4 package).

1. Start by drawing high-level nodes: “Clients”, “Language Servers (Server & App)”, “Core Libraries”, and “CI/Build Pipeline”.
2. Within “Clients”, branch out to each IDE integration node (JetBrains, VSCode, Visual Studio).
3. For “Language Servers”, create separate nodes for each AWS-specific LSP (buildspec, cloudformation, codewhisperer, s3, json, yaml, etc.) or group them if overlapping functionality exists.
6. Optionally, include external services (e.g., ANTLR-based parsers, Credential Management) as sub-nodes connected to the language server nodes.
7. A section for “Build, Test & Deployment” showing how scripts and workflows (from /script and .github) interact with the entire system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Integrations
    subgraph "Client Integrations"
        Client_Jetbrains("JetBrains IDE"):::client
        Client_VisualStudio("Visual Studio IDE"):::client
        Client_VSCode("VSCode IDE"):::client
        ChatClient("Chat Client"):::client
    end

    %% Language Servers (Server-side)
    subgraph "Language Servers (Server-side)"
        LS_Antlr("AWS LSP ANTLR4"):::server
        LS_Buildspec("AWS LSP BuildSpec"):::server
        LS_Cloudformation("AWS LSP CloudFormation"):::server
        LS_Codewhisperer("AWS LSP CodeWhisperer"):::server
        LS_Identity("AWS LSP Identity"):::server
        LS_Json("AWS LSP JSON"):::server
        LS_Notification("AWS LSP Notification"):::server
        LS_Partiql("AWS LSP PartiQL"):::server
        LS_S3("AWS LSP S3"):::server
        LS_Yaml("AWS LSP YAML"):::server
        LS_DeviceSSO("Device SSO Auth LSP"):::server
        LS_HelloWorld("Hello World LSP"):::server
    end

    %% Runtime Applications (App-side Wrappers)
    subgraph "Runtime Applications"
        RA_Antlr("AWS LSP ANTLR4 Runtimes"):::app
        RA_Buildspec("AWS LSP BuildSpec Runtimes"):::app
        RA_Cloud("AWS LSP CloudFormation Runtimes"):::app
        RA_Code("AWS LSP CodeWhisperer Runtimes"):::app
        RA_Identity("AWS LSP Identity Runtimes"):::app
        RA_Json("AWS LSP JSON Runtimes"):::app
        RA_Notif("AWS LSP Notification Runtimes"):::app
        RA_Partiql("AWS LSP PartiQL Runtimes"):::app
        RA_Yaml("AWS LSP YAML Runtimes"):::app
        RA_YamlJsonWebworker("AWS LSP YAML-JSON Webworker"):::app
        RA_HelloWorld("Hello World LSP Runtimes"):::app
    end

    %% Core Library
    subgraph "Core Library"
        Core("AWS LSP Core"):::core
    end

    %% Build & CI Pipeline
    subgraph "Build & CI Pipeline"
        CI_Github("GitHub Workflows"):::ci
        CI_Script("Script Utilities"):::ci
    end

    %% External Services
    External_Services("External Services (ANTLR,JSON Schema)"):::external

    %% Relationships
    %% Clients communicate with Language Servers
    Client_Jetbrains -->|"LSPcommunication"| LS_Antlr
    Client_VisualStudio -->|"LSPcommunication"| LS_Cloudformation
    Client_VSCode -->|"LSPcommunication"| LS_CodeWhisperer
    ChatClient -->|"LSPcommunication"| LS_Json

    %% Runtime applications wrap corresponding language servers
    RA_Antlr -->|"wraps"| LS_Antlr
    RA_Buildspec -->|"wraps"| LS_Buildspec
    RA_Cloud -->|"wraps"| LS_Cloudformation
    RA_Code -->|"wraps"| LS_Codewhisperer
    RA_Identity -->|"wraps"| LS_Identity
    RA_Json -->|"wraps"| LS_Json
    RA_Notif -->|"wraps"| LS_Notification
    RA_Partiql -->|"wraps"| LS_Partiql
    RA_Yaml -->|"wraps"| LS_Yaml
    RA_HelloWorld -->|"wraps"| LS_HelloWorld
    %% Note: RA_YamlJsonWebworker is an additional runtime component

    %% Language Servers depend on Core Library
    LS_Antlr -->|"depends"| Core
    LS_Buildspec -->|"depends"| Core
    LS_Cloudformation -->|"depends"| Core
    LS_Codewhisperer -->|"depends"| Core
    LS_Identity -->|"depends"| Core
    LS_Json -->|"depends"| Core
    LS_Notification -->|"depends"| Core
    LS_Partiql -->|"depends"| Core
    LS_S3 -->|"depends"| Core
    LS_Yaml -->|"depends"| Core
    LS_DeviceSSO -->|"depends"| Core
    LS_HelloWorld -->|"depends"| Core

    %% External services provide support to Language Servers
    External_Services ---|"supports"| LS_Antlr
    External_Services ---|"supports"| LS_Json
    External_Services ---|"supports"| LS_Yaml

    %% CI Pipeline builds and deploys Core and Language Servers
    CI_Github -->|"build/deploy"| Core
    CI_Script -->|"build/deploy"| Core
    CI_Github -->|"build/test"| LS_Buildspec
    CI_Script -->|"build/test"| LS_Codewhisperer

    %% Click Events for Client Integrations
    click Client_Jetbrains "https://github.com/aws/language-servers/tree/main/client/jetbrains"
    click Client_VisualStudio "https://github.com/aws/language-servers/tree/main/client/visualStudio"
    click Client_VSCode "https://github.com/aws/language-servers/tree/main/client/vscode"
    click ChatClient "https://github.com/aws/language-servers/tree/main/chat-client"

    %% Click Events for Language Server Implementations
    click LS_Antlr "https://github.com/aws/language-servers/tree/main/server/aws-lsp-antlr4"
    click LS_Buildspec "https://github.com/aws/language-servers/tree/main/server/aws-lsp-buildspec"
    click LS_Cloudformation "https://github.com/aws/language-servers/tree/main/server/aws-lsp-cloudformation"
    click LS_Codewhisperer "https://github.com/aws/language-servers/tree/main/server/aws-lsp-codewhisperer"
    click LS_Identity "https://github.com/aws/language-servers/tree/main/server/aws-lsp-identity"
    click LS_Json "https://github.com/aws/language-servers/tree/main/server/aws-lsp-json"
    click LS_Notification "https://github.com/aws/language-servers/tree/main/server/aws-lsp-notification"
    click LS_Partiql "https://github.com/aws/language-servers/tree/main/server/aws-lsp-partiql"
    click LS_S3 "https://github.com/aws/language-servers/tree/main/server/aws-lsp-s3"
    click LS_Yaml "https://github.com/aws/language-servers/tree/main/server/aws-lsp-yaml"
    click LS_DeviceSSO "https://github.com/aws/language-servers/tree/main/server/device-sso-auth-lsp"
    click LS_HelloWorld "https://github.com/aws/language-servers/tree/main/server/hello-world-lsp"

    %% Click Events for Runtime Applications
    click RA_Antlr "https://github.com/aws/language-servers/tree/main/app/aws-lsp-antlr4-runtimes"
    click RA_Buildspec "https://github.com/aws/language-servers/tree/main/app/aws-lsp-buildspec-runtimes"
    click RA_Cloud "https://github.com/aws/language-servers/tree/main/app/aws-lsp-cloudformation-runtimes"
    click RA_Code "https://github.com/aws/language-servers/tree/main/app/aws-lsp-codewhisperer-runtimes"
    click RA_Identity "https://github.com/aws/language-servers/tree/main/app/aws-lsp-identity-runtimes"
    click RA_Json "https://github.com/aws/language-servers/tree/main/app/aws-lsp-json-runtimes"
    click RA_Notif "https://github.com/aws/language-servers/tree/main/app/aws-lsp-notification-runtimes"
    click RA_Partiql "https://github.com/aws/language-servers/tree/main/app/aws-lsp-partiql-runtimes"
    click RA_Yaml "https://github.com/aws/language-servers/tree/main/app/aws-lsp-yaml-runtimes"
    click RA_YamlJsonWebworker "https://github.com/aws/language-servers/tree/main/app/aws-lsp-yaml-json-webworker"
    click RA_HelloWorld "https://github.com/aws/language-servers/tree/main/app/hello-world-lsp-runtimes"

    %% Click Event for Core Library
    click Core "https://github.com/aws/language-servers/tree/main/core/aws-lsp-core"

    %% Click Events for Build & CI Pipeline
    click CI_Github "https://github.com/aws/language-servers/tree/main/.github/workflows"
    click CI_Script "https://github.com/aws/language-servers/tree/main/script"

    %% Styles
    classDef client fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef server fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef app fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
    classDef core fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
    classDef ci fill:#FFE082,stroke:#FF8F00,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
```
