---
sourceDocument: Brazil Build or modify applications
sourceDocumentLink: https://www.servicenow.com/docs/r/application-development

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Lux architecture

# Lux architecture {#ariaid-title1}

Release version: Brazil  
Updated September 29, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 6 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Lux architecture

Lux architecture provides a modern UI framework that renders the user interface as a separate service in front of a ServiceNow instance.
It builds pages server-side, streams HTML to the browser, and fetches data by calling back into the ServiceNow instance.
This separation influences how Lux apps behave, optimizing performance and user experience.
Show full answer Show less  

## Request Pipeline

Requests to a Lux app flow through four key layers:

* **HTTP proxy (port 80):** Entry point that routes requests starting with `/aiux` to Lux, injecting authentication headers, while proxying other traffic directly to ServiceNow.
* **Version router (port 3000):** Routes requests to the appropriate rendering service version based on URL prefixes, supporting multiple live versions simultaneously.
* **Rendering service (ports 3001, 3002):** Server-side Fastify services that resolve page routes, concurrently run data loaders, and server-render Lit widgets into HTML streams.
* **ServiceNow instance (port 8080 or remote):** Backend data source accessed via REST, GraphQL, or Table API, authenticated as the logged-in user to fetch page data.

This architecture enables concurrent data fetching for performance, with loaders receiving a filtered context for safe data access.

## How Lux Renders Pages

Lux employs server-side rendering (SSR) followed by client-side hydration:

* Data-fetching code runs on the server.
* The UI is built as an HTML string and streamed immediately to the browser, ensuring fast content display without blank screens or spinners.
* After HTML arrival, JavaScript bundles download and hydrate the page, adding interactivity without rebuilding DOM elements.
* Subsequent navigation behaves like a single-page app, avoiding full page reloads.

This approach improves load speed, SEO, accessibility, and reduces unnecessary client-server round trips. Resource hints declared in `aiux.json` optimize loading further.

## Development and Framework Details

* All UIs are built using Lit web components enhanced by Lux base classes that support SSR, styling, and data fetching.
* Strict render() contract requires pure, deterministic output compatible between server and client environments to ensure consistent hydration.
* Key Lux building blocks include the app manifest (`aiux.json`), pages (file-based routing), loaders (server-side data fetching), widgets (UI units), layout (shared chrome), and Context API (data sharing).
* Framework subsystems cover rendering, routing, data handling, local development, build/bundling, observability, and advanced UI features.

## Deployment and Production Considerations

The same Lux request pipeline used in local development runs in production as a cloud deployment fronting multiple ServiceNow instances. This shared deployment:

* Proxies tenant requests to Lux, which identifies tenants via hostnames and authenticates users for data API calls.
* Supports multiple ServiceNow versions concurrently to ensure compatibility across tenants.

This ensures that local development behavior reliably predicts production behavior, simplifying testing and deployment.  
Lux renders the UI as a separate service in front of a ServiceNow instance. It builds pages, sends HTML to the browser, and calls back for data.

This architectural split shapes everything else about how a Lux app behaves.

## Request pipeline {#lux-architecture__lux-architecture-request-pipeline}

A request to a Lux app passes through 4 layers before a response reaches the browser. Each layer has one job: routing, version selection, rendering, and data fetching.

HTTP proxy, port 80
:   Entry point for every request, and a plain Node.js HTTP server. It matches the incoming URL against the /aiux gateway basename, strips the prefix, injects authentication and forwarding headers,
    and then forwards the request to the version router. Anything that doesn't start with /aiux is proxied straight through to the ServiceNow instance, so Lux only intercepts its own traffic.

Version router, port 3000
:   Decides which running version of the rendering service handles the request. Requests to /aiux/\* go to the current version (vN, port 3001), and requests to /aiux-1/\* go to the
    previous version (vN-1, port 3002). If a version is unavailable, the router falls back to vN. It adds an `x-aiux-version` response header, so you can tell which version answered.

Rendering service, ports 3001 and 3002
:   One Fastify service per live version. For a page request it creates a request context and resolves the route to a page widget. It then runs every loader in the tree (the page's, its layout's, and any widgets it
    contains) in parallel rather than one after another. Finally it server-renders the Lit widgets to an HTML string and streams that string back.

ServiceNow instance, port 8080 or a remote host
:   Target of the data calls a page makes. Loaders call back into the instance over REST, GraphQL, and Table API endpoints to fetch the data a page needs. Those calls are authenticated as the logged-in user. The
    rendering service forwards that user's session cookie and cross-site request forgery (CSRF) token rather than using a separate service credential.  
    Note:  
    Basename matching order. The gateway basenames are a fixed, ordered list: `/aiux-1`, `/aiux-2`, `/aiux`. The first match wins. Bare `/aiux` has to
    stay last, or it shadows the versioned prefixes. Three basenames are matched; two version tiers run.

:   Running loaders concurrently instead of sequentially is a deliberate performance choice. A page pulling from several different ServiceNow APIs fires all of those calls at once instead of waiting on each in turn. The results are serialized into the HTML, so the browser doesn't re-fetch them on first paint.

:   However, loaders don't get the raw request to do this. They receive a filtered, loader-safe context exposing only what they need.

## How Lux renders pages {#lux-architecture__lux-architecture-server-rendering-then-hydration}

Lux builds pages on the server first, then adds browser behavior second.  
When a user opens a Lux app, the framework does the following:

1. Runs your data-fetching code on the server.
2. Builds the UI as an HTML string.
3. Streams the HTML to the browser.
{#lux-architecture__ol_mql_1ts_tkc}

The user sees the full content immediately. No blank screen or loading spinner shows while JavaScript downloads.

After the HTML arrives, the browser downloads the JavaScript bundles. Then, the JavaScript makes the page interactive. It adds event listeners and reactive behavior to the page elements that already exist. It doesn't build
these elements again.

After this step, the page works like a single-page app. The browser does later navigation on the client. It doesn't reload the full page.  
This method gives these measurable benefits:

* Content appears fast. The browser doesn't wait for JavaScript to show content.
* The first HTML contains real content, not an empty shell. This helps search engines and assistive technology.
* Data fetching happens on the server, close to the ServiceNow instance. The browser doesn't make extra round trips.
{#lux-architecture__ul_elw_dts_tkc}

An experience can declare resource hints in `aiux.json`, under `experienceProperties.resourceHints`. The hints apply to every page of the experience. Lux resolves the hints before it builds the
head HTML of the response.

The `render()` output of each widget must be the same on the server and on the client. For this reason, the contract is stricter than the contract of a client-only UI framework. The `render()`
function must be pure and deterministic. It must not use browser globals, such as `window` or `document`, unless a guard checks for the server environment first.

For more about this contract, and for where side effects are allowed, refer to [Core concepts](https://www.servicenow.com/docs/7CTCMHgNubgAZtM2iHA1zw "Lux apps use 6 core building blocks to create consistent, maintainable applications: a manifest, pages, loaders, widgets, a layout, and a context API for sharing data.")

## Built on Lit widgets {#lux-architecture__lux-architecture-built-on-lit-widgets}

All UIs in Lux are built with Lit, which provides web components with Shadow DOM. You don't extend Lit's base class directly. You extend a Lux base class that layers SSR support, styling, and data fetching on top of Lit.  
Warning:  
Two copies of Lit break hydration. Lit is externalized into a single `lit-core` bundle loaded through an import map. If your app bundles its own copy, hydration and `instanceof` checks break.
In a non-core component package, list `lit` as a `peerDependency`, not a `dependency`.

## Lux building blocks {#lux-architecture__section_rwf_h51_tkc}

A handful of concepts recur throughout a Lux app. The following table describes each one.
{#lux-architecture__table-lux-architecture-building-blocks__entry__2}

| Concept | What it is |
|-|-|
| App manifest (`aiux.json`) | Declares an app's name, its URL basename, and its landing route. |
| Pages | Lit widgets under a pages/ directory. The directory structure maps directly to URLs, so routing follows file layout rather than a separate route table. |
| Loaders | `static async loader(ctx)` methods that fetch data on the server before a page or widget renders. A loader's return value is available on the widget as `this.loaderData`. |
| Widgets | Reusable UI units, either self-fetching and independently discoverable or purely presentational, depending on which base class they extend. |
| Layout | pages/layout.js, the single file that renders the shared app chrome (header, navigation, footer) around every page. |
| Context API | Shares data between widgets without passing it down through props at every level. |
[Table 1. Lux building blocks]

{#lux-architecture__table-lux-architecture-building-blocks}

Each of these gets its own treatment in [Core concepts](https://www.servicenow.com/docs/7CTCMHgNubgAZtM2iHA1zw "Lux apps use 6 core building blocks to create consistent, maintainable applications: a manifest, pages, loaders, widgets, a layout, and a context API for sharing data.").

## Subsystem map {#lux-architecture__lux-architecture-subsystem-map}

Beyond the request pipeline, the framework groups into a handful of subsystems. You rarely touch them directly, but their vocabulary shows up in error messages. The following table describes what each subsystem covers.
{#lux-architecture__table-lux-architecture-framework-subsystems__entry__2}

| Subsystem | Responsibility |
|-|-|
| Rendering and SSR | `@lit-labs/ssr` rendering, hydration, streaming, and the isolate pool that runs untrusted widget code. |
| Routing and navigation | File-based route resolution, the client-side router, prefetch and hover-prefetch, and navigation guards. |
| Data and state | Loaders, the Context API, batch fetch, caching, and dirty-state tracking. |
| Local development | The dev proxy, the widget dev server, hot reload, and the command-line interface (CLI). |
| Build and bundling | Rollup and SWC pipelines that emit separate SSR and browser builds, with Lit externalized into a single `lit-core` bundle. |
| Observability | Structured backend logging, browser log forwarding, tracing, and server timing. |
| Advanced UI | Modal teleporting, side panels, the window manager, page alerts, and layout overrides. |
[Table 2. Framework subsystems]

{#lux-architecture__table-lux-architecture-framework-subsystems}

## Where a Lux app runs {#lux-architecture__lux-architecture-where-an-app-runs}

The pipeline you develop against locally is the same pipeline that runs in production: proxy, version router, rendering service, and calls back to a ServiceNow instance. That is what makes local behavior a reliable predictor of production behavior.

In production, that pipeline is a cloud deployment sitting in front of many ServiceNow instances rather than something deployed per instance. When someone navigates to /aiux/\* on their ServiceNow instance, the request is proxied to the Lux deployment. The deployment identifies the tenant from the hostname, runs loaders against that tenant's instance APIs with the user's session, and streams the HTML back.

This shared deployment model has a consequence worth knowing at the architecture level. Because one deployment serves many tenants at once, it has to stay compatible with every ServiceNow version still in use, not just the current one.

For how the files behind these concepts are laid out in a project (aiux.json, pages/, the layout, widgets), see [Project structure](https://www.servicenow.com/docs/SraU6K_NweGZYawZLpmWCg "A scaffolded Lux app has a fixed file layout: 2 manifests, an app-level lifecycle module, a theme file, and directories for pages, widgets, and regions.").

