omi icon indicating copy to clipboard operation
omi copied to clipboard

Support pointing the app at a self-hosted backend (4 app-side changes, no backend work)

Open deromka opened this issue 1 month ago • 1 comments

What I'm asking

Would you take a small PR that lets the app talk to a self-hosted backend?

I've been running the Omi app against my own server for a few weeks — all transcription, summarisation and chat on a Mac at home, nothing leaving the network. It works well, and it needed four app-side changes, no backend changes at all. I'd like to upstream them rather than keep a fork, but I didn't want to open a 40-file PR unannounced.

The changes

  1. BUILD_LIBRARY_FOR_DISTRIBUTION in the Podfile — a plain bug, not related to self-hosting. CocoaPods writes YES into every aggregate Pods-Runner xcconfig; Runner has a bridging header, and Swift rejects that pair:

    Swift Compiler Error: Using bridging headers with module interfaces is unsupported
    

    Setting it on the target fixes the compile and then breaks pod install outright ([Xcodeproj] Consistency issue … has multiple values). A post_install hook that strips the attribute from the aggregate configs satisfies both. Happy to send this one on its own regardless of the rest.

  2. Signing identity out of the project file — an ios/Flutter/LocalSigning.xcconfig (git-ignored, with a committed .template) holding DEVELOPMENT_TEAM, APP_BUNDLE_IDENTIFIER and the app group. Committed defaults stay yours, so a clean checkout builds exactly as it does today. Today, building with a personal Apple account means editing identifiers across ~40 files, because an App ID and an app group can't be claimed by a second team.

  3. Env._isLocalDevelopmentApi accepting a MagicDNS name — the check already allows 100.64.0.0/10 (RFC 6598, the range Tailscale assigns) and says why: a physical device has no other route to a local harness. But it allows it only as four literal octets, so *.ts.net — which resolves into that range — is rejected. The name is the better thing to build in: the address changes when a machine re-joins a tailnet, the name doesn't. Bounded to the real suffix, with tests for ts.net.example.com and similar lookalikes.

  4. backend_url_override for a self-built release build, gated behind a compile-time flag so production builds are unaffected.

Why it might be worth it to you

"Runs entirely on your own hardware" is a strong story for a device that listens all day, and the app is already most of the way there — Env.apiBaseUrl is a single switch that both REST and the /v4/listen socket derive from. These four changes are what stands between that and someone being able to do it without forking.

I've written the server side separately (it speaks the app's API and stores everything locally): https://github.com/deromka/omi-local-server — not proposing that for this repo, since your backend is Firestore-backed and mine is SQLite; it's just evidence the app side is sufficient.

Happy to split these into separate PRs, start with the Podfile fix alone, or drop any of them. Just let me know what you'd accept.

deromka avatar Oct 15 '26 15:10 deromka

An update, and a narrower question than the one I opened with.

What happened to the original four items

  • MagicDNS names as local backends: merged as #21762.
  • Debug-build backend override: you shipped it in #21057, thanks.
  • Signing identity out of the project file: withdrawn. That's only needed by people building the app themselves, and the goal below is that nobody has to.
  • Podfile BUILD_LIBRARY_FOR_DISTRIBUTION fix: still on offer as its own PR if you want it.

The question

#21057 deliberately keeps release builds locked to the flavor backend, and a custom authority never gets Omi credentials. I agree with both for the default app. Would you accept an opt-in self-hosted mode in release builds, where the App Store app talks only to the user's own server and sends nothing to Omi or its vendors?

The pendant listens all day. "Your recordings never leave your house" is a strong reason to buy it. Today it's only possible by building and signing your own app, which most people can't do. I've been running this for weeks against my own server (https://github.com/deromka/omi-local-server). The app side is the only missing piece.

Rough design, in stages, each its own PR

  1. Pairing instead of Omi sign-in. The user enters a server address and a one-time code shown by their server. The app trades the code for a token, kept in secure storage and sent only to that server. No Firebase sign-in in this mode. Omi's backend needs no changes; the pairing contract is documented for self-hosters to implement.
  2. Nothing else leaves the phone. In self-hosted mode, PostHog, Crashlytics, Firebase Messaging and Intercom are never started. A test fails if any request goes to a host other than the paired server. I'd audit the remaining outbound paths, such as firmware downloads, as part of this stage.
  3. Hide what only exists on Omi's cloud, such as the app store, subscriptions and share links, instead of showing broken screens.
  4. Only then lift the release lock, and only for self-hosted mode:
    • entering it requires signing out;
    • a full-screen explanation;
    • a permanent "Connected to " indicator;
    • the HTTPS rules from #21057;
    • clearly labelled as unsupported by Omi.

Nothing changes for anyone who doesn't turn it on.

If the answer is no, that's fine. I'd rather know before building it. If it's "yes, but", tell me the "but" and I'll design around it.

deromka avatar Oct 26 '26 15:10 deromka