🧩 System Architecture Overview
flowchart TD
subgraph User["🧑💻 User / Client"]
UI["React Web App\n(Select State / Play Audio)"]
end
subgraph Frontend["🌐 Frontend (React + Web Audio)"]
WA["Web Audio API\n(Local volume, filters, fade)"]
UI --> WA
end
subgraph Backend["🟣 Node.js API Gateway"]
API["Express / Fastify\n(session, feedback routes)"]
EL["🎵 ElevenLabs Music API"]
DSP["🧠 DSP Microservice (Python FastAPI)\nAdd Binaural/Isochronic Beats"]
DB["📊 Supabase / PostgreSQL\n(Session & Feedback Storage)"]
end
subgraph Infra["☁️ Cloud / Delivery"]
S3["AWS S3 / CloudFront\nStore final audio tracks"]
DOCKER["Docker Compose Stack\n(Node + DSP + DB)"]
end
subgraph FutureAI["🧬 Future Adaptive Layer"]
OPT["Bayesian Optimizer\n(tune diffHz/mixDb per user)"]
WEAR["WHOOP / Muse SDKs\n(HRV / EEG Signals)"]
end
UI -->|POST /session| API
API -->|Generate music| EL
EL -->|AI music (WAV)| API
API -->|Send to DSP| DSP
DSP -->|Processed Audio| API
API -->|Upload| S3
API -->|Return track URL| UI
UI -->|Play via <audio>| WA
UI -->|POST /feedback| API
API --> DB
DB --> OPT
OPT --> API
WEAR --> OPT
⚙️ Component Summary
Component | Stack | Purpose |
Frontend | React + Tailwind + Web Audio API | User selects state → plays generated sound. |
Backend (Node.js) | Express/Fastify + Socket.io | Orchestrates ElevenLabs API calls, DSP mixing, and session handling. |
AI Generator | ElevenLabs Music API | Creates high-quality base track for each mental state. |
DSP Microservice | Python + Pydub/Numpy | Adds entrainment (binaural/isochronic beats). |
Database | Supabase (PostgreSQL) | Stores session metadata, user feedback, and parameters. |
Storage/CDN | AWS S3 + CloudFront | Serves generated audio files. |
Optimizer (Future) | Python + skopt / bayes-opt | Adjusts entrainment patterns based on biometrics or feedback. |
Wearable Integrations (Future) | WHOOP / Muse / Apple Health | Real-time physiological signal input (HRV, EEG). |
🔄 Data Flow Summary
- State selection: User chooses Focus, Calm, Sleep, or High in the React UI.
- API call: Frontend sends
POST /session→ Node.js gateway.
- Music generation: Node calls ElevenLabs Music API → receives audio (WAV/MP3).
- Entrainment processing: Node sends audio URL + state parameters → Python DSP.
- DSP output: Python applies binaural or isochronic beats → returns processed track.
- Storage: Node uploads final track to S3/CDN and stores metadata in Supabase.
- Playback: React receives URL → plays via HTML5
<audio>+ Web Audio API effects.
- Feedback: User rates experience → POST /feedback → stored in DB.
- (Future) Adaptive engine (Bayesian) adjusts parameters based on HRV/EEG trends.
🧱 Deployment Architecture
graph LR
subgraph Docker Stack
A["Node.js Gateway (API)"] --> B["Python DSP Worker"]
A --> C["PostgreSQL (Supabase)"]
B --> D["AWS S3 Bucket"]
end
subgraph Frontend Layer
E["React Web App (Vercel/Netlify)"] --> A
end
subgraph Optional Cloud
F["Bayesian Optimizer Service"] --> A
G["WHOOP / Muse API"] --> F
end
Hosting Recommendation
- Frontend: Vercel / Netlify (fast static deploys)
- Backend + DSP: AWS ECS / Railway / DigitalOcean droplet
- DB: Supabase (managed Postgres + Auth)
- Storage: AWS S3 + CloudFront CDN
🧭 Example Parameter Presets
State | Mode | diffHz | mixDb | Fade(s) | Description |
Focus | Binaural | 10 Hz | -18 | 6 | Alpha wave for steady concentration |
Calm | Binaural | 7 Hz | -20 | 8 | Theta wave for relaxation |
Sleep | Isochronic | 4 Hz | -22 | 10 | Delta wave for deep rest |
High | Isochronic | 16 Hz | -18 | 4 | Beta wave for elevated alertness |
🗓️ Sprint Breakdown (4–6 Weeks)
Week | Milestone | Deliverables |
1 | Core setup | Repo, Docker stack, ElevenLabs API integration |
2 | DSP integration | Python microservice + presets for 4 states |
3 | React front-end | UI/UX, audio playback, feedback form |
4 | Session storage | Supabase integration + basic analytics |
5 | Adaptive loop | Rule-based adjustment (pre-optimiser) |
6 | Polishing | QA, deploy demo, prepare showcase video |
🧠 Outcome
At MVP completion you’ll have:
- A working app that generates real-time AI + neuroscience-based audio.
- Four working emotional/mental states.
- Real-time playback and feedback loop.
- A deployable demo for investors and early testers.
Would you like me to now convert this into a project specification document (with scope, tech stack, milestones, and deliverables formatted for investor or dev handover)?
It would be ready to send directly to your development team or include in your funding pack.