Delivered remotely for a business based in Sydney, Australia. Names withheld by agreement.
Project Overview
Readers expect news and video apps to open instantly on a morning train, transition seamlessly from headline alerts into full stories, and play video bulletins without stuttering. When a digital publisher relies on embedded HTML webviews inside a thin mobile shell, every editorial tweak risks layout breakage, third-party scripts block rendering, and breaking-news traffic spikes easily overwhelm backend CMS servers.
We engineered a native mobile publishing platform consisting of Kotlin (Android) and Swift (iOS) applications backed by a JavaScript headless CMS API, adaptive HLS video delivery, and Firebase push orchestration. Editorial teams author articles and video packages once as typed content blocks, preview drafts directly inside native mobile views, and distribute breaking alerts that land readers straight inside fast, edge-cached stories.
Business Bottleneck
The publisher's earlier mobile distribution pipeline suffered from three recurring constraints:
- Brittle HTML parsing in webviews: Arbitrary markup copied from web CMS editors introduced broken image aspect ratios, orphaned video embeds, and sluggish scroll behaviour on mobile handsets.
- Thundering-herd push outages: Every major breaking-news alert sent thousands of readers tapping notifications within seconds, slamming origin CMS databases with uncached article fetches.
- Fragmented video and editorial workflows: Video clips lived on separate player pages detached from written reporting, forcing awkward in-app browser redirects that caused readers to abandon sessions.
Architectural Strategy
Instead of shipping presentation HTML over the wire, we redesigned the JavaScript headless CMS layer to emit a strict, versioned JSON block schema—representing headlines, body paragraphs, pull quotes, image carousels, inline video players, and related-story cards cleanly. On Android, Retrofit deserializes these blocks into native Jetpack/RecyclerView components; on iOS, Alamofire maps the exact schema into Swift native views.
To shield the JavaScript origin from breaking-news surges, every published feed and story endpoint sits behind a CDN configured with surrogate-key cache invalidation. Publishing or updating an article fires a webhook that purges only the affected story and section keys, leaving the rest of the catalog warm at the edge.
Core Capabilities
- Native Block-Based Article Reader: Structured JSON blocks render crisp typography, dynamic dark mode, swipeable photo galleries, and inline attribution cards without webview overhead.
- Adaptive HLS Video & Audio Playback: Built-in ExoPlayer (Android) and AVPlayer (iOS) integrations stream multi-bitrate video bulletins with background audio continuity and picture-in-picture support.
- Topic-Driven Breaking Alerts: Readers subscribe selectively to editorial beats managed through Firebase Cloud Messaging, tapping notifications that deep-link straight to the target story or live video stream.
- Saved Offline Reading Queue: Subscribers bookmark long-form features for underground commutes; local persistence retains story JSON and compressed hero imagery for offline access.
- Pre-Publish Mobile Draft Preview: Journalists generate signed preview links from the JavaScript CMS to inspect typography, captions, and video thumbnails on real Android and iOS devices prior to publishing.
Technical Architecture
Both mobile clients isolate networking behind clean repository facades so UI screens never parse raw CMS quirks directly. On Android, Retrofit with OkHttp interceptors injects conditional cache headers and handles transient socket retries; on iOS, Alamofire RequestInterceptor pipelines mirror those exact authentication, preview-token, and retry policies.
Flow: Editor publishes structured story in JavaScript CMS -> Webhook purges CDN surrogate keys & triggers Firebase Cloud Messaging topic push -> Reader taps alert -> App Link / Universal Link opens native screen -> Retrofit / Alamofire fetches edge-cached JSON blocks & HLS manifest -> Native Kotlin/Swift UI and video player render story.
When a breaking story receives rapid live-blog updates, lightweight polling or notification-triggered refreshes fetch compact delta blocks by revision ID rather than reloading unchanged media assets.
Technology Stack
| Category | Technology detail |
|---|---|
| Android client | Kotlin with native RecyclerView/Compose structured article renderers |
| Android networking | Retrofit with OkHttp disk cache, interceptors, and retry backoff |
| iOS client | Swift with native article block views and smooth gesture navigation |
| iOS networking | Alamofire Session manager with request adapters and response caching |
| Headless CMS & API | JavaScript (Node.js) structured content API and webhook publisher |
| Push & analytics | Firebase Cloud Messaging topic subscriptions and Firebase Analytics events |
| Video delivery | Adaptive bitrate HLS streams played via native ExoPlayer and AVPlayer |
| Edge caching | CDN caching with surrogate-key invalidation on editorial publish |
| Deep linking | Universal Links and Android App Links linking push, web, and native screens |
| Offline reading | Local article JSON and hero-image persistence for saved stories |
| Editorial preview | Signed draft-token API mode rendering unpublished stories on test devices |
Engineering Trade-offs & Solutions
| Architectural Dilemma | Chosen Solution & Rationale |
|---|---|
| Embedded HTML webviews vs. JSON block native rendering | Adopted a typed JSON block schema rendered natively in Kotlin and Swift, trading upfront component work for fluid scrolling, dark-mode fidelity, and predictable inline video playback. |
| Direct origin API reads vs. CDN surrogate-key caching | Placed an edge cache in front of the JavaScript CMS API with publish-triggered purges, ensuring breaking-news push spikes hit edge nodes instead of backend databases. |
| Custom media player vs. native ExoPlayer / AVPlayer | Integrated platform-standard HLS players via Kotlin and Swift abstractions to inherit OS picture-in-picture, lock-screen controls, and adaptive bitrate switching reliably. |
| Static push topics vs. CMS-driven channel registry | Served notification categories from the headless API so editorial desks can launch temporary event feeds without shipping mobile app updates. |
Security & Reliability
Draft articles and embargoed investigations must never leak onto public CDN edges. Preview requests require short-lived cryptographic tokens validated in the JavaScript API and carry Cache-Control: private, no-store headers so intermediary caches never retain unpublished copy.
Push notification dispatch endpoints verify editorial role permissions and enforce duplicate-send guards so an accidental double-click in the CMS dashboard cannot broadcast duplicate breaking alerts to readers. On the client side, graceful block fallbacks ensure that if the editorial team introduces an experimental embed type ahead of an older app release, Retrofit and Alamofire skip or link-card the unknown block cleanly rather than crashing the article view.
Performance & Scale
News feeds load paginated, lightweight summary cards first while deferring full article payloads and high-resolution galleries until selection or smart pre-fetch triggers. Both OkHttp and Alamofire disk caches serve stale-while-revalidate snapshots immediately on cold launch, presenting yesterday's cached front page within milliseconds while refreshing headlines quietly in the background.
Video thumbnails and article hero imagery request width-tailored variants from an image-resizing CDN matching the handset's pixel density, avoiding wasted cellular megabytes while keeping visual sharpness intact across tablets and phones.
Operational Outcomes
Transitioning from webview shells to a headless JavaScript API powering native Kotlin and Swift readers unified the editorial and video experience under one responsive interface. Newsroom staff gained confidence through exact mobile draft previews, push-notification surges stabilized behind edge caching, and mobile readers received reliable offline access and adaptive video playback tuned for daily commuting conditions.