wealth/docs/decisions/0001-one-platform-shared-by...

1.2 KiB

0001 One platform shared by mobile and desktop apps

Status: Accepted · Area: architecture · Date: 2026-10-04 · Decided by: user

Context

The product ships two Next.js apps, bull (mobile) and bear (desktop), that serve the same Lumina product. Both apps serve under one domain; nginx proxies each request to the mobile or desktop app based on its user agent. The default rule gives each app its own platform.

Decision

Both apps/bull and apps/bear depend on one platform, platforms/market. Each app keeps only its routes, templates, bootstrap, and env; features, stores, models, and shared logic live in platforms/market.

Alternatives

  • One platform per app (platforms/bull, platforms/bear): duplicates the same business logic in two places.

Consequences

  • Nx tags: both apps and the platform use scope:market, so each app may import platforms/market, and neither app imports the other.
  • Models and actions must stay viewport-agnostic; device-specific UI belongs in each app's templates and organisms.
  • One URL serves two apps (dynamic serving): both apps keep the same route paths, and nginx sends Vary: User-Agent so caches and search engines don't mix the two versions.