ORTH App
AI-powered agronomy assistant with real-time streaming responses, audio playback, and clean architecture.
Overview
ORTH is an AI-powered agronomy assistant built at Aydi Technologies. It connects farmers with real-time AI-driven crop advice through a Flutter mobile app backed by a NestJS API.
The Challenge
Farmers in Egypt often lack immediate access to expert agronomic knowledge. The goal was to build a mobile app that delivers real-time, AI-generated crop advice — with audio playback so users don't need to read long responses while out in the field.
My Role
Flutter Mobile Developer — owned the full mobile codebase, architecture decisions, and real-time streaming implementation end-to-end.
Architecture & Technical Decisions
State Management → Cubit + Freezed
Each feature is isolated into its own Cubit with Freezed union states (initial, loading, success, error). This keeps UI logic thin, states exhaustively handled, and the codebase easy to test and extend as new AI features are added.
Real-time AI Streaming → Socket.IO + StreamController
Rather than polling, ORTH uses a persistent Socket.IO connection. The Flutter client listens to socket events and feeds chunks into a StreamController<String>, which a StreamBuilder widget consumes to render text progressively — giving users a ChatGPT-style typing effect.
Audio Playback — Lifecycle & Interruption Management
AI responses are converted to audio server-side and streamed to the device for playback. The engineering challenge wasn't playback itself — it was reliability in the field: a phone call mid-session, a notification, or navigating away could corrupt state or leak resources.
I handled this by managing the audio session lifecycle explicitly: acquiring audio focus before playback begins, releasing it when done or interrupted, and hooking into the app's lifecycle events to tear down the player cleanly on navigation. Interruptions (calls, other media apps) are handled gracefully — playback pauses and resumes correctly rather than silently failing.
Key Features
- Real-time streaming AI responses with progressive text rendering
- Text-to-speech audio playback with playback controls
- Clean Architecture with strict layer separation (data → domain → presentation)
- Offline-aware error states with retry logic
- GetIt dependency injection for fully testable service layer
Results
- Live on App Store & Google Play
- Used by farmers across Global for crop diagnosis and advice