How divkit/divkit works
DivKit is a server-driven UI framework: a layout is authored or supplied as JSON, then rendered by platform clients; user interactions can update state and trigger actions. The repository also includes JSON-building libraries, schema-based API generation, a browser visual editor, and a playground with live sessions. The README establishes the cross-platform product workflow; sampled source supports specific iOS state/action relationships and playground session behavior. Several platform internals are represented by their enclosing directories because their implementations were not sampled.
Main entry points: DivKit iOS Client · DivActionHandler.swift Action Handler · sessionController.ts Playground Session · DivVariablesStorage.swift Variable Storage
Components 22
Authoring and Playground
- Visual Editor
visual-editor/src/App.svelte - Playground Session
site/client/src/data/sessionController.ts - Playground Server
site/server/app.js - Web Preview
client/web/divkit/src/server.ts
Data and Generation
- JSON Builders
json-builder - DivKit Schema
schema - API Generator
api_generator/api_generator/generator.py - Android Generator Plugin
client/android/api-generator-plugin/src/main/kotlin/com/yandex/divkit/generator/ApiGeneratorPlugin.kt
Rendering Clients
- Web Client
client/web/divkit - Android Client
client/android - iOS Client
client/ios/DivKit
iOS Runtime State
- Element Paths
client/ios/LayoutKit/Interface/UIElementPath.swift - Variable Storage
client/ios/DivKit/Variables/DivVariablesStorage.swift - Block State
client/ios/DivKit/DivBlockStateStorage.swift - Action Handler
client/ios/DivKit/Actions/DivActionHandler.swift - Persistent Values
client/ios/DivKit/StoredValues/DivPersistentValuesStorage.swift - Custom Functions
client/ios/DivKit/Expressions/CustomFunctions/DivFunctionsStorage.swift - Timer Storage
client/ios/DivKit/Timers/DivTimerStorage.swift - Trigger Storage
client/ios/DivKit/Variables/DivTriggersStorage.swift
Android Runtime
- Android Storage
client/android/storage/src/commonMain/kotlin/com/yandex/div/storage/internal/DivStorageImpl.kt
Other components
- Layout Author
- App Developer
Connections 22
- Layout Author → Visual Editor: authors layouts
README.md - Visual Editor → Web Preview: previews layouts
README.md - Layout Author → JSON Builders: builds JSON
README.md - JSON Builders → DivKit Schema: emits format
README.md - DivKit Schema → API Generator: defines API
README.md - API Generator → Android Generator Plugin: generates platform API
- Playground Session → Playground Server: updates source
site/client/src/data/sessionController.ts - Playground Session → Web Preview: previews JSON
README.md - Playground Server → Playground Session: serves sessions
- App Developer → iOS Client: integrates view
README.md - App Developer → Android Client: integrates view
README.md - App Developer → Web Client: integrates client
README.md - iOS Client → Element Paths: uses paths
client/ios/DivKit/DivBlockStateStorage.swift - iOS Client → Variable Storage: evaluates variables
client/ios/DivKit/Variables/DivVariablesStorage.swift - iOS Client → Block State: stores element state
client/ios/DivKit/DivBlockStateStorage.swift - iOS Client → Action Handler: dispatches actions
client/ios/DivKit/Actions/DivActionHandler.swift - Action Handler → Variable Storage: reads variables
client/ios/DivKit/Variables/DivVariablesStorage.swift - Action Handler → Persistent Values: uses stored values
client/ios/DivKit/Actions/DivActionHandler.swift - Action Handler → Custom Functions: uses functions
client/ios/DivKit/Actions/DivActionHandler.swift - Action Handler → Timer Storage: dispatches timers
client/ios/DivKit/Actions/DivActionHandler.swift - Variable Storage → Trigger Storage: notifies triggers
- Android Client → Android Storage: persists data
client/android/storage/src/commonMain/kotlin/com/yandex/div/storage/internal/DivStorageImpl.kt