Software Requirements · Dev Needs & Infrastructure · March 2026

Software Development & Infrastructure Analysis

AI Story Companion Ecosystem — Functional requirements, technology stack, infrastructure architecture, and AI API cost estimates.

1. Functional Software Requirements

1.1 Device / Embedded Requirements

IDRequirementPriorityComponent
D-01System must detect wake word with <500ms latency in ambient noise up to 60dBMUSFirmware
D-02ASR must transcribe child speech with >90% accuracy (ages 4–10)MUSFW + Cloud
D-03Device must operate in offline mode for basic storytelling (pre-cached stories)MUSFW
D-04OTA firmware update must complete without user interaction; rollback on failureMUSFW + DevOps
D-05Device must boot to ready state in <15 secondsSHOFW
D-06Audio output must support stereo at ≥48kHz / 16-bitMUSFW
D-07Camera must capture 1080p at 30fps for personalisation featuresSHOFW
D-08BLE pairing must complete within 30 seconds with mobile appMUSFW + Mobile
D-09Battery must support minimum 4 hours continuous playbackMUSHW + FW
D-10LED ring must animate in sync with story events (<100ms latency)SHOFW
D-11All microphone audio must be processed and discarded; never storedMUSFW + Cloud
D-12Device must support projection sync with DreamDome over Wi-Fi (<200ms)SHOFW

1.2 Cloud Backend Requirements

IDRequirementPriorityComponent
C-01Story generation API must return first audio chunk in <800ms (p95)MUSStory Orchestrator
C-02System must enforce child-safe content at every LLM outputMUSSafety Service
C-03All child data must be stored encrypted at rest (AES-256)MUSAll services
C-04System must support horizontal auto-scaling to 100K concurrent devicesMUSInfra / K8s
C-05Parent can delete all child data; deletion propagates within 30 daysMUSAll services
C-06Story memory must persist across sessions and be retrievable by child IDMUSMemory Service
C-07Music engine must produce contextually appropriate audio within 2sMUSMusic Service
C-08Illustration engine must generate scene image within 5 secondsSHOIllustration Svc
C-09System must support multi-language TTS (min: EN, FR, DE, ES at launch)SHOTTS Service
C-10API must return structured error codes; no raw exceptions to clientMUSAPI Gateway
C-11All API endpoints must require authentication; no unauthenticated accessMUSAuth Service
C-12System must log all safety filter triggers for audit and reviewMUSSafety Service
C-13Sleep motion data must be anonymised before analytics processingMUSAnalytics Svc

1.3 Mobile App Requirements

IDRequirementPriorityComponent
M-01App must support iOS 16+ and Android 12+MUSMobile App
M-02Parent must be able to create and manage up to 5 child profilesMUSMobile App
M-03App must provide content filtering controls (themes, age level, topics)MUSMobile App
M-04App must display sleep summary with story and motion timelineSHOMobile App
M-05App must support bedtime schedule configuration with automatic enforcementMUSMobile App
M-06App must allow purchase and management of subscriptionsMUSMobile App
M-07App must work offline for settings management (sync when reconnected)SHOMobile App
M-08Push notifications for sleep summary delivery and usage alertsCOUldMobile App
M-09App must display story history and allow playback of saved storiesCOUldMobile App
Priority Key: MUS = Must Have (MVP)   SHO = Should Have (v1.0)   COUld = Could Have (post-launch)

2. Technology Stack

LayerTechnologyJustification
Embedded OSLinux (Yocto/Buildroot 2024)Minimal footprint, full control, wide hardware support
Embedded LanguagePython 3.11 + asyncioRapid prototyping, async I/O for audio/network
Wake WordPorcupine SDK (on-device)Privacy-first, no cloud dependency, <5mW
Local STTWhisper.cpp (tiny/base)Offline fallback, acceptable accuracy for simple commands
Cloud STTGoogle Cloud Speech / AWS TranscribeHigh accuracy, multi-language, child voice models
LLMAnthropic Claude 3 Sonnet (primary), GPT-4o (fallback)Safety features, quality, cost balance
OrchestrationLangChain + LangGraphNarrative state machine, tool use, memory integration
Vector DBpgvector (PostgreSQL) / PineconeStory memory, semantic search, low-latency retrieval
TTSElevenLabs (primary), Azure Cognitive Services (fallback)Natural child-friendly voices, low latency
MusicMusicGen (HuggingFace) + S3 curated libraryDynamic generation + reliable fallback
Image GenerationDALL-E 3 / Stable Diffusion XLQuality illustrations, child-safe safety filters
Backend LanguagePython 3.11 + FastAPIAsync, fast, typed, excellent ecosystem
Backend FrameworkFastAPI + Pydantic v2Auto OpenAPI docs, validation, performance
Message QueueRabbitMQ / AWS SQSAsync task dispatch for generation services
Primary DBPostgreSQL 16ACID, pgvector, mature, excellent managed options
CacheRedis 7Session tokens, TTS cache, rate limiting
Time-Series DBInfluxDB 2 / TimescaleDBSleep/motion sensor data
AnalyticsClickHouseHigh-volume anonymised event analytics
Object StorageAWS S3 / Cloudflare R2Illustrations, audio cache, firmware bins
CDNCloudflareGlobal low-latency media delivery
Container RuntimeDocker + Kubernetes (EKS/GKE)Scalable microservices, managed K8s
CI/CDGitHub Actions + ArgoCDGitOps, automated deploy, rollback
MonitoringPrometheus + Grafana + LokiMetrics, dashboards, log aggregation
AlertingPagerDuty + SlackOn-call rotation, incident management
MobileReact Native + ExpoCross-platform iOS + Android, code sharing
AuthKeycloak + JWTOIDC/OAuth2, SSO, parental consent flows
IaCTerraform + HelmReproducible infra, version-controlled deployments

3. Infrastructure Architecture

The platform is deployed on AWS (primary) with GCP as a failover/multi-cloud option. All services run containerised on Kubernetes. Environment separation: dev / staging / production.

ServiceAWS ServiceSizing (initial)Scaling
Kubernetes ClusterEKS (Kubernetes 1.30)3 × m6i.xlarge nodesAuto-scale 3–20 nodes
Relational DBRDS PostgreSQL 16db.t3.large (Multi-AZ)Read replicas at 10K DAU
CacheElastiCache Redis 7cache.t3.medium (cluster)Scale with session volume
Message QueueAmazon SQSStandard queuesManaged, auto-scales
Object StorageS3 Standard + Intelligent TieringUnlimitedManaged
CDNCloudFront + CloudflareGlobal PoPsManaged
Container RegistryECRPrivate repos per serviceManaged
SecretsAWS Secrets ManagerPer-service secretsManaged
DNS & Load BalancerRoute53 + ALBRegional ALBManaged, auto-scales
MonitoringCloudWatch + managed Prometheus WorkspaceManaged
Log AggregationCloudWatch Logs + Loki (Grafana Cloud)Retained 30 daysManaged
CI/CD RunnersGitHub Actions (managed)8-core runnersManaged
Analytics DBClickHouse Cloud (startup tier)2 shardsScale with data volume

4. AI API Cost Estimates

Assuming 20 minutes average daily usage, 30 days/month, ~1,200 LLM tokens per story exchange. Estimates at 10,000 MAD (Monthly Active Devices).

ServiceVolume / month (10K MAD)Unit CostMonthly Total
LLM (Claude Sonnet / GPT-4o)360M tokens in + 90M out$3/$15 per 1M~$4,700
STT (Google Cloud Speech)~6,000 hours audio$0.016/min~$5,760
TTS (ElevenLabs Pro)~12,000 hours audio$0.18/1K chars~$3,200
DALL-E 3 (illustrations)~200K images$0.04/image~$8,000
AWS Infra (K8s + DB + S3)Fixed + variable~$2,500
CDN + StorageMedia delivery$0.02/GB out~$800
Total estimated~$25,000/mo
Per active device~$2.50/device/mo
~64%
Gross AI+Infra Margin at 10K MAD
>75%
Margin at 50K MAD (volume discounts)
€7/mo
Premium Subscription Price
Unit Economics Note: At €7/mo Premium subscription, gross AI+infra margin is ~64% at 10K MAD. At 50K MAD, volume discounts on LLM and STT push margin above 75%. Cost per device reduces significantly with local model upgrades for TTS and simple ASR tasks.