# kiowdev/itd-api architecture

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

- Interactive diagram: https://gitdiagram.com/kiowdev/itd-api
- Repository: https://github.com/kiowdev/itd-api

## Overview

itd-api is a TypeScript SDK for the итд.com social network. A user constructs an ItdClient, invokes typed resources or builders, and the shared runtime prepares authentication, applies request execution and reliability policies, and sends HTTP requests; results return through the SDK. Separate major surfaces handle session and account management, event streams, pagination and publishing, and platform capabilities. The README documents the sibling integration packages; their internal wiring is not shown in the sampled source, so their links are documented capability relationships rather than inferred calls.

Main entry points: [`src/core/execution/client-runtime.ts`](https://github.com/kiowdev/itd-api/blob/main/src/core/execution/client-runtime.ts) (Client runtime), [`src/resources`](https://github.com/kiowdev/itd-api/tree/main/src/resources) (REST resources), [`src/client.ts`](https://github.com/kiowdev/itd-api/blob/main/src/client.ts) (ItdClient), [`src/resources/auth.ts`](https://github.com/kiowdev/itd-api/blob/main/src/resources/auth.ts) (Auth resource)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client_runtime["Client runtime"]
  node_client["ItdClient<br/>[client.ts]"]
  node_runtime["Client runtime<br/>[client-runtime.ts]"]
  node_http["HTTP execution<br/>[http.ts]"]
  node_reliability["Request policies<br/>[rate-limit.ts]"]
end

subgraph group_api_features["API features"]
  node_resources["REST resources"]
  node_operations["Operation catalog<br/>[operations.ts]"]
  node_builders["Content builders"]
  node_pagination["Pagination<br/>[pagination.ts]"]
  node_platform["Platform services<br/>[platform.ts]"]
end

subgraph group_auth_events["Auth and events"]
  node_auth_resource["Auth resource<br/>[auth.ts]"]
  node_auth_provider["Auth provider<br/>[auth-provider.ts]"]
  node_session[("Session storage<br/>[storage.ts]")]
  node_accounts[("Multi-account sessions<br/>[multi-storage.ts]")]
  node_event_client["Events client<br/>[client.ts]"]
  node_event_engine["Event engine<br/>[engine.ts]"]
  node_event_transports["Event transports<br/>[transport.ts]"]
end

subgraph group_extensions["Extension packages"]
  node_cache["Cache plugin<br/>[plugin.ts]"]
  node_crypto["Crypto plugin<br/>[request.ts]"]
  node_hydrate["Model actions<br/>[client.ts]"]
  node_proxy["Proxy transport<br/>[index.ts]"]
  node_captcha["Captcha token helper<br/>[handler.ts]"]
end

subgraph group_platform_types["Platform model"]
  node_models["API models and types<br/>[common.ts]"]
  node_markup["Text markup<br/>[parse.ts]"]
end

node_developer(("SDK user"))
node_api_host{{"итд.com API"}}
node_event_api{{"Event stream service"}}

node_developer -->|"creates client"| node_client
node_client -->|"creates runtime"| node_runtime
node_client -->|"exposes resources"| node_resources
node_resources -->|"sends requests"| node_runtime
node_resources -->|"uses definitions"| node_operations
node_runtime -->|"executes requests"| node_http
node_runtime -->|"applies limits"| node_reliability
node_http -->|"sends HTTP"| node_api_host
node_api_host -->|"returns responses"| node_http
node_developer -->|"authenticates"| node_auth_resource
node_auth_resource -->|"shares executor"| node_runtime
node_runtime -->|"prepares auth"| node_auth_provider
node_auth_provider -.->|"uses storage"| node_session
node_developer -->|"manages accounts"| node_accounts
node_developer -->|"subscribes"| node_event_client
node_event_client -->|"uses client runtime"| node_runtime
node_event_client -->|"starts engine"| node_event_engine
node_event_engine -->|"runs transport"| node_event_transports
node_event_transports -->|"opens stream"| node_event_api
node_developer -->|"builds content"| node_builders
node_builders -->|"validates markup"| node_markup
node_developer -->|"iterates pages"| node_pagination
node_developer -->|"reads platform data"| node_platform
node_resources -->|"returns typed data"| node_models
node_developer -->|"installs plugin"| node_cache
node_developer -->|"installs plugin"| node_crypto
node_developer -->|"uses actions"| node_hydrate
node_runtime -.->|"can use transport"| node_proxy
node_auth_resource -.->|"can obtain token"| node_captcha

click node_client "https://github.com/kiowdev/itd-api/blob/main/src/client.ts"
click node_runtime "https://github.com/kiowdev/itd-api/blob/main/src/core/execution/client-runtime.ts"
click node_http "https://github.com/kiowdev/itd-api/blob/main/src/core/execution/http.ts"
click node_reliability "https://github.com/kiowdev/itd-api/blob/main/src/core/scheduling/rate-limit.ts"
click node_resources "https://github.com/kiowdev/itd-api/tree/main/src/resources"
click node_operations "https://github.com/kiowdev/itd-api/blob/main/src/domain/operations.ts"
click node_builders "https://github.com/kiowdev/itd-api/tree/main/src/builders"
click node_pagination "https://github.com/kiowdev/itd-api/blob/main/src/resources/pagination.ts"
click node_platform "https://github.com/kiowdev/itd-api/blob/main/src/resources/platform.ts"
click node_auth_resource "https://github.com/kiowdev/itd-api/blob/main/src/resources/auth.ts"
click node_auth_provider "https://github.com/kiowdev/itd-api/blob/main/src/core/auth-provider.ts"
click node_session "https://github.com/kiowdev/itd-api/blob/main/src/session/storage.ts"
click node_accounts "https://github.com/kiowdev/itd-api/blob/main/src/session/multi-storage.ts"
click node_event_client "https://github.com/kiowdev/itd-api/blob/main/src/events/client.ts"
click node_event_engine "https://github.com/kiowdev/itd-api/blob/main/src/events/engine.ts"
click node_event_transports "https://github.com/kiowdev/itd-api/blob/main/src/events/transports/transport.ts"
click node_cache "https://github.com/kiowdev/itd-api/blob/main/packages/cache/src/plugin.ts"
click node_crypto "https://github.com/kiowdev/itd-api/blob/main/packages/crypto/src/request.ts"
click node_hydrate "https://github.com/kiowdev/itd-api/blob/main/packages/hydrate/src/facades/client.ts"
click node_proxy "https://github.com/kiowdev/itd-api/blob/main/packages/proxy/src/index.ts"
click node_captcha "https://github.com/kiowdev/itd-api/blob/main/packages/captcha/src/handler.ts"
click node_models "https://github.com/kiowdev/itd-api/blob/main/src/models/common.ts"
click node_markup "https://github.com/kiowdev/itd-api/blob/main/src/spans/parse.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_client,node_runtime,node_http,node_reliability,node_developer toneBlue
class node_resources,node_operations,node_builders,node_pagination,node_platform toneAmber
class node_auth_resource,node_auth_provider,node_session,node_accounts,node_event_client,node_event_engine,node_event_transports,node_api_host toneMint
class node_cache,node_crypto,node_hydrate,node_proxy,node_captcha toneRose
class node_models,node_markup,node_event_api toneIndigo
```

## Components

### Client runtime

- [ItdClient](https://github.com/kiowdev/itd-api/blob/main/src/client.ts): `src/client.ts`
- [Client runtime](https://github.com/kiowdev/itd-api/blob/main/src/core/execution/client-runtime.ts): `src/core/execution/client-runtime.ts`
- [HTTP execution](https://github.com/kiowdev/itd-api/blob/main/src/core/execution/http.ts): `src/core/execution/http.ts`
- [Request policies](https://github.com/kiowdev/itd-api/blob/main/src/core/scheduling/rate-limit.ts): `src/core/scheduling/rate-limit.ts`

### API features

- [REST resources](https://github.com/kiowdev/itd-api/tree/main/src/resources): `src/resources`
- [Operation catalog](https://github.com/kiowdev/itd-api/blob/main/src/domain/operations.ts): `src/domain/operations.ts`
- [Content builders](https://github.com/kiowdev/itd-api/tree/main/src/builders): `src/builders`
- [Pagination](https://github.com/kiowdev/itd-api/blob/main/src/resources/pagination.ts): `src/resources/pagination.ts`
- [Platform services](https://github.com/kiowdev/itd-api/blob/main/src/resources/platform.ts): `src/resources/platform.ts`

### Auth and events

- [Auth resource](https://github.com/kiowdev/itd-api/blob/main/src/resources/auth.ts): `src/resources/auth.ts`
- [Auth provider](https://github.com/kiowdev/itd-api/blob/main/src/core/auth-provider.ts): `src/core/auth-provider.ts`
- [Session storage](https://github.com/kiowdev/itd-api/blob/main/src/session/storage.ts): `src/session/storage.ts`
- [Multi-account sessions](https://github.com/kiowdev/itd-api/blob/main/src/session/multi-storage.ts): `src/session/multi-storage.ts`
- [Events client](https://github.com/kiowdev/itd-api/blob/main/src/events/client.ts): `src/events/client.ts`
- [Event engine](https://github.com/kiowdev/itd-api/blob/main/src/events/engine.ts): `src/events/engine.ts`
- [Event transports](https://github.com/kiowdev/itd-api/blob/main/src/events/transports/transport.ts): `src/events/transports/transport.ts`

### Extension packages

- [Cache plugin](https://github.com/kiowdev/itd-api/blob/main/packages/cache/src/plugin.ts): `packages/cache/src/plugin.ts`
- [Crypto plugin](https://github.com/kiowdev/itd-api/blob/main/packages/crypto/src/request.ts): `packages/crypto/src/request.ts`
- [Model actions](https://github.com/kiowdev/itd-api/blob/main/packages/hydrate/src/facades/client.ts): `packages/hydrate/src/facades/client.ts`
- [Proxy transport](https://github.com/kiowdev/itd-api/blob/main/packages/proxy/src/index.ts): `packages/proxy/src/index.ts`
- [Captcha token helper](https://github.com/kiowdev/itd-api/blob/main/packages/captcha/src/handler.ts): `packages/captcha/src/handler.ts`

### Platform model

- [API models and types](https://github.com/kiowdev/itd-api/blob/main/src/models/common.ts): `src/models/common.ts`
- [Text markup](https://github.com/kiowdev/itd-api/blob/main/src/spans/parse.ts): `src/spans/parse.ts`

### Other components

- **SDK user**
- **итд.com API**
- **Event stream service**

## Connections

- SDK user → ItdClient: creates client (evidence: `README.md`)
- ItdClient → Client runtime: creates runtime (evidence: `src/client.ts`)
- ItdClient → REST resources: exposes resources (evidence: `README.md`)
- REST resources → Client runtime: sends requests (evidence: `src/rest/client.ts`)
- REST resources → Operation catalog: uses definitions (evidence: `src/domain/operations.ts`)
- Client runtime → HTTP execution: executes requests (evidence: `src/core/execution/client-runtime.ts`)
- Client runtime → Request policies: applies limits (evidence: `src/core/execution/client-runtime.ts`)
- HTTP execution → итд.com API: sends HTTP (evidence: `README.md`)
- итд.com API → HTTP execution: returns responses (evidence: `README.md`)
- SDK user → Auth resource: authenticates (evidence: `README.md`)
- Auth resource → Client runtime: shares executor
- Client runtime → Auth provider: prepares auth (evidence: `src/core/execution/client-runtime.ts`)
- Auth provider → Session storage: uses storage
- SDK user → Multi-account sessions: manages accounts (evidence: `README.md`)
- SDK user → Events client: subscribes (evidence: `README.md`)
- Events client → Client runtime: uses client runtime (evidence: `src/events/client.ts`)
- Events client → Event engine: starts engine (evidence: `src/events/client.ts`)
- Event engine → Event transports: runs transport (evidence: `src/events/engine.ts`)
- Event transports → Event stream service: opens stream (evidence: `README.md`)
- SDK user → Content builders: builds content (evidence: `README.md`)
- Content builders → Text markup: validates markup (evidence: `src/builders/markup.ts`)
- SDK user → Pagination: iterates pages (evidence: `README.md`)
- SDK user → Platform services: reads platform data (evidence: `README.md`)
- REST resources → API models and types: returns typed data (evidence: `README.md`)
- SDK user → Cache plugin: installs plugin (evidence: `README.md`)
- SDK user → Crypto plugin: installs plugin (evidence: `README.md`)
- SDK user → Model actions: uses actions (evidence: `README.md`)
- Client runtime → Proxy transport: can use transport
- Auth resource → Captcha token helper: can obtain token (evidence: `README.md`)
