Skip to main content
Brand and assets
Build
Monitor and contribute
/
Front-end platform
  • Overview
  • Technical architecture
  • Core framework
  • Application
  • global-shell
  • modular-arch
  • Product shells
  • Modules & apps
  • Module directory
  • Apps
  • Bundles
  • Bundle explorer
  • Guides
  • Install Murray
  • Universal components
  • Build a universal component
  • Responsive styles
  • RTL support
  • Translations & i18n
  • When to use Form
  • Positioning elements
  • Add a new icon
  • Utilities
  • Overview
  • Layouts
  • Application

Application

A country app defines its application as a rendered React tree: a GlobalApp element that wires up core services (auth, feature flags, user data), registers the given modules, and routes their screens.

Each country app exports one createApplication() function: it assembles the modules and returns the root component. Everything the application is made of — the module list, the dashboard shell, country adapters — is built inside its body, not at module scope.

Future direction

This one-app-per-country constraint is expected to change — we plan to support applications serving multiple countries.

import type { ComponentType } from "react";

import { api } from "@alaneu/global-api/<country>";
import { GlobalApp } from "@alaneu/global-shell";

export const createApplication = (): ComponentType => {
const myModules = [myCountryModule, onboardingModule()];

return () => <GlobalApp homePage="/dashboard/company/my-page" api={api} modules={myModules} />;
};

GlobalApp props​

PropertyTypeRequiredDescription
apiunknownYes—
ErrorPageComponentTypeNoCustom error page displayed on a general error
homePagestringYesDefines the default page showed after login
legacyCountryAdapterLegacyCountryAdapterNoLegacy hooks for country apps that still need to inject tracking or extra providers into the shell. Defaults to a noop adapter.
LoadingPageComponentTypeNoCustom loading page displayed until a screen is ready
redirectToHomepagebooleanNoWhen a capability check fails, redirect to `homePage` instead of rendering the forbidden screen. Opt-in for legacy apps where the homepage itself is unguarded; new apps should leave this off to avoid infinite redirect loops when the homepage is also capability-gated.
urlSchemeUrlSchemeNoDefaults to `language-prefixed`.
useCapabilitiesHookUseCapabilitiesHookNoSuspense query hook returning the current user's capability map. Required for route guards.

Plus two props of its own:

PropDescription
modulesThe application's modules. Registered once at mount — the array must be stable.
onRoutesReadyTest/introspection only: fires once, with the routes the router was built from.

Modules are registered in order. Dependencies declared within each module are resolved automatically via topological sort. Lazy module loading is not supported: declare the array once in createApplication() with everything the app needs.

The dashboard shell​

The customer dashboard shell is a module like any other: build it from the dashboard modules and the app's menu, then include it in modules:

import { customerDashboardShell } from "@alan-eu/global-customer-dashboard/module";

const dashboardModule = customerDashboardShell({
modules: [myDashboardModule, customerAdminManagementModule],
menu: { main: { order: 1, items: ["employees", "admins"] } },
});
const myModules = [myCountryModule, dashboardModule];

Menu item keys are checked at compile time against the dashboard modules' menuItems.

Core features​

GlobalApp includes these core features — you don't need to register them:

FeaturePurpose
AuthenticationAuth state, login/logout flows
UserCurrent user data
Feature flagsLaunchDarkly integration
Auth screensLogin, password reset, password change screens

Full example​

The Saudi Arabia app (frontend/apps/sa-app/application.tsx):

import type { ComponentType } from "react";

import { customerDashboardShell, rootPath } from "@alan-eu/global-customer-dashboard/module";
import {
customerAdminManagementModule,
customerAdminOnboardingModule,
} from "@alaneu/customer-admin-management";
import { api } from "@alaneu/global-api/sa";
import { GlobalApp, type GlobalAppProps } from "@alaneu/global-shell";
import { onboardingModule } from "@alaneu/member-lifecycle/onboarding";

import { saDashboardModule } from "./modules/saDashboardModule";
import { saModule } from "./modules/saModule";

export const createApplication = (): ComponentType<Pick<GlobalAppProps, "onRoutesReady">> => {
const dashboardModule = customerDashboardShell({
modules: [saDashboardModule, customerAdminManagementModule],
menu: { main: { order: 1, items: ["helloWorld", "inviteEmployees", "admins"] } },
});
const saModules = [saModule, customerAdminOnboardingModule, onboardingModule(), dashboardModule];

const SaApplication = ({ onRoutesReady }: Pick<GlobalAppProps, "onRoutesReady">) => (
<GlobalApp
homePage={`/${rootPath}/some-ksa-page`}
api={api}
modules={saModules}
onRoutesReady={onRoutesReady}
/>
);
return SaApplication;
};

Key takeaways​

  1. The app is a module list: assembling an application is declaring its modules and the dashboard menu — no routing or provider code.
  2. Country-specific features are just regular Module objects — no if(country) branching.
  3. The dashboard shell is a module: customerDashboardShell(config) collapses dashboard modules and the menu into one entry of the list, with menu keys compile-checked.
  4. createApplication() is the country module's entry point — it builds the whole application when called; global-app calls it once and renders the returned component.
Edit this page
Previous
Core framework
Next
global-shell
  • GlobalApp props
  • The dashboard shell
  • Core features
  • Full example
    • Key takeaways