How nicksheaharty/bedsidekick-app works
Project type and purpose
• BedSidekick is an embedded Node.js–based IoT application running on a Raspberry Pi.
• It’s primarily a hardware-software system providing real-time conversational AI, voice I/O, and visual feedback on an LCD.
File structure
• Top level:
• .env / package.json / README.md – environment/config
• public/index.html – optional web interface or status page
• src/ – TypeScript/JavaScript source
• src/services/ – AudioService, ElevenLabsService (TTS), GeminiService (AI chat)
• dist/ – transpiled output mirroring src for deployment on the Pi
• No database directory, no web-framework folder (so this is not a classic full-stack web app but an embedded service)
• Hardware interfaces (LCD, microphone, speaker) are accessed via service modules, possibly using native Python bindings or Node packages
README for additional insights
• External systems:
• Google Gemini API for conversation
• ElevenLabs API for voice synthesis
• Hardware:
• USB microphone → Audio input
• Speaker → Audio output
• I2C LCD → Display
• Core features:
• AI conversation loop
• Mood/emotion monitoring
• Alerting caregivers (future or via API)
• HIPAA-compliant data handling (local encryption)
Main components & their interactions
a. Hardware layer (on the Raspberry Pi):
– Microphone (audio in)
– Speaker (audio out)
– LCD display (I2C)
b. Application layer (Node.js processes):
– AudioService
• Captures raw audio from mic
• Sends for speech-to-text (if implemented) or handles audio buffering
– GeminiService
• Sends text to Google Gemini
• Receives AI response (text + emotion metadata)
– ElevenLabsService
• Takes AI text + voice ID
• Calls ElevenLabs API to synthesize speech audio
– LCDService
– Controller / Orchestrator (index.js)
• Coordinates the audio → AI → TTS → play-back loop
• Monitors mood scores, triggers alerts if thresholds exceeded
c. External services (cloud):
– Google Gemini API (chat + emotion inference)
– ElevenLabs API (TTS)
Architectural patterns & design principles
• Modular service-oriented layers: each external integration encapsulated in its own service module
• Single process, event-driven orchestration (Node.js)
• Hardware abstraction: treat mic, speaker, LCD as pluggable modules
• Separation of concerns: AI logic vs TTS vs display vs I/O