Android · PWA · 2026
Selawi Cam
Agentic engineering
I plan each project in a long conversation with an AI assistant, which writes up what we settle as a brief. Claude Code builds from that brief while I test, change scope and steer. How I work.
What I owned
- The idea, the feature set and what to leave out
- The plan: a long brainstorm with an AI assistant, turned into a written brief
- Agreeing the architecture, stack and rules in the brainstorm
- Reshaping scope as it came together: features added, changed and cut
- Testing on real devices and in daily use
What the agent did
- Building from the brief, phase by phase
- Writing the code, the tests and the documentation
- Fixing what testing turned up
Selawi Cam turns an old Android phone into an indoor security camera for one household. The phone records short clips when it detects motion and keeps them on the device. Family members use a web app on their own phones to check status, watch live video with sound, talk back, browse and save clips, and get alerts. Anyone in the house can pause the camera; only the owner can change how it records.
It answers the usual complaints about consumer cameras: footage on someone else's servers, a monthly fee, and very little control. The system spans an Android app, a Django backend, a React dashboard and a shared reverse-proxy config.
1. The server never sees video
The obvious design uploads clips to the backend or to object storage. The brief set the opposite rule from day one: video stays on the phone, and the server keeps metadata only (accounts, settings, recording and motion records, the audit log and push subscriptions). That keeps footage private and removes storage costs entirely.
A rule like that erodes quietly, so it is enforced by a test. test_no_video_storage.py fails the build if any database field could hold video.
2. Getting clips off a phone behind a home router
If the server holds no video, a viewer on mobile data has to pull clips straight from a phone behind a home router. Before any code was written, the design doc compared five options: temporary uploads to the server, an HTTPS server on the phone, relaying bytes over WebSockets, a tunnelling service, and a WebRTC data channel. The data channel won. It never touches server storage, it works behind carrier NAT through a TURN relay, and it reuses the connection live view already opens.
Live view uses WebRTC media tracks with two-way audio. Clips travel over the data channel as MP4s in 64 KB chunks with flow control, resume from an offset, and a SHA-256 check at the end. In testing, a 5 MB transfer survived a forced connection drop, resumed, and matched its checksum. Video goes phone to browser directly when it can and through a dedicated Coturn relay when it can't.
3. Sharing a small server with a production app
The backend shares a server of about 2 vCPUs and 3.8 GB of RAM with another app already in production, so the footprint is deliberately small: no Redis and no Celery, one Uvicorn process, Django Channels' in-memory layer, and a polling watcher that sends one push per problem with cooldowns. The camera has its own TURN relay, secrets and proxy site so the two services stay isolated.
Guard rails sit around the shared proxy: config reloads must pass validation first, a preflight script checks changes without touching the server, and the API accepts traffic from Cloudflare only.
Updates the user controls
A web app that updates itself silently can end up running new code against old styles. Silent updates were replaced by an Update banner the user taps, and the app now explains and recovers from failures, including chunk-load errors, with a controlled reload.
Quality bar
- Live view starts in about 0.6 s. Two people can watch at once and a third gets a clear "Camera busy".
- 261 automated tests across the three apps, including passkey login against forged keys, phishing origins and replayed challenges, and a real Web Push payload decrypted with the phone's key.
- Session auth with CSRF, WebAuthn passkeys, Argon2 passwords and hashed device tokens.
- Every clip sits behind a per-viewer grant that expires after five minutes, enforced on the phone itself.
Stack. Kotlin, Jetpack Compose, CameraX, OpenCV, WebRTC, Coturn, Django, Django Channels, PostgreSQL, React, Docker.
Questions about this project? Email me.