Back to work

Personal Project · Next.js · Web Audio API

EMDR / ART Self-Guided Experience

A free, browser-based guided self-regulation tool. No backend, no accounts, no data collection. Evidence-based bilateral stimulation techniques available to anyone with a browser and headphones.

EMDR and ART therapy can cost $150 to $400 a session, with waitlists running months in most cities. The clinical evidence for both is solid. I wanted those techniques available to people who can't get on a waitlist or afford the sessions.

The no-backend, no-account design wasn't an afterthought. Mental health session data is unusually sensitive. There's nothing here to breach, subpoena, or sell. State lives in the browser and disappears when you close the tab.

The app implements resource-building from EMDR, image rescripting from ART, and a hypnotic meditation built on 40 layered techniques across audio, visual, language, breathing, and body-based categories.

Next.js 14Web Audio APIWeb Speech APIElevenLabsFramer Motion57 tests

Four modes

EMDR

Safe place, butterfly hug, container, resource installation. Each paired with bilateral eye movements.

ART

Select a stressful scene, process with fast bilateral movements, rescript it. Loops until distress drops below 2.

Meditation

Hypnotic induction, binaural tones deepening from theta to delta over 30 minutes, breathing sync, anchoring.

Lateral

Fully adjustable bilateral dot: speed, binaural frequency (0-40 Hz), pink noise, all live via sliders.

Guided meditation mode

Lateral mode with live controls

Engineering decisions

Real-time audio synthesis, no sound files

The entire soundscape (binaural beats, pink noise, isochronic pulses, sub-bass heartbeat, breath-cue chimes) is generated in-browser with the Web Audio API. No pre-recorded audio for the sound engine. ElevenLabs MP3s handle narration only, with Web Speech API as fallback.

Async narration chain with cancellation

Each narration cue returns a Promise that resolves when audio finishes. Sessions chain cues with async/await, guaranteeing each phrase completes before the next begins. Phase transitions cancel cleanly mid-chain without cutoffs or race conditions.

Distress-gated session flow

SUD (Subjective Units of Distress) scores gate entry, pace ART processing rounds, and trigger an adverse event protocol at 10. If distress spikes, the session exits immediately, runs a grounding exercise, and lands on a crisis resources page. No navigation away until the user is ready.

57 tests on safety-critical paths

The test suite covers session state transitions, audio timing, SUD gate thresholds, and the adverse event protocol. The paths that matter most are all tested: what happens when distress spikes mid-session, whether phase transitions cancel without cutoffs, and whether the crisis page renders and holds correctly.

Safety design

Consent gate before every session

Crisis resources on adverse event exit

Every session starts with a consent gate and a baseline SUD check. You can't enter a processing session if your starting distress is already high. During ART, the score is checked after each bilateral set.

If distress hits 10 at any point, the session exits immediately, runs a grounding exercise, and holds on the crisis resources page. There's no button to skip past it and no way to navigate away. If someone is in acute distress mid-session, the UI shouldn't be another problem they have to solve.