---
name: eyefi-device-domain
description: Designs and implements Eyefi fleet/device features using DDD — Device aggregate, ConnectionProfile, DeviceEvent (later DeviceRecording), CameraVendorDriver registry, Mobotix webhook adapters, push-first ingest with poll reconciler as backup. Ports behavior from Spindle without copying view/serializer sprawl. Use when adding devices in api/, vendor drivers, webhook ingest, or Eyefi + Cloudflare tunnel dev.
---

# Eyefi device domain

## Aggregates

- **Device** (inventory root): `client_config`, `vendor`, optional FK `ConnectionProfile`, connection hints, `capabilities_json`, `status`, `last_seen_at`, optional external id for Mobotix.
- **ConnectionProfile**: auth kind + secret storage; never loaded on unprivileged list endpoints.
- **DeviceEvent**: append-only; `vendor_event_id` + `device` unique when present for idempotency.
- **DeviceRecording**: Phase 2 — not in v0.

## Outbound vs inbound

- **CameraVendorDriver** (ABC): vendor protocols in; neutral DTOs out. Registry per `VendorId`; no Django model subclass per vendor.
- **Webhook adapters**: verify auth, parse vendor payload → normalized fields → persist `DeviceEvent`. Keep vendor XML/JSON parsing out of Ninja handlers beyond delegation.

## Ingest

- **Push-first:** Mobotix (and others) POST to CSRF-exempt HTTPS routes (often via Cloudflare tunnel to local `8007`).
- **Thin handler:** validate → persist event → return 200 quickly; heavy work async later.
- **Backup:** slow periodic reconciler (Phase 2) for missed webhooks.
- **Cloudflare:** Eyefi uses a **separate** Cloudflare account/token from Lort Smith calls. Credentials: user-supplied or read-only from Axis workspace `.secrets/` — never commit into yeshuman.

## Spindle

- **Behavior parity, structural novelty.** Trace tests + public API in Spindle; do not mirror `DeviceViewSet` / serializer explosion.
- For slice checklist, see [eyefi-spindle-slice-port](../eyefi-spindle-slice-port/SKILL.md).

## Cruft blacklist

- No mega-ViewSet stacks per role; no ORM inheritance per vendor; no secrets on list serializers.

## Composition

- Labs UX: [ui-ux-application-planning](../ui-ux-application-planning/SKILL.md).
- Ship: [prepare-commit-pr](../prepare-commit-pr/SKILL.md), Railway skills as needed.

## Reference

- Glossary, vendor matrix, tunnel notes: [reference.md](reference.md).
