Core Package Overview
@riftseer/core is the shared library that everything else in the monorepo depends on. It owns the provider interface all data access goes through, and the autocomplete search engine. Card types and the parser live in @riftseer/types and are re-exported here for convenience.
Nothing in core is runtime-specific — it runs in Bun, Node, and Cloudflare Workers alike (except the server-only entry point, which is Bun/Node).
What's in core
| Module | File | Purpose |
|---|---|---|
| Types | src/types.ts | Re-exports Card, CardRequest, ResolvedCard, and all sub-interfaces from @riftseer/types |
| Provider interface | src/provider.ts | CardDataProvider — the only contract the API cares about |
| Parser | src/parser.ts | Re-exports parseCardRequests() from @riftseer/types |
| Discord emoji | src/icons.ts | EMOJI_FILES and renderTextForDiscord(), over the @riftseer/types/render token kernel |
| Search | src/search.ts | autocompleteSearch() — deterministic, position-aware name ranking |
| Normalize | src/normalize.ts | Re-exports normalizeCardName() from @riftseer/types |
| Supabase provider | src/providers/supabase.ts | SupabaseCardProvider — the only CardDataProvider implementation |
| Logger | src/logger.ts | Lightweight structured logger |
| Server entry | src/server.ts | Re-exports Supabase and Redis clients (server-side only) |
Provider pattern
The API does not import any database client directly. All data access goes through the CardDataProvider interface. The concrete implementation (SupabaseCardProvider) is selected at startup by the CARD_PROVIDER env var via the factory in src/providers/index.ts.
This means route code never changes when the data source changes — only the provider implementation does.
The ElysiaJS API server calls provider.warmup() on startup, then passes the provider into route modules as a dependency. See Provider Interface for the full contract.
Exports
The public surface is src/index.ts. Import from @riftseer/core:
import type { Card, CardRequest, ResolvedCard } from "@riftseer/core";
import { parseCardRequests } from "@riftseer/core";
import { autocompleteSearch } from "@riftseer/core";
Server-side clients (Supabase, Redis) are exported from @riftseer/core/server — do not import these in Workers or browser builds.
If you only need types or the parser and want to avoid core's heavier dependencies, import from @riftseer/types directly.
Testing
Tests live in src/__tests__/. Run with:
bun test packages/core
The provider tests use mock() from bun:test to stub the CardDataProvider interface. No live database connection is needed.