SpeakTrue

SpeakTrue Unified Engineering Manual

Last updated: 2026-06-29

This is the canonical first-contact document for new engineers joining SpeakTrue. It is intended to answer: what each surface does, what each file owns, where to edit for a requested change, and how to deploy or triage issues safely.

0) What this guide covers

If you need a complete file-by-file catalog, use:

For backend endpoint-level behavior:

1) Read this first in this order

  1. README.md
  2. AGENTS.md
  3. docs/index.md
  4. docs/contracts/native-speech-parity-anchor.md
  5. docs/contracts/speech-workflow-contract.md
  6. docs/reference/repository-unified-engineering-manual.md (this file)
  7. docs/reference/ios-file-inventory.md
  8. docs/reference/android-file-inventory.md
  9. docs/reference/web-file-inventory.md
  10. docs/reference/backend-functions-detailed-map.md
  11. docs/reference/backend-functions-deep-dive.md
  12. Relevant runbooks in docs/ops/*

2) Golden source-of-truth stack

3) Repository architecture in one screen

4) iOS reference map (complete ownership is in inventory)

4.1 Critical startup and app shell

4.2 Auth, configuration, and contracts

4.3 Speech engines and generation surfaces

4.4 Soundboard

4.5 Voice clone and pronunciation

4.6 Shared UI and utilities

4.7 iOS tests and generated artifacts

For file-level iOS inventory and descriptions, use docs/reference/ios-file-inventory.md.

5) Android reference map (complete ownership is in inventory)

5.1 App shell and navigation

5.2 Core platform modules

5.3 Feature modules

5.4 Build and tests

For file-level Android inventory and descriptions, use docs/reference/android-file-inventory.md.

6) Web reference map (complete ownership is in inventory)

6.1 Marketing surface

6.2 Legacy runtime and compatibility

6.3 Web deployment and runtime assets

For complete web file inventory and detailed ownership, use docs/reference/web-file-inventory.md.

7) Backend map: functions and blast radius

7.1 Functions by contract, blast radius, and default callers

Route Surface Files Status What this changes Primary test points
/account-delete auth/account backend/supabase/functions/account-delete/* implemented deletes user account and related resources backend/supabase/functions/account-delete/*_test.ts
/billing-apple-sync billing backend/supabase/functions/billing-apple-sync/* partial/legacy updates entitlement state from Apple sync payloads .../logic_test.ts, function tests
/billing-apple-notifications billing backend/supabase/functions/billing-apple-notifications/* implemented applies webhook events to entitlements .../handler_test.ts
/billing-google-play-sync billing backend/supabase/functions/billing-google-play-sync/* implemented validates Play payload and persists subscription state google-play-verifier_test.ts, handler tests
/billing-stripe-webhook billing backend/supabase/functions/billing-stripe-webhook/* implemented verifies signatures and dispatches billing events dispatch_test.ts, signature_test.ts, logic_test.ts
/bug-report-submit support backend/supabase/functions/bug-report-submit/* implemented captures support payloads for triage handler_test.ts
/byok-resolve settings/provider backend/supabase/functions/byok-resolve/* implemented resolves BYOK status with secret-safe response handler_test.ts
/byok-upsert settings/provider backend/supabase/functions/byok-upsert/* implemented upserts BYOK capability state handler_test.ts
/clip-order-batch soundboard backend/supabase/functions/clip-order-batch/* implemented persists category/clip ordering payloads handler_test.ts
/language-recommend STS quality backend/supabase/functions/language-recommend/* implemented returns language recommendation payloads handler_test.ts
/models-list voices/models backend/supabase/functions/models-list/* implemented returns model catalog after filtering handler_test.ts
/voices-list voices/models backend/supabase/functions/voices-list/* implemented returns voice catalog after private/public filtering handler_test.ts
/pronunciation-dictionary quality backend/supabase/functions/pronunciation-dictionary/* implemented CRUD and retrieval for pronunciation dictionary handler_test.ts
/quota-status settings/feature-gating backend/supabase/functions/quota-status/* implemented returns usage + limit envelope for clients handler_test.ts
/soundboard-save-generated soundboard backend/supabase/functions/soundboard-save-generated/* implemented persists generated clip metadata + storage keys handler_test.ts
/soundboard-delete soundboard backend/supabase/functions/soundboard-delete/* implemented deletes soundboard artifacts and storage objects handler_test.ts, delete_storage_error_test.ts
/soundboard-clip-ingest soundboard directory scaffold scaffold only migration placeholder; no handler behavior yet none (intentional scaffold)
/stt-transcribe STT backend/supabase/functions/stt-transcribe/* implemented validates + forwards STT job + response normalization capture_test.ts, validation_test.ts, handler_test.ts
/sts-near-realtime-session STS backend/supabase/functions/sts-near-realtime-session/* implemented starts near-realtime session lifecycle handler_test.ts
/sts-realtime-session STS backend/supabase/functions/sts-realtime-session/* implemented creates active realtime session context handler_test.ts
/sts-realtime-finalize STS backend/supabase/functions/sts-realtime-finalize/* implemented finalizes session and returns artifact contract handler_test.ts
/sts-live-voice-tts-session STS backend/supabase/functions/sts-live-voice-tts-session/* implemented starts live STS voice-to-speech session handler_test.ts
/sts-live-interpreter-session STS (future) backend/supabase/functions/sts-live-interpreter-session/* scaffold only future migration target; no active production behavior none
/sts-live-interpreter-tts-session STS (future) backend/supabase/functions/sts-live-interpreter-tts-session/* scaffold only future migration target; no active production behavior none
/style-presets presets/settings backend/supabase/functions/style-presets/* implemented fetch/update style preset records handler_test.ts
/tts-generate TTS generation backend/supabase/functions/tts-generate/* implemented policy + provider + artifact metadata + error normalization policy_test.ts, pronunciation_test.ts, handler_test.ts
/user-settings-get settings backend/supabase/functions/user-settings-get/* implemented reads settings with safe defaults handler_test.ts
/user-settings-update settings backend/supabase/functions/user-settings-update/* implemented updates settings with patch validation handler_test.ts
/voice-clone-preflight voice clone backend/supabase/functions/voice-clone-preflight/* implemented validates clone readiness constraints validation_test.ts, handler_test.ts
/voice-clone-create voice clone backend/supabase/functions/voice-clone-create/* implemented creates clone and records audit telemetry validation_test.ts, telemetry_test.ts, handler_test.ts
/voice-clone-delete voice clone backend/supabase/functions/voice-clone-delete/* implemented deletes clone and provider-side references validation_test.ts, handler_test.ts
/waitlist-signup marketing backend/supabase/functions/waitlist-signup/* implemented stores deduplicated waitlist entries handler_test.ts

7.2 Shared backend modules to review for any backend edit

8) “Change X” matrix (exact edit map)

Change request iOS files Android files Web files Backend / migration files Tests
Update TTS policy, voices, model filters, pronunciation behavior ios/SpeakTrue/AIProxyService.swift, TTSViewModel.swift, TextToSpeechView.swift, TTSCatSelectView.swift, VoiceModelSelectionView.swift features/tts/data/*, features/tts/presentation/TTSViewModel.kt, features/tts/ui/TTSScreen.kt web/python-web-app/src/routes/tts.py, src/services/tts_service.py and relevant templates backend/supabase/functions/tts-generate/*, voices-list/*, models-list/*, style-presets/*, _shared/entitlements.ts, _shared/quotas.ts, _shared/usage.ts function tests, iOS TTS tests, Android TTS tests
Change STT behavior (recording, upload, transcript handling) STTViewModel.swift, SpeechToTextView.swift, AIProxyService.swift, ElevenLabsSTTService.swift features/stt/*, features/sts/presentation/STSViewModel.kt, features/sts/data/* web/python-web-app/src/routes/stt.py, src/services/speech_service.py, web/python-web-app/static/js/index_stt.js, index_sts_live_voice.js stt-transcribe/*, _shared/validation.ts, _shared/quotas.ts, _shared/usage.ts stt tests, STS tests, android/iOS speech tests
Change STS session lifecycle/finalize contract STSViewModel.swift, SpeechToSpeechView.swift, LiveVoiceSTSService.swift, RealtimeSTTService.swift, AIProxyService.swift features/sts/* web/python-web-app/src/routes/stt.py, STS JS runtimes sts-near-realtime-session/*, sts-realtime-session/*, sts-realtime-finalize/*, sts-live-voice-tts-session/*, relevant _shared/* STS session/finalize tests and feature tests
Change soundboard ordering, persistence, delete semantics SoundboardView.swift, SoundboardViewModel.swift, SoundboardCacheManager.swift, SoundboardCacheIndex.swift, AIProxyService.swift features/soundboard/ui/SoundboardScreen.kt, features/soundboard/presentation/SoundboardViewModel.kt, features/soundboard/data/* web/python-web-app/src/routes/soundboard.py, src/services/soundboard_service.py clip-order-batch/*, soundboard-save-generated/*, soundboard-delete/*, migrations touching soundboard tables soundboard tests on each surface
Change voice clone flow VoiceCloneTabView.swift, VoiceCloneViewModel.swift, AIDataSharing* files features/voiceclone/* web/python-web-app/src/routes/voice_clone.py, src/services/voice_clone_service.py voice-clone-preflight/*, voice-clone-create/*, voice-clone-delete/*, BYOK helpers clone tests + contract tests
Update settings defaults, quotas, agreements UserSettings.swift, UserSettingsSyncService.swift, settings screens, AIDataSharingAgreementService.swift features/settings/*, features/agreement/* web/python-web-app/src/routes/settings.py, src/services/user_settings_service.py user-settings-get/*, user-settings-update/*, quota-status/*, byok-* as needed, migrations for defaults settings tests and parity tests
Modify billing/entitlements billing-sensitive screens and gating checks all gating screens + core modules legacy web billing surfaces as applicable billing-apple-sync/*, billing-google-play-sync/*, billing-apple-notifications/*, billing-stripe-webhook/*, _shared/billing-entitlement-policy.ts, _shared/entitlements.ts, _shared/subscription-gating-config.ts, migrations for entitlements/gates billing tests + relevant client feature tests
Add migration or fix SQL behavior any affected model/service tests any affected feature tests any compatibility route impacted by query behavior backend/supabase/migrations/*, function handlers using affected tables regression migration scripts and relevant function/client tests
Add new backend endpoint new function folder + client adapters new API method in callsite layer compatibility route where needed backend/supabase/functions/<route>/*, migrations if schema required handler tests and client integration tests

9) Deployment and verification map

9.1 Backend + migration gates

9.2 Android build and release verification

9.3 iOS build and release verification

9.4 Marketing + legacy web verification

10) Everyday command atlas

11) Incident triage playbook

  1. Identify failing surface: iOS, Android, web, backend, migration, or infra.
  2. Map action to the function and caller path.
  3. Validate auth/session and entitlement/usage path first.
  4. Inspect touched backend function test and handler.
  5. Inspect matching iOS/Android/web caller file and state update path.
  6. Inspect SQL migration state for schema/table assumptions.
  7. Patch all affected surfaces and run focused gate commands for that area.

12) Documentation update discipline

13) Canonical docs map (this is your navigation hub)