This document is password protected
Complete Project Truth Document · March 2026
AskTheMidwife is a UK-based digital health platform that connects new mothers with qualified NMC-registered midwives via async messaging. The NHS stops community midwife support by day 10 postpartum — we pick up where they leave off.
Three client apps connect through Firebase to a shared backend of Cloud Functions, Firestore, Storage, and external integrations.
Live on the App Store. Built with SwiftUI, MVVM architecture, Firebase backend, StoreKit 2 subscriptions. 109 Swift files totalling 25,590 lines.
| File | Lines | Purpose |
|---|---|---|
| MidwifeConversationsView.swift | 905 | Midwife-side conversation list (largest view) |
| MidwifeChatViewModel.swift | 872 | Chat state, messaging, photo/audio handling |
| ConversationDetailView.swift | 738 | Chat UI with messages, input, attachments |
| MidwifeSupportApp.swift | 529 | App entry, Firebase init, deep links, push |
| FirestoreService.swift | 490 | Core Firestore CRUD (.shared singleton) |
| SubscriptionService.swift | 420 | StoreKit 2, purchase flow, receipt validation |
| ShareConcernView.swift | 420 | New concern form with severity selection |
| OnboardingView.swift | 420 | Multi-step onboarding wizard |
| AuthService.swift | 380 | Firebase Auth, Apple Sign-In, sessions |
| HealthDashboardView.swift | 350 | Health tracking hub |
85% complete. Kotlin with Jetpack Compose, Material 3, Hilt DI, Firebase backend. 89 Kotlin files, 15,008 lines.
17 keywords, 3 severity levels (critical, high, medium). Scans all messages client-side.
M4A recording, AAC codec 44.1kHz/128kbps, max 5 min, auto-upload to Firebase Storage.
Auto-compression to max 2MB, JPEG quality 80, scales to 2048x2048. Batch upload support.
10 emoji reactions with real-time sync. Max 100 reactions per message.
React web app for midwives and admins. Real-time conversation queue, patient context, messaging, analytics, security monitoring. 37 files, 14,056 lines.
Live conversation queue with severity prioritisation, ETA calculation, red flag alerts, and one-click claiming.
6-tab security dashboard: KPIs, events, health, auth, audit chain integrity, performance metrics.
Conversation trends, response times, satisfaction scores, resolution rates. Export to CSV/PDF.
60+ automated tests covering Cloud Functions, Firestore, Storage, messaging, red flags, GDPR.
24 TypeScript files, 10,983 lines. 42+ Cloud Functions covering auth, messaging, payments, GDPR, monitoring, and more.
| Collection | Read Access | Write Access | Purpose |
|---|---|---|---|
| users/{userId} | Owner, Staff | Owner (≤50KB) | User profiles + subcollections |
| conversations/{id} | Participant, Staff | Limited fields | Chat conversations |
| conversations/{id}/messages | Participant, Staff | Create only (≤5000 chars) | Chat messages |
| midwives/{id} | Staff | Self or Admin | Midwife profiles |
| audit-logs/{id} | Admin | Functions only | SHA256 hash chain audit |
| consents/{userId}/records | Owner, Staff | Append only | GDPR consent tracking |
| conversationRatings/{id} | Owner, Staff | Owner (1-5 stars) | Star ratings & feedback |
| security-logs/{id} | Disabled | Auth users (UID match) | Security events |
Real screenshots from the live iOS app. The Android app mirrors these screens in Jetpack Compose with Material 3 styling.
Dual-layer safety system: client-side scanning (iOS + Android) and server-side Cloud Function verification. 17 keywords across 3 severity levels trigger automatic escalation.
metadata.hasRedFlag: true on message, auto-bumps unassigned conversations to severe, sends urgent Slack alert with red colour code to #askthemidwife-queue.
Consumable in-app purchases. Never expire. 45-50% gross margin.
Firebase custom claims: {role: "midwife"} or {role: "admin"}. All Firestore rules enforce role checks.
Data export (signed URL, 7-day expiry), right-to-be-forgotten deletion, append-only consent records with IP/user-agent.
Blockchain-style hash chain for tamper detection. Sequence numbering + previous hash tracking. Integrity verification on demand.
Firestore-backed per-endpoint limits. 60/min for messages, 10/hr for conversations, 1/24hr for data exports.
Separate _auditLog collection for NHS Digital Technology Assessment Criteria. Clinical safety disclaimer on launch.
Every 30 min: validate Firestore, Auth, Storage, queue stats. Heartbeat every 15 min for uptime tracking.
| Workflow | Trigger | Purpose |
|---|---|---|
| ios-ci.yml | Pull Request | Build + test iOS app |
| ios-testflight.yml | Merge to main | Deploy to TestFlight |
| firebase-hosting-pull-request.yml | Pull Request | Preview deploy web apps |
| firebase-hosting-merge.yml | Merge to main | Deploy web apps to production |
| security-gates.yml | Pull Request | Run security checks |
28 YAML test specs covering login, navigation, chat, health tracking, subscriptions, edge cases, and complete user journeys.
Firestore security rules test suite validating CRUD permissions for all 18 collections against user roles.
Cloud Function runTestSuite with 18+ integration tests: Auth, Firestore, Storage, Red Flags.
5 test notification payloads: user message, midwife reply, assignment, severe queue entry, plus send script.
Static marketing page: hero, features, pricing (£15-99/mo), blog, referral. Google Analytics + Meta Pixel.
React 19 + Vite + Framer Motion. Animated hero, pricing, phone mockup, Terms & Privacy pages.
22-slide interactive HTML presentation. Dark theme, SVG charts, keyboard/swipe navigation. Full financial model.
SEIS/EIS subscription agreement with interactive equity calculator, live cap table, shareable URL params.
Visual 1-page overview: problem, product, market, SEIS relief, 3 investment tiers (£50k-250k), ROI scenarios.
18 markdown docs: README, Setup, Deployment, Security, Testing, System Design, Financial Model, GDPR Runbook.
| Component | Files | Lines | Language |
|---|---|---|---|
| iOS App | 109 | 25,590 | Swift/SwiftUI |
| Android App | 89 | 15,008 | Kotlin/Compose |
| Dashboard | 37 | 14,056 | React/TypeScript |
| Cloud Functions | 24 | 10,983 | TypeScript |
| Firestore Rules | 1 | 428 | Rules DSL |
| Storage Rules | 1 | 80 | Rules DSL |
| Landing (HTML) | 1 | ~700 | HTML/CSS/JS |
| Landing (React) | ~15 | ~1,685 | React/JSX |
| Pitch Deck | 1 | 1,025 | HTML/CSS/JS |
| Investor Contract | 1 | 1,293 | HTML/CSS/JS |
| Investor Summary | 1 | 1,227 | HTML/CSS/JS |
| E2E Tests | 28 | ~600 | YAML |
| Scripts | 15 | ~1,500 | JavaScript |
| CI/CD | 5 | ~300 | YAML |
| TOTAL | ~327 | ~71,567 |