Importing from @kywi-software/core
A boundary test pins four of the 28 subpaths — ./next, ./next/client, ./next/middleware, ./host — to what may run at the edge, in RSC, or in the browser.
Core publishes 28 subpath entries and no wildcard. Most of them just group the package by purpose — schema, admin, evaluator, audiences. Four are load-bearing: a boundary test pins ./next, ./next/client, ./next/middleware and ./host to what keeps a database driver out of an edge bundle and a browser component out of a Server Component. Those four exist because something would otherwise fail to build; the rest exist to keep the barrel navigable.
Every entry, at 0.24.0
. # everything else below: grouped by domain, not pinned by a boundary test
./schema
./admin
./admin/app
./admin/server
./admin/styles.css
./site/styles.css
./multisite
./host # edge-safe — pinned, on the middleware's allow-list
./host-client
./evaluator
./audiences
./audiences/types
./audiences/consent
./audiences/entry-page
./audiences/utm-persistence
./experiments
./experiments/types
./scope
./ax
./scope-client
./layout
./nav
./server
./config
./next # server-only — pinned, no 'use client' beneath it
./next/client # client components — pinned, always 'use client'
./next/middleware # edge-safe — pinned, its own edge-safe allow-listThe three next entries are three runtimes
./next is server-only: the constructors, their helpers, and no 'use client' anywhere beneath it. That is enforced, not conventional — a boundary test asserts that no file under core's next directory carries the directive, that every file under its client directory does, and that no client file value-imports a server one. The reason is blunt: the directive walls off every export in a file, so one 'use client' on the barrel would make generateMetadata unusable and fail next build.
./next/client is where core's browser components live — the front-edit overlay, the personalization runtime, the nav. You rarely import it directly; the constructors pass those components across the RSC boundary as references for you. ./next/middleware is separate because the barrel reaches the database, sharp and the AWS SDK, and the edge runtime carries none of them. The same test pins the middleware's import list to an edge-safe allow-list and asserts it is not re-exported from the barrel — so the one-line middleware.ts in The host-app contract has to name the subpath.
A config imports ./config, never the barrel
import { defineKywiConfig, defineSite, defineTheme, defineModule } from '@kywi-software/core/config'
import { assertProductionAuthSecret } from '@kywi-software/core/host'The narrow entry is deliberate. KywiValidationError — the error a plugin's validate hook throws to reject a write — is re-exported from ./config so a config can throw it without importing the root barrel, which would drag server-only modules such as nodemailer into the Next bundle. Signal adapters are here for the same reason: defineAdapter, staticAttributesAdapter and geoipStubAdapter all come from ./config, so nothing in a config file needs a second import path. See Signal adapters.
The seven define helpers
defineKywiConfig(input: KywiConfigInput): KywiConfig
defineContentType(config: ContentTypeConfig): ContentTypeConfig
defineSite(config: SiteConfig): SiteConfig
defineTheme(config: ThemeConfig): ThemeConfig
definePlugin(config: PluginConfig): PluginConfig
defineModule(config: ModuleConfig): ModuleConfig
defineAxConfig(config: AxConfig): AxConfigFour of them do work rather than just carrying a type. defineKywiConfig folds any inline plugin's content types and modules into the resolved config and fills the themes, cache, media, ax and admin defaults. defineContentType applies commentable: false. defineSite throws on a missing id, name or domain, and defineTheme throws on a missing name or an empty regions array — at config evaluation, so kywi migrate and kywi seed hit them too. The remaining three are identity functions; skipping them costs you nothing but the type check.
./host is the edge-safe half
resolveActiveSite and the auth-secret guard live in ./host rather than the barrel so they can be called from middleware and unit-tested without a request. resolveActiveSite takes a host string for that reason — callers pass (await headers()).get('host') — and it never throws on a malformed header, degrading to the first configured site instead of 500-ing the page.