DEV Community

Cover image for Resonance
Walid Ibrahim
Walid Ibrahim

Posted on Edited on

Resonance

This is a submission for the Presage SmartSpectra SDK Challenge

https://resonance-biofeedback-experience--cyberwalsal201.replit.app/

What I Built

I wrote the two Replit prompts. Replit Agent builds the app itself from them, so none of the Replit app code exists yet. The Python backend rules I did write and test are reused inside it.

Front end (prompt 2, /client: React + Vite + Tailwind)

Experience: the same calm, full-screen experience as the Lovable version. A glowing orb pulses at your heart rate, a breathing guide slows you toward about 6 breaths per minute, and colours and sound shift as you relax. There are also a live Resonance score, a coaching line, a “Why this?” panel and a recap with charts.
Vitals sources:
Demo: simulated signals, works with no backend.
Cloud camera: shown only if the server reports it is available. It asks for consent, then streams webcam JPEG frames to your Repl.
Local bridge: an optional program on your own computer.
Coach calls: it sends requests to its own server (/api/coach/*). If the coach is slow or down, built-in rules take over.

Back end (prompt 1)

Node server (/server): the only public process. It does three things:
serves the built front end;
runs the SmartSpectra Node SDK server-side on camera frames and sends back pulse, breathing, HRV and expression;
checks coach requests and forwards them to the Python service.
Safeguards: it limits concurrent sessions, enforces consent, never stores or logs frames, and shows “cloud camera unavailable” instead of crashing if the SDK can’t load on Replit.
Python CrewAI service (/crew): reachable only from inside the Repl. It runs the three-agent coach and the recap writer. Code-enforced safety rules limit the pace change, block medical wording and compute the recap numbers, and a rule-based fallback answers if the AI fails.
Secrets (Replit Secrets): SMARTSPECTRA_API_KEY, OPENAI_API_KEY (or another provider’s key) and an internal shared key.

Top comments (0)