---
id: configuration/loading-strategies
title: Loading Strategies
---

`loadingStrategy` in [stift.config.ts](./config-file.md) decides what loads when. `initialize({ locale, critical })` resolves once the `critical` namespaces are memory-loaded; the rest continues in the background.

## The three strategies

- **`'lazy-per-namespace'` (default)** — load on first `t()`. Smallest boot cost; individual components suspend (or show raw-key fallback) as their namespaces stream in.
- **`'critical-then-full-background'`** — the PWA sweet spot: load `critical`, swap locale, persist the rest in the background.

```ts
await Stift.initialize({
  locale,
  critical: ['app-shell'], // NamespaceId[] to block first paint on
})
// initialize resolves once critical is ready; the full background pass continues.
```

- **`'boot-all'`** — pin every namespace (minus `bootExclude`) before first paint. Heaviest but zero jank; suited to kiosk/embedded surfaces where a loading state is unacceptable.

## Bounded memory

`memory.preload` pins LRU-exempt namespaces; everything else lives under `maxCachedNamespaces` with `evictionPolicy: 'lru'`. The cache is bounded by construction — loading more locales can't grow memory without limit.

## How it plays with offline

Returning visitors fast-path: installed packs verify + activate from the persister with zero network. Strategy and persistence compose — boot from cache instantly (offline-first), then revalidate in the background. Patterns: [Offline & Persistence](../runtime/offline-persistence.md). Staleness checks: [Updates & Invalidation](../runtime/updates-invalidation.md).

## Next

- Boot loop and React boot modes → [Setup & Boot Modes](../react/setup.md)
- Pack install/activate lifecycle → [Offline & Persistence](../runtime/offline-persistence.md)
