ENGINEERING CASE STUDY

pwE (Pray With Me) — Global Production Ecosystem & Edge AI

†

pwE Ecosystem & Interactive Technical Portal

Explore the live production engineering in depth with C4 model diagrams, sequence flows, refactoring logs, 79 ADRs, real code slices in the GitHub Showcase, and an interactive API console (Swagger), or visit the official Google Play Store listing and Web App.

Access Interactive Documentation (79 ADRs) → Available on Google Play ↗ GitHub Showcase (20 Slices & ADRs) ↗ 📖 Guide: Flutter 3.50 Migration → ★ Featured: Google Play Go-Live → Official Showcase (Landing Page) ↗ Live Web App (/app) ↗

pwE (Pray With Me) is a premium digital companion and private sanctuary for the practice of Lectio Divina (Prayerful Reading), built in strict adherence to Catholic Doctrine, the 73-book Biblical Canon, and an official copyright licensing agreement with Edições CNBB (ADR 0079). Live in global production on the Google Play Store (177 countries, official Go-Live on November 2, 2026) and on the Web (pwe.jhhsolutions.dev/app), the project serves as my flagship showcase of advanced cross-platform software engineering (Android, iOS, and Web): a Flutter 3.50.0 / Dart 3.14.0 ecosystem combining modular Clean Architecture, On-Device Artificial Intelligence (Gemma 4 via LiteRT-LM with native token streaming), Dual AI with On-Device RAG (TFLite/MiniLM), Zero-Knowledge Security (AES-256-GCM) & Zero-Key Cloud Proxy (Cloud Run + App Check), 0 ms True Local-First offline boot, a single pure-Dart liturgical engine shared with Cloud Run Jobs + GCS Static CDN (>98% offload) across 18 languages, 360° theological and operational observability (Langfuse OTLP v4 + GA4 GitOps), and engineering governance powered by 18 specialist Google Antigravity AI agents, 16 executable SDD specifications (SPEC-*), and 79 formal ADRs.

pwE — Pray With Me: Digital Sanctuary for Lectio Divina

Architecture & Software Engineering

  • Bleeding-Edge Platform (Flutter 3.50.0 & Dart 3.14.0): Coordinated platform upgrade achieving zero outdated packages (flutter pub outdated), hardened Android native toolchain (Gradle 9.5.0, AGP 9.3.1, Kotlin 2.4.20, and compileSdk = maxOf(flutter.compileSdkVersion, 37)), authentication migrated to google_sign_in ^7.2.0 over Credential Manager API (Android) and GIDSignIn 9 (iOS) with idempotent initialization and OIDC idToken, alongside FlutterFire v7 and RevenueCat v11.
  • Clean Architecture + Modular DDD at Scale (513 .dart files in lib/): Strict boundary isolation between an agnostic lib/core/, a pure Domain layer (zero dependencies on UI, Flutter, or Firebase), 56+ UseCases, typed Repositories, and a de-monolithized Presentation Layer (ADR 0073). Each of the 8 features (auth, lectio_divina, onboarding, profile, recollection, preferences, subscription, support) and the security_vault module manages its own isolated dependency injection container (GetIt), preventing cross-domain leakage (ADR 0004 and ADR 0032).
  • Complete 16-BLoC Decomposition (ADRs 0015 & 0027): Architectural evolution featuring the permanent removal of the legacy monolithic BLoC and decomposition of the prayer journey into 10 cohesive, decoupled Sub-BLoCs (LectioSessionBloc, DailyLiturgyBloc, ExegesisBloc, PrayerJournalBloc, AiOratioBloc, PassageDiscoveryBloc, ModelDownloadBloc, among others), enforcing immutable state transitions via Equatable and eliminating UI race conditions.
  • 0 ms True Local-First Cold Start & Interior Recollection Mode (ADRs 0060 & 0062): Deterministic offline-resilient startup backed by a network circuit breaker, transactional offline outbox, and 22 bundled .ttf sacred fonts. At the native OS layer, Interior Recollection Mode (Mt 6:6) integrates Android 15+ AutomaticZenRule / ZenPolicy and iOS 16+ Focus Filters with a 4-layer Zero-Orphaned-DND safety protocol so system notifications are reliably restored even after abrupt app termination.
  • 100% SDD + TDD Governance & Autonomous Runtime Validation (ADRs 0034, 0050 & 0064): Governed by 18 specialist AI agents and 16 executable SPEC-* contracts, featuring the perf-validator subagent performing live runtime inspection via Marionette and Dart MCP on physical hardware (validated on Android 16/17 with PSS memory profiling and zero runtime errors).
  • Reactive Routing & Functional Error Handling: Powered by GoRouter across 16 declarative sacred routes, single-door Progressive Visio Divina Onboarding (A1 → A2, ADR 0067), and strict functional error handling with dartz (Either<Failure, Success>).

Artificial Intelligence & Machine Learning (Edge-First)

The core technical differentiator of pwE is its hybrid AI strategy with privacy by design and audited theological observability:

  • Gemma 4 E2B with Native Token Streaming (ADRs 0005 & 0065): Local smartphone inference powered by LiteRT-LM via native Kotlin JNI (Android) and Swift C API (GemmaInferencePlugin.swift on iOS), real-time EventChannel token streaming, on-device Echoes of Grace synthesis, and Android 14+ compliant background OTA downloads (FOREGROUND_SERVICE_DATA_SYNC) verified with SHA-256 checksums.
  • Dual AI & On-Device RAG: Long-term spiritual memory generating vector embeddings 100% on-device via TFLite (all-MiniLM-L6-v2, 384 dimensions), native WordPiece tokenization (BertTokenManager), and adaptive Mean Pooling — with zero private spiritual notes ever leaving the device.
  • Gemini Staircase, Langfuse OTLP v4 & Dogmatic LLM Eval (ADRs 0046 & 0065): Resilient cloud fallback parameterized via Zero-Public-URL Firebase Remote Config (14/14 versioned prompts), Smart Retry, and an automated 30-scenario Dogmatic Eval suite across the 73-book Catholic Canon — sustaining a 100.0% theological orthodoxy score in production.
  • Transparency, Explicit Consent & Fading Scaffolding (ADRs 0025, 0033 & 0035): Visual Golden Shield indicator for 100% local inference, strict explicit opt-in prior to cloud calls, native "Flag this passage" reporting aligned with Google Play's Generative AI policy, and adaptive verbosity reduction (Beginner → Practitioner → Contemplative).
  • Two-Column Biblical OCR (ADR 0065): Offline digitization using Google ML Kit Vision, native Canvas adaptive binarization, geometric two-column page reconstruction, and lexical correction.

Zero-Knowledge Security, Zero-Key Proxy & Official CNBB Licensing

  • Zero-Key Cloud Run Proxy + Firebase App Check (ADR 0072): Complete elimination of client-side AI API secrets; all cloud inference requests route through a dedicated serverless Cloud Run proxy verified with Firebase App Check tokens and strict Firestore allowlist rules.
  • AES-256-GCM Rest Encryption & Zero-Loss Account Linking (ADRs 0026, 0029, 0032 & 0076): Entries in the Spiritual Notebook are encrypted at rest in Hive and per-field in Cloud Firestore using AES-256-GCM, 96-bit random IVs, PBKDF2 key derivation, Android Keystore / iOS Keychain anchoring, an optional passphrase vault (wrapped:v3), and Zero-Loss late linking of guest sessions — protecting 190+ active production vaults.
  • Official Edições CNBB Licensing & AndroidManifest Hygiene (ADRs 0042, 0043, 0057 & 0079): Formal copyright licensing contract signed with the National Conference of Bishops of Brazil (CNBB) featuring adaptive monochrome official branding (CanonicalCreditFooter), explicit tools:node="remove" stripping of transitive permissions (AD_ID, READ_PHONE_STATE, STORAGE), dynamic runtime FLAG_SECURE (ADR 0044), and cryptographic purging at delete-account.

Cloud-Native Infrastructure, Shared Pure-Dart Engine & Live Day-2 Operations

  • Shared Pure-Dart Liturgical Engine & 18-Language GCS Static CDN (ADRs 0041, 0047, 0069 & 0074): Shares a single canonical pure-Dart engine (package:pwe/core/liturgy/liturgical_engine.dart) between the Flutter app and the AOT-compiled native worker (FROM dart:3.14.0-sdk) on Cloud Run Jobs, publishing static JSONs, precomputed sacred audio, and WebP Sacred Icons (Veni Creator) to GCS Static CDN, keeping live production consumption at just 4.11% of Firestore's daily free-tier read quota ($0/month infrastructure bill).
  • Pastoral Communion ("Pray With All") & Ethical PPP Across 174 Regions (ADRs 0009, 0048, 0056 & 0078): Manages Mission Friends via native RevenueCat SDK v11 + Web Billing REST v1, canonical Pray With All / Integrated Journey vocabulary enforced by automated static guards, and pwe_monetization_sync.dart provisioning 54 localized listings (3 plans × 18 languages) across 174 countries using PPP and a 30-day prepaidBasePlanType.
  • Zero-CI CLI Tooling, 360° Monitor (5-Act MECE) & Privacy-First Attribution (ADRs 0049, 0051, 0063, 0077 & v1.0.56):
  • tool/pwe_local_deploy.dart: Builds obfuscated .aab bundles, uploads Crashlytics symbols, and publishes via native RS256 JWT directly to the Google Play Android Publisher API v3 in ~3 minutes at zero CI cost;
  • tool/pwe_production_monitor.dart & tool/pwe_ga4_admin_sync.dart: $0/month 360° executive monitor in 5 MECE Acts with O(Δ) delta sync, 3-layer internal bench segregation (Firestore, GA4, and RevenueCat v2), declarative GA4 GitOps provisioning (33 Custom Dimensions, 6 Custom Metrics, 10 Key Events, 9 Audiences), and cookie-free campaign attribution (UTM + Play Install Referrer);
  • tool/sync_showcase.dart (ADR 0051): Strict Allowlist orchestrator (guarded by a 16-rule Redaction Engine + 13-pattern Security Leak Scanner) syncing the public pwe-architecture-showcase repository, exposing ADRs, 8 C4/Mermaid specs, 18-agent governance, and 20 real Clean Code Slices (*.dart + *_test.dart) across 5 domains.

Quality, Real Production Telemetry & Internationalization

  • 1,778+ automated tests across 260 test suites (*_test.dart), featuring deterministic global preloading of all 22 static fonts in test/flutter_test_config.dart on Flutter 3.50, validated across a 6-viewport canonical matrix (360×640 to 1920×1080) with TextScaler up to 2.0x and 8.10:1 WCAG AA contrast.
  • Live Global Production Telemetry (Nov 2, 2026+): 99.07% organic Crash-Free Sessions, zero Crash/ANR alerts in Google Play Android Vitals, 5.0 ★ store rating, 440+ active users across 18+ countries and 37+ distinct physical Android models, averaging 17.2 min of engaged time per user (70.0% engaged rate).
  • Deterministic 18-Language Internationalization (ADR 0068): 1,013+ audited ARB keys per catalog (ar, de, en, es, fr, hi, it, ja, ko, la, nl, pl, pt, sw, tl, uk, vi, zh), bundled with enableSplit = false and locales_config.xml for instant in-app switching without Play Feature Delivery split loss.

Status: Version 1.0.56+232 (211+ releases) — Live in global production on the Google Play Store (177 countries, 5.0 ★ rating and 99.07% Crash-Free), Public Web App (pwe.jhhsolutions.dev/app), and Public GitHub Showcase (github.com/evslopes/pwe-architecture-showcase), featuring official Edições CNBB licensing, 260 test suites (1,778+ tests), 79 formal ADRs, 16 executable SDD specs, and 18 Antigravity specialist agents (November 2026).