Skip to content

Services

Every service in KatanaKit follows the same architecture: a small public API over a pure core, with the runtime I/O isolated behind it and SSR guards where the browser or Node/Bun is touched. Two public shapes exist, and both are re-exported as use* helpers from the package root:

  • Singleton facade classes — every src/core/services/ module is one: FormatterService, UnitConverterService, CurrencyConverterService, LoggerService, DatesService, FetchApiManager, … expose use* methods and a getInstance() accessor (plus create() where dependencies are injected). Service architecture explains the pattern vocabulary and the use* vs on* naming rule.
  • Function modules with strategies — the infrastructure modules (DOM, storage, theme, viewport, observer and friends) ship standalone use* functions; behavior is swapped through strategy objects (for example, LocalStorageStrategy, SessionStorageStrategy and MemoryStorageStrategy behind the storage API).
// Class-based facade
import { FetchApiManager } from "katanakit-js";
const api = FetchApiManager.getInstance();
api.useGetApi("pokeapi", "pokemonById", { params: { id: 25 } });
// Function module — same contract, no instance
import { useGetApi } from "katanakit-js";
useGetApi("pokeapi", "pokemonById", { params: { id: 25 } });

The API Reference is generated from the source; the pages below are the hand-written reference companion: an overview paragraph, a quick example and one section per method with runnable examples.

Service Description
HTTP Client Register APIs, build URLs and call every HTTP method with Safe Results.
Logger Log at every level with a small, replaceable logger and table output.
Storage Typed local and session storage with an SSR-safe in-memory fallback.
DOM SSR-safe DOM queries, element creation, attributes, classes and scroll.
Reactive Signals, effects, memos and toggles for reactive state.
Formatter Locale-aware number, currency and date formatting.
Converter Unit conversions for temperature, distance and weight.
Currency Conversion Convert amounts against ECB reference rates, with pluggable providers.
Error Helpers Attempt, JSON parsing, normalize and serialize for unknown throws.
Generator IDs, slugs, tokens and other generated values with zero dependencies.
Dates Temporal-based date math: now, add or subtract days, boundaries.
Geometry Area, perimeter and volume helpers with formatted output.
Timing Delays, intervals, debounce, throttle and retry helpers.
Viewport Viewport size, scroll position, media queries and prefers-* state.
Observer Create and manage Intersection, Resize and Mutation observers.
Worker Spawn workers, run functions off-thread and manage worker pools.
Service Description
Theme Dark and light mode with persistence, system preference and DOM sync.
Astro Adapter Typed static paths and service access from Astro pages and endpoints.
RSS Build RSS endpoints and parse feeds for content channels and embeds.
SEO Generate HTML head and Open Graph tags from a single flat config.
Service Description
Nuxt Adapter Nuxt composables and server-plugin helpers for the HTTP client.
Vue Adapter Vue reactivity wrappers around the HTTP client and query cache.
Express Server Start an Express server with the toolkit defaults and API config.