Skip to content

Mobile: run JSS on Android via React Native + nodejs-mobile (PoC + portability findings) #522

Open

Description

@melvincarvalho

What this is

A working proof-of-concept that runs JSS natively on Android as an installable app: a React Native shell embeds a full Node.js runtime (nodejs-mobile) and boots JSS in-process via createServer(). The pod serves on http://localhost:<port>/, the IdP initializes, a single-user pod is created, and a starter app bundle (pilot/profile/home) is auto-installed on first run.

App repo: js-pod/android. This issue collects the findings relevant to JSS itself and tracks the path forward.

What works now

  • RN app boots an embedded Node; JSS runs in the same process (no spawn).
  • IdP signing keys generated (RS256 + ES256), single-user pod created, account seeded.
  • Server listening at http://127.0.0.1:5445, reachable from the phone browser.
  • First-run bootstrap fetches solid-apps from jsDelivr onto the pod (same-origin, so no HTTPS→HTTP mixed-content block when signing in).
  • specialUse foreground service keeps the pod alive when the user switches to a browser.

Fixes required, by where they belong

JSS-actionable (split into their own issues)

Runtime contract (dependency-driven; document or guard)

oidc-provider / jose assume modern Node globals that nodejs-mobile doesn't provide. We polyfill them in the app entry point, but JSS could document a minimum-runtime contract:

  • global Intl.ListFormat (oidc-provider) — absent without ICU.
  • global crypto / Web Crypto (jose key generation) — not auto-attached.
  • URL.parse() static method (oidc-provider) — Node 22.1+.
  • oidc-provider logs "Unsupported runtime. Use Node.js v22.x LTS" — version gate worth noting.

jspod-actionable

  • jspod's start() spawns the jss binary, which can't run in a single-process embedded runtime. An in-process start mode (call createServer directly) would let jspod be embedded too. We bypassed jspod and imported JSS directly.

App/build-level (js-pod/android, not JSS)

RN new-arch + OpenSourceMergedSoMapping; AAPT silently dropping _-prefixed dirs (oidc-provider lib/helpers/_/); assembleRelease to bundle JS; port-shopping when 5444 is taken; specialUse FGS; browser <queries> for Android 11+ package visibility.

Gaps / known issues

Future work

  • Native Kotlin + nodejs-mobile-android (no React Native): leaner APK, avoids the RN/Hermes/bundle complexity. Reuses the same Node-side compat layer.
  • iOS via nodejs-mobile (RN iOS target, or native Swift).
  • Persistent, user-visible pod storage + backup.
  • Optionally upstream the runtime polyfills so embedded targets need less glue.

Activity

  1. added
    enhancement
    on May 23, 2026
  2. melvincarvalho commented on May 23, 2026

    @melvincarvalho
    ContributorAuthor

    Filed #523 for the IdP Array#toReversed 500 on Node <20 (oidc-provider → @koa/router). It sits in the runtime-contract / dependency-driven bucket alongside the Intl / crypto / URL.parse items, not the source-level fixes #520 / #521.

  3. melvincarvalho commented on May 23, 2026

    @melvincarvalho
    ContributorAuthor

    Filed #524 — RFC 9207 iss param vs discovery issuer trailing-slash mismatch. This was the last blocker; with it worked around (pass idpIssuer with a trailing slash), the full OIDC sign-in now completes end-to-end on the Android app — POST /idp/token 200, logged in via pilot.

  4. melvincarvalho commented on May 23, 2026

    @melvincarvalho
    ContributorAuthor

    App-side build log + architecture notes (the RN/AAPT/FGS/runtime-compat story that isn't JSS's concern) are written up at js-pod/android#1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions