POST /auth/token — OAuth2 token exchange (clients).
POST /auth/device — device enroll with cert or provisioning token.
GET /homes/{homeId}/devices
GET /homes/{homeId}/devices/{deviceId}
POST /homes/{homeId}/devices/{deviceId}/commands
GET /homes/{homeId}/devices/{deviceId}/state
GET /homes/{homeId}/devices/{deviceId}/telemetry?from=...&to=...&metric=power
POST /homes/{homeId}/rules — create rule (body = DSL)
GET /homes/{homeId}/rules/{ruleId}
POST /homes/{homeId}/schedules — create scheduled scene
ws /realtime?token=... — subscribe to home/{homeId}/events channels.
Stores structured, relational data (users, homes, devices, rules, schedules).
"users": {
"user_id": "uuid",
"email": "string",
"password_hash": "string",
"role": "owner | admin | guest",
"created_at": "timestamp"
}
"homes": {
"home_id": "uuid",
"user_id": "uuid (FK -> users.user_id)",
"name": "string",
"timezone": "string"
}
"devices": {
"device_id": "uuid",
"home_id": "uuid (FK -> homes.home_id)",
"type": "light | thermostat | lock | camera | sensor",
"protocol": "wifi | zigbee | zwave | thread | matter",
"manufacturer": "string",
"model": "string",
"firmware": "string",
"status": {
"power": "on | off",
"brightness": "int",
"temperature": "float",
"lock_state": "locked | unlocked"
},
"last_seen": "timestamp"
}
"automation_rules": {
"rule_id": "uuid",
"home_id": "uuid (FK -> homes.home_id)",
"name": "string",
"trigger": {
"type": "motion | schedule | sunset | sensor",
"device_id": "uuid",
"property": "string",
"operator": ">, <, =, !=, etc.",
"value": "any"
},
"conditions": [
{
"device_id": "uuid",
"property": "string",
"operator": "string",
"value": "any"
}
],
"actions": [
{
"device_id": "uuid",
"command": "turn_on | turn_off | set_temp | notify",
"params": {}
}
],
"enabled": "boolean"
},
"schedules": {
"schedule_id": "uuid",
"home_id": "uuid (FK -> homes.home_id)",
"device_id": "uuid (FK -> devices.device_id)",
"cron_expr": "string (e.g., '0 7 * * *')",
"action": {
"command": "turn_on | turn_off",
"params": {}
}
}
Stores sensor readings & device telemetry.
"telemetry": {
"ts": "timestamp",
"device_id": "uuid (FK -> devices.device_id)",
"metric": "temperature | humidity | power | motion",
"value": "float",
"unit": "°C | % | W | kWh"
},
"media_files": {
"media_id": "uuid",
"device_id": "uuid (FK -> devices.device_id)",
"type": "snapshot | clip",
"url": "string (S3/GCS path)",
"created_at": "timestamp"
}
This is where physical devices exist inside the home.
This is the backend system that manages communication, automation, storage, and integration.
How users and assistants interact with the system.
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?