# NexStream Full App Audit + Competitor Comparison — 2026-05-20

Use this reference when Ray asks to audit NexStream against Cinema HD, Debrid Stream, Flix Vision, or similar streaming APKs.

## Baseline from the session

Local project path used: `/home/rurouni/nexstream`.
Remote CachyOS SSH (`raymond@192.168.1.111`) was temporarily unreachable, so the audit fell back to the local mirror and verified builds locally.

Current codebase snapshot:
- 147 Kotlin app files
- ~32,553 Kotlin app LOC
- 2 unit test files
- Stack: Kotlin, Compose for TV, Hilt, Room, DataStore, Retrofit/OkHttp, Media3, Coil, Stremio addon protocol
- Verified command: `./gradlew assembleDebug testDebugUnitTest --console=plain`
- Result after fixes: `BUILD SUCCESSFUL`

A durable project doc was written at:
`docs/NEXSTREAM_FULL_APP_AUDIT_AND_COMPETITOR_COMPARE_2026-05-20.md`

## Competitor codebase counts observed

Under `~/apk-analysis/`:
- `cinema-hd-jadx`: ~18,018 Java files
- `debrid-stream-jadx`: ~15,757 Java files
- `flix-vision-jadx`: ~12,581 Java files

Existing deliverables to cross-reference:
- `~/apk-analysis/APK_REFERENCE_AUDIT.md`
- `~/apk-analysis/IMPLEMENTATION_IDEAS_FOR_OUR_APP.md`
- `~/apk-analysis/DO_NOT_COPY_OR_USE.md`
- `~/apk-analysis/UI_UX_PATTERN_NOTES.md`
- `~/apk-analysis/PLAYER_AND_PLAYBACK_PATTERN_NOTES.md`
- `~/apk-analysis/SETTINGS_PROFILE_ADDON_PAGE_RECOMMENDATIONS.md`

## Key comparison conclusion

NexStream is architecturally strongest:
- Modern Kotlin/Compose TV/Hilt/Room/DataStore stack
- Stremio-first sourcing, not scraper sprawl
- Stronger security posture than all three competitors
- Cleaner local storage and migration discipline
- Player now competitive for Android TV basics

Competitor lessons:
- Cinema HD: coverage via huge hardcoded scraper/resolver fleet; avoid this.
- Debrid Stream: closest modern UI/profile direction; avoid dependency on forced Firebase/subscription model.
- Flix Vision: richest mature features (player, debrid cloud, M3U/live TV, remote config); learn feature ideas only, not code/server/protocol.

## P0 compile fix found during audit

The interrupted Cloud Manager implementation introduced compile errors:
1. `NexStreamNavHost.kt` missing `import com.nexstream.app.ui.screens.cloud.CloudManagerScreen`.
2. `CloudManagerScreen.kt` called nonexistent `LoadingState(message=...)`.
3. `CloudManagerScreen.kt` used `ClickableSurfaceDefaults.colors()` with non-clickable `Surface`, causing `ClickableSurfaceColors` vs `SurfaceColors` mismatch.

Fix pattern:
```kotlin
import com.nexstream.app.ui.screens.cloud.CloudManagerScreen
import com.nexstream.app.ui.components.LoadingMessage
import androidx.tv.material3.SurfaceDefaults

LoadingMessage(text = "Loading account info...")

Surface(
    colors = SurfaceDefaults.colors(
        containerColor = NexColors.Surface,
    ),
) { ... }
```

Avoid unused tv-material imports (`ClickableSurfaceDefaults`, `Border`, `BorderStroke`) unless actually used.

## Gaps prioritized after comparison

### P0 — cleanup
- Commit Cloud Manager compile fix.
- Add Settings → Debrid Cloud navigation entry.
- Consider removing empty compatibility files (`CacheEntry.kt`, `CacheDao.kt`) only in a clean build-verified cleanup pass.

### P1 — player parity
- Subtitle offset controls.
- Subtitle encoding selector.
- Preferred subtitle/audio language behavior.
- Aspect ratio toggle.
- Remote FF/RW/play-pause handling verification on real TV.
- FireTV low-memory buffer profile.
- Subtitle cache + clear subtitle cache setting.

### P2 — real Debrid Cloud Manager
- List torrents/transfers for RD/AD/PM/TorBox.
- Drill into torrent files.
- Play selected cloud file through existing player path.
- Refresh/delete actions.
- Add magnet/torrent later if desired.

### P3 — search/discover
- Persist recent searches.
- Add TMDB people search.
- Add Discover/Filter route with genre/year/rating/sort.
- Add hide unreleased toggle from release date metadata.

### P4 — settings/profile depth
- Profile-specific default quality, subtitle language, audio language, autoplay.
- Cache size display and clear actions.
- Changelog/update screen.
- Full backup/restore UI expansion.

### P5 — TV polish
- Screensaver slideshow.
- Long-press remove from Continue Watching.
- Row reorder UI.
- Real-device focus regression pass.

## Audit workflow pattern

When asked for “audit whole app and compare competitors”:
1. Load this skill and `references/apk-analysis-2026-05-20.md`.
2. Verify source/build first, not just docs.
3. If remote SSH is unavailable, use local mirror if present and explicitly say so.
4. Count files/LOC and list packages/routes.
5. Run at least `compileDebugKotlin testDebugUnitTest`; for final baseline run `assembleDebug testDebugUnitTest`.
6. Compare feature-by-feature, not just architecture-by-architecture.
7. Save a project doc under `docs/` when the audit is broad enough to guide implementation.

## Avoid

- Do not copy Cinema HD scrapers, Flix Vision extractors, Flix remote config field names, server URLs, API keys, SVGs/assets, or exact UI strings.
- Do not implement server-driven remote config until Ray explicitly reopens that parked item.
