# thenewwazoo/lutron-leap-js architecture

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

- Interactive diagram: https://gitdiagram.com/thenewwazoo/lutron-leap-js
- Repository: https://github.com/thenewwazoo/lutron-leap-js

## Overview

lutron-leap is a TypeScript implementation of Lutron’s LEAP protocol, with Caséta Smart Bridge abstractions. The principal workflow is to discover a bridge, establish a secure LEAP client connection, parse hub responses into typed messages, and expose bridge information, device operations, and subscriptions. Pairing is a separate certificate-enrollment workflow. The README documents discovery and client responsibilities; sampled source confirms message parsing, client/parser wiring, bridge operations, and pairing credentials. BridgeFinder’s implementation was not sampled, so its documented relationships are cited to the README.

Main entry points: [`src/BridgeFinder.ts`](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/BridgeFinder.ts) (Bridge finder), [`src/LeapClient.ts`](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/LeapClient.ts) (LEAP client), [`src/ResponseParser.ts`](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/ResponseParser.ts) (Response parser), [`src/Messages.ts`](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/Messages.ts) (Message model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Bridge discovery"]
  node_bridgefinder["Bridge finder<br/>[BridgeFinder.ts]"]
end

subgraph group_protocol["LEAP protocol"]
  node_leapclient["LEAP client<br/>[LeapClient.ts]"]
  node_responseparser["Response parser<br/>[ResponseParser.ts]"]
  node_messages["Message model<br/>[Messages.ts]"]
  node_bodytypes["Body types"]
end

subgraph group_bridge["Bridge operations"]
  node_smartbridge["Smart Bridge API<br/>[SmartBridge.ts]"]
end

subgraph group_pairing["Certificate pairing"]
  node_pairingclient["Pairing client<br/>[PairingClient.ts]"]
  node_association["Pairing credentials<br/>[Association.ts]"]
end

node_consumer(("Library consumer"))
node_mdns["mDNS network"]

node_consumer -->|"discovers bridges"| node_bridgefinder
node_bridgefinder -->|"searches network"| node_mdns
node_bridgefinder -->|"returns network info"| node_consumer
node_consumer -->|"constructs client"| node_leapclient
node_consumer -->|"uses operations"| node_smartbridge
node_smartbridge -->|"sends requests"| node_leapclient
node_leapclient -->|"handles responses"| node_responseparser
node_responseparser -->|"parses responses"| node_messages
node_messages -->|"parses bodies"| node_bodytypes
node_consumer -->|"requests pairing"| node_pairingclient
node_pairingclient -->|"uses credentials"| node_association

click node_bridgefinder "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/BridgeFinder.ts"
click node_leapclient "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/LeapClient.ts"
click node_responseparser "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/ResponseParser.ts"
click node_messages "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/Messages.ts"
click node_bodytypes "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/MessageBodyTypes.ts"
click node_smartbridge "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/SmartBridge.ts"
click node_pairingclient "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/PairingClient.ts"
click node_association "https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/Association.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_bridgefinder toneBlue
class node_leapclient,node_responseparser,node_messages,node_bodytypes toneAmber
class node_smartbridge toneMint
class node_pairingclient,node_association toneRose
class node_consumer,node_mdns toneIndigo
```

## Components

### Bridge discovery

- [Bridge finder](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/BridgeFinder.ts): `src/BridgeFinder.ts`

### LEAP protocol

- [LEAP client](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/LeapClient.ts): `src/LeapClient.ts`
- [Response parser](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/ResponseParser.ts): `src/ResponseParser.ts`
- [Message model](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/Messages.ts): `src/Messages.ts`
- [Body types](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/MessageBodyTypes.ts): `src/MessageBodyTypes.ts`

### Bridge operations

- [Smart Bridge API](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/SmartBridge.ts): `src/SmartBridge.ts`

### Certificate pairing

- [Pairing client](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/PairingClient.ts): `src/PairingClient.ts`
- [Pairing credentials](https://github.com/thenewwazoo/lutron-leap-js/blob/main/src/Association.ts): `src/Association.ts`

### Other components

- **Library consumer**
- **mDNS network**

## Connections

- Library consumer → Bridge finder: discovers bridges (evidence: `README.md`)
- Bridge finder → mDNS network: searches network (evidence: `README.md`)
- Bridge finder → Library consumer: returns network info (evidence: `README.md`)
- Library consumer → LEAP client: constructs client (evidence: `README.md`)
- Library consumer → Smart Bridge API: uses operations (evidence: `README.md`)
- Smart Bridge API → LEAP client: sends requests (evidence: `src/SmartBridge.ts`)
- LEAP client → Response parser: handles responses (evidence: `src/LeapClient.ts`)
- Response parser → Message model: parses responses (evidence: `src/ResponseParser.ts`)
- Message model → Body types: parses bodies (evidence: `src/Messages.ts`)
- Library consumer → Pairing client: requests pairing (evidence: `README.md`)
- Pairing client → Pairing credentials: uses credentials (evidence: `src/PairingClient.ts`)
