Shared Packages
The packages/ directory holds libraries that more than one app depends on.
Some are pure logic, others are infra adapters, others are build-time config
shared across deployables.
Domain logic
Section titled “Domain logic”packages/weiqi-engine
Section titled “packages/weiqi-engine”The in-house Go rules library. Pure TypeScript, no I/O.
- Exports:
Game,StoneColor,GameMessages. - Consumers:
weiqi-server(lightweight move validation), MCP tools that validate moves client-side. - Docs: weiqi-engine.
packages/go-engine
Section titled “packages/go-engine”Thin wrapper around the goban-engine UMD bundle. Adds strict typing and a
stable serializePosition.
- Exports:
GoGame,StoneColor(string-enum form),serializePosition,Position,Player,ScoreResult,GameState. - Consumers:
weiqi-serveranalysis and replay paths. - Docs: go-engine.
packages/katago-server
Section titled “packages/katago-server”The bot-level catalog and KataGo request builders.
- Exports:
BOT_LEVELS,KataGoAnalyzeRequest,BOT_LEVEL_CODES. - Consumers:
weiqi-serverbot module,game-weblevel selector.
packages/glicko
Section titled “packages/glicko”Glicko-2 rating math.
- Exports:
applyUpdate,applyRatingPeriod,defaultGlickoRating, constants (GLICKO_DEFAULT_RATING,GLICKO_DEFAULT_RD,GLICKO_TAU,GLICKO_VOLATILITY), types (GlickoRating,GlickoUpdateResult). - Consumers: rating-system modules where classical Elo is not appropriate
(note: the bot ladder itself uses Elo via
BotRankService, not Glicko).
packages/katago-server (engine catalog)
Section titled “packages/katago-server (engine catalog)”Distinct from the Glicko package; this one defines the bot-level catalog. See Bot Ladder for the level table.
Auth and entitlements
Section titled “Auth and entitlements”packages/authz
Section titled “packages/authz”Roles, tiers, and bot entitlements.
- Exports:
APP_ROLES,SUBSCRIPTION_TIERS,BOT_ENTITLEMENTS(BOTS_HINT_TOP3,BOTS_LIVE_EVAL,BOTS_REVIEW_FULL, …),CHALLENGE_CAPABILITIES, helperstierAtLeast,hasBotEntitlement,dailyGameCap, plus server-side env helpers. - Consumers:
weiqi-server,auth-app,mcp-bridge,game-web.
packages/auth
Section titled “packages/auth”Better-Auth client wrapper.
- Exports:
AuthServiceclass wrappingbetter-auth/clientwithadminClient,anonymousClient,magicLinkClient. - Consumers:
game-web,auth-app.
Billing
Section titled “Billing”packages/billing-shared
Section titled “packages/billing-shared”Shared types and helpers for the billing pipeline.
- Exports:
chains.registry(SupportedChain),webhook-canonical(canonical-bytes helper),webhook-signature(signWebhook,verifyWebhookSignature,decodePrivateKey) — Ed25519 over SHA-512, 32-byte hex keys. - Consumers:
billing-indexer(signs),auth-app(verifies).
Infrastructure
Section titled “Infrastructure”packages/http-client
Section titled “packages/http-client”A typed HTTP client with composable interceptors.
- Exports:
HttpClient,createAuthInterceptor,createApiKeyInterceptor,createRetryInterceptor, presetscreateAuthenticatedClient,createApiKeyClient,createSSRClient,createClientSideClient. - Consumers:
weiqi-server(callsauth-app),auth-app(callsweiqi-server),billing-indexer(delivers webhooks).
packages/accounts
Section titled “packages/accounts”Client SDK for the accounts service.
- Exports: typed wrappers over
auth-app’s public REST surface. - Consumers:
weiqi-server, internal scripts.
packages/config
Section titled “packages/config”Env loader split into client/ and server/ halves.
- Consumers: every app at boot time.
packages/ui
Section titled “packages/ui”Radix-based, shadcn-style component library used by game-web, auth-app,
and the marketing site.
- Exports:
./components/*,./lib/*,./hooks/*,./globals.css,./theme.css. Tailwind +class-variance-authority+tailwind-mergeclsx.
- Consumers:
game-web,auth-app,main-app(selective).
Build-time config
Section titled “Build-time config”packages/typescript-config
Section titled “packages/typescript-config”Shared tsconfig extends.
- Exports:
base.json,vite.json,nextjs.json,react-library.json. - Consumers: every app and library.
packages/eslint-config
Section titled “packages/eslint-config”Shared ESLint flat-config presets.
- Exports:
./base,./next,./react-internal. - Consumers: every app and library.
packages/tailwind-config
Section titled “packages/tailwind-config”Tailwind preset used by apps that share the design tokens.
- Consumers:
game-web,main-app,admin-app.
Adding a new package
Section titled “Adding a new package”- Create
packages/<name>/package.jsonwithname: "@workspace/<name>". - Run
pnpm installfrom the repo root — the workspace symlink is automatic. - Import from any app via
import { ... } from "@workspace/<name>". - Add a section to this page in the same PR.