Skip to main content

Overview

npmGitHub

What is CDF?

The Central Data Framework (CDF) is the app data layer for RainMaker-style home and IoT apps. It is published as @espressif/rainmaker-base-cdf.

In plain terms: your screens talk to CDF. CDF talks to the SDKs (RainMaker, Matter, and others) through adaptors. You build features against one stable API instead of each SDK’s own types and calls.


Why do you need it?

The RainMaker Base SDK already exposes auth, devices, groups, and more. Without CDF, every screen still has to:

  • Keep device lists, rooms, scenes, and user data up to date after each API call
  • Refresh the UI when a parameter changes or a push event arrives
  • Learn a different API if you also support Matter or another backend

CDF is the layer that owns that work so feature code stays simple: read a store, call an entity method, and let the UI update.

Without CDFWith CDF
Call SDK APIs from screensCall methods on CDF entities
Manage lists and cache yourselfRead ready-made stores
Wire refresh / push updates by handStores update; UI re-renders
UI tied to one SDKSame UI API across adaptors

Prefer the Base SDK alone when you already have your own state layer and want full control of every call.


What can CDF help with?

CDF gives your app ready-made product areas as stores. Each store is where your UI reads data and triggers actions:

AreaStoreWhat you can build
Users & authuserStoreSign in / out, profile
DevicesnodeStoreList nodes, read and set parameters
Homes & roomsgroupStoreHomes, rooms, membership, sharing
ScenessceneStoreDefine and activate multi-device scenes
SchedulesscheduleStoreTime-based actions
AutomationsautomationStoreEvent-driven rules
Live updatessubscriptionStorePush events feed into the other stores

You do not need to understand adaptors, transformers, or registry internals to use these features. That material is for Architecture and Adaptor Registry later.


What apps can use CDF?

CDF is a TypeScript package. It fits apps that need a shared data layer for IoT / smart-home features.

Good fitNotes
React Native home / IoT appsPrimary path; used by ESP RainMaker Home
React (web) appsSame stores and entities; wire CDF through React context
Other TypeScript appsPossible if you consume stores/entities without MobX UI helpers

Under CDF you still use ecosystem SDKs (for example @espressif/rainmaker-base-sdk) and, for that SDK, platform adapters (storage, BLE, push) so the SDK works on your platform.


What will you achieve?

After you adopt CDF, you should be able to:

  1. Ship screens faster — login, device list, room control, scenes, schedules without custom sync logic
  2. Keep UI consistent — one model for devices and homes even if backends differ
  3. Stay reactive — when a device or push event changes data, stores update and the UI can re-render
  4. Grow the app — add Matter or another SDK via an adaptor without rewriting feature screens

Reference implementation: esp-rainmaker-home


How CDF fits with the SDK and adaptors

Two related ideas often get mixed up:

PieceJob
RainMaker Base SDKRainMaker APIs (auth, nodes, groups, …)
SDK platform adaptersBridge the Base SDK to the device (storage, BLE, notifications)
CDFApp-facing stores and entities your UI uses
CDF SDK adaptorsPlug RainMaker / Matter / custom SDKs into CDF

Most app developers use an existing CDF adaptor and build UI against stores. Writing adaptors is an advanced step — see Adaptor Registry.


Learning path

StepPageSo you can...
1Getting startedInstall CDF and use stores in a screen
2EntitiesBuild feature workflows (devices, groups, scenes, …)
3Domain storesLists, pagination, filtering, reactive queries
4ArchitectureLayers in more detail (intermediate)
5Adaptor registryMultiple SDKs or a custom adaptor (advanced)
6Best practices / ErrorsPitfalls and debugging

Resources

On this page