albertonline.org docs
Packages

i18n & client data

Next.js i18n routing/dictionaries, a framework-neutral translation runtime, and two browser-only client-state primitives.

Two of these packages handle translated text (one Next.js-specific, one framework-neutral for non-Next apps); the other two handle state that lives only in the browser (a key-value store and reactive local-first collections).

@repo/internationalization

Next.js-specific i18n built on next-intl: locale list, middleware, request config, and per-locale JSON dictionaries (en, lt, ru, managed via languine). dictionary-loader is deliberately free of any next-intl import so consumers that only need raw messages (an RPC handler, an override merge) don't drag in the request-config machinery and risk a module-eval-order cycle.

  • .locales, Dictionary type, and next-intl's NextIntlClientProvider/useLocale/useTranslations
  • ./middlewarecreateI18nMiddleware(options)
  • ./servergetDictionary, getLocale, getMessages, getTranslations, setRequestLocale
  • ./dictionary-loadergetDictionary without the next-intl server import
  • ./plugincreateNextIntlPlugin (for next.config.ts)
  • ./locales, ./dictionaries/* — the locale list and raw JSON dictionaries

@repo/intl-runtime

A small, framework-neutral translation runtime for apps that don't run on Next.js/next-intl (or want a React-only useT hook over plain message objects). Uses intl-messageformat for ICU syntax (variables, plurals, select) and mirrors next-intl's useTranslations shape — missing keys fall back to the raw key instead of rendering blank.

  • IntlProvider, useIntl — React context carrying { locale, messages }
  • useT(namespace?) — returns a (key, vars?) => string formatter, with a per-locale/message-set formatter cache
  • loadMessages(locale, { fallback, loaders }), resolveLocale(input) — server/loader-side helpers for resolving and loading a locale's messages
  • Messages, FormatVars types; getMessageAt for nested key lookup

@repo/browser-persistence

An Effect v4 key-value store over a StorageLike backend (real localStorage, an in-memory test double, or an SSR noop). Values are JSON-encoded in a versioned { v, data } envelope and decoded through a Schema on read; a corrupt/stale value logs a warning and resets to the caller's default rather than throwing.

  • KvStoreContext.Service with get, set, remove, and subscriptionRef (a SubscriptionRef that mirrors its updates to storage)
  • KvStore.layerLocalStorage, KvStore.layerNoop, KvStore.layerFromStorage(storage) — pick the backend per environment
  • makeMemoryStorage() — an in-memory StorageLike for tests
  • KvParseError — tagged decode/parse failure

Not the same job as @repo/local-db: this package is an Effect KV store for scalar/object values, while local-db is plain-TS reactive collections. Pick by whether the call site is already in Effect.

@repo/local-db

A reusable wrapper around TanStack DB client-side collections, plus a per-browser sandbox primitive, for local-first UI state (carts, drafts, session prefs) that lives entirely in the browser and can be wiped in one call. Plain TypeScript and React 19 — no Effect.

  • resolveStorage() — real localStorage in the browser, in-memory everywhere else (SSR/tests); memoryStorage() — a fresh in-memory store
  • createSandbox({ collections }){ collections, reset() }, where reset() clears every collection in the sandbox
  • Re-exports from @tanstack/react-db: createCollection, localStorageCollectionOptions, localOnlyCollectionOptions, useLiveQuery, eq, and the Collection type
  • useLiveQuery is browser-only (throws during SSR) — gate it behind a mount guard in components that render on the server

See the packages overview and the architecture guide.

On this page