Skip to content

ADR 003: Cross-App Links

Accepted

With the subdomain architecture, each app runs on:

  • Different ports in development (localhost:4320, localhost:4322, etc.)
  • Different subdomains in production (lakea.dev, docs.lakea.dev, etc.)

We need a simple way to generate correct links between apps.

Use getAppLink(appId, path) from @lakea/core:

import { getAppLink } from '@lakea/core';
// In development (detected automatically)
getAppLink('handbook') // 'http://localhost:4322/'
getAppLink('handbook', '/start') // 'http://localhost:4322/start'
// In production
getAppLink('handbook') // 'https://docs.lakea.dev/'
getAppLink('handbook', '/start') // 'https://docs.lakea.dev/start'

Environment is detected automatically:

  • Browser on localhost → dev mode
  • Otherwise → production mode
import { getAppLink } from '@lakea/core';
<a href={getAppLink('handbook')}>Docs</a>
---
import { getAppLink } from '@lakea/core';
---
<a href={getAppLink('handbook')}>Docs</a>

Use the AppLink component for cross-app links in MDX files:

---
# The import path depends on your file location
# From docs/architecture/: ../../../../components/AppLink.astro
# From docs/contributing/: ../../../../components/AppLink.astro
---
import AppLink from '../../../../components/AppLink.astro';
<AppLink app="exoplanet-catalog">View Catalog</AppLink>
  1. Internal links (within same app): Use relative paths

    [Getting Started](/contributing/getting-started)
  2. Cross-app links: Use getAppLink() or <AppLink>

  3. External links: Use full URLs

    [NASA Archive](https://exoplanetarchive.ipac.caltech.edu)
  • App registry: packages/core/src/apps/index.ts
  • Routing: packages/core/src/routing/index.ts