---
title: '@svartz/core'
description: 'Shared types, plugin contract, and utilities for Svartz'
updated_at: '2026-11-26T00:42:57+01:00'
---

# @svartz/core

## Classes

- [PluginAggregateError](https://svartz.dev/reference/api/core/pluginaggregateerror.md)
- [PluginHookError](https://svartz.dev/reference/api/core/pluginhookerror.md)
- [PluginValidationError](https://svartz.dev/reference/api/core/pluginvalidationerror.md)
- [ProtectedSession](https://svartz.dev/reference/api/core/protectedsession.md) — Keep decrypted group data and non-exportable keys only for this page session.
- [ProtectionAuthenticationError](https://svartz.dev/reference/api/core/protectionauthenticationerror.md)
- [ProtectionFormatError](https://svartz.dev/reference/api/core/protectionformaterror.md)
- [ThemeValidationError](https://svartz.dev/reference/api/core/themevalidationerror.md)

## Interfaces

- [Artifact](https://svartz.dev/reference/api/core/artifact.md)
- [AssetRecord](https://svartz.dev/reference/api/core/assetrecord.md)
- [BrowserResource](https://svartz.dev/reference/api/core/browserresource.md) — Browser import contributed by an active content plugin. Script modules export `mount(pathname)` and return an optional disposer.
- [BrowserScriptContext](https://svartz.dev/reference/api/core/browserscriptcontext.md) — Where the site is served, for scripts that build URLs, such as a server plugin's `<base>/_svartz/<id>/`.
- [BrowserScriptLoader](https://svartz.dev/reference/api/core/browserscriptloader.md)
- [BrowserScriptModule](https://svartz.dev/reference/api/core/browserscriptmodule.md) — Lifecycle contract for a script contributed by a content plugin.
- [ChangeEvent](https://svartz.dev/reference/api/core/changeevent.md)
- [CompilerContributions](https://svartz.dev/reference/api/core/compilercontributions.md) — Compiler steps and browser imports collected afresh for each pipeline run.
- [ContentView](https://svartz.dev/reference/api/core/contentview.md) — HTML shown through a page's content components, from `BrowserScriptContext.mountContent`.
- [DashboardContribution](https://svartz.dev/reference/api/core/dashboardcontribution.md) — What a plugin adds to the dashboard: a heading for its panels, and the panels.
- [DashboardPanel](https://svartz.dev/reference/api/core/dashboardpanel.md) — A tool or settings screen a plugin adds to the site's dashboard, at `/-/dashboard/<plugin id>/<panel id>/`. The dashboard shows it only to viewers who hold `permission` on the vault, and checks that again on every render.
- [DashboardSection](https://svartz.dev/reference/api/core/dashboardsection.md) — One plugin's panels, as `ServerContext.dashboard` lists them.
- [DefaultThemeOverrideHints](https://svartz.dev/reference/api/core/defaultthemeoverridehints.md) — Default Tailwind theme override keys for better tab completion / IntelliSense when customizing theme. Schema validation accepts any Tailwind theme keys; this type hints the common ones. Theme packages (e.g. @svartz/theme-minimal) can export their own override type for even better hints. To narrow the `theme` property, add a JSDoc
- [EnvReference](https://svartz.dev/reference/api/core/envreference.md) — Names a server environment variable in place of an inlined secret.
- [FolderIndexEntry](https://svartz.dev/reference/api/core/folderindexentry.md)
- [GraphTarget](https://svartz.dev/reference/api/core/graphtarget.md) — Rich graph node for UI consumers (projection of Index).
- [HookExecutionResult](https://svartz.dev/reference/api/core/hookexecutionresult.md)
- [Index](https://svartz.dev/reference/api/core/index-interface.md) — Canonical index artifact produced by `core:index`. Single source of truth for search, backlinks, and graph projections.
- [IndexEntry](https://svartz.dev/reference/api/core/indexentry.md)
- [IndexLink](https://svartz.dev/reference/api/core/indexlink.md)
- [NormalizedSvartzPlugin](https://svartz.dev/reference/api/core/normalizedsvartzplugin.md)
- [PageContext](https://svartz.dev/reference/api/core/pagecontext.md) — Per-request facilities handed to a plugin's page renderer.
- [PermissionDeclaration](https://svartz.dev/reference/api/core/permissiondeclaration.md) — A permission a plugin checks with `can()` from `@svartz/auth/server`. `defaults` are the site-wide grants to the built-in actors (`guest` is everyone, `signed-in` everyone with an account) until a stored grant says otherwise.
- [PluginContext](https://svartz.dev/reference/api/core/plugincontext.md)
- [PluginPage](https://svartz.dev/reference/api/core/pluginpage.md) — A plugin page's content. The theme shell renders `html` as the page body, under its header and beside its explorer.
- [ProcessedFile](https://svartz.dev/reference/api/core/processedfile.md) — A file passing through the plugin pipeline.
- [ProtectedEnvelope](https://svartz.dev/reference/api/core/protectedenvelope.md)
- [ProtectedGroupPayload](https://svartz.dev/reference/api/core/protectedgrouppayload.md) — Browser session state for independently unlocked password groups.
- [RawLink](https://svartz.dev/reference/api/core/rawlink.md) — A link extracted from markdown before resolution. Mirrors vault's LinkMatch — kept Effect-free for plugin authors.
- [ResolvedBuildConfig](https://svartz.dev/reference/api/core/resolvedbuildconfig.md)
- [ResolvedConfig](https://svartz.dev/reference/api/core/resolvedconfig.md) — Canonical single-vault build config consumed by the runner and @svartz/vite.
- [ResolvedDiscoveryConfig](https://svartz.dev/reference/api/core/resolveddiscoveryconfig.md)
- [ResolvedFrontmatterConfig](https://svartz.dev/reference/api/core/resolvedfrontmatterconfig.md)
- [ResolvedSiteConfig](https://svartz.dev/reference/api/core/resolvedsiteconfig.md)
- [ResolvedThemeConfig](https://svartz.dev/reference/api/core/resolvedthemeconfig.md)
- [ResolvedVaultDefaults](https://svartz.dev/reference/api/core/resolvedvaultdefaults.md)
- [RouteIndex](https://svartz.dev/reference/api/core/routeindex.md)
- [RunnerResult](https://svartz.dev/reference/api/core/runnerresult.md)
- [RuntimeRouteInput](https://svartz.dev/reference/api/core/runtimerouteinput.md)
- [RuntimeRouteMatch](https://svartz.dev/reference/api/core/runtimeroutematch.md)
- [SearchDocument](https://svartz.dev/reference/api/core/searchdocument.md)
- [ServerContext](https://svartz.dev/reference/api/core/servercontext.md) — Per-request facilities handed to a server plugin's handler.
- [ServerHandleEvent](https://svartz.dev/reference/api/core/serverhandleevent.md) — The parts of SvelteKit's `RequestEvent` the router reads.
- [ServerHandleRuntime](https://svartz.dev/reference/api/core/serverhandleruntime.md) — Runtime inputs SvelteKit supplies to the generated registry.
- [ServerModule](https://svartz.dev/reference/api/core/servermodule.md) — What a server factory builds when it renders pages or panels: its request handler, its page renderer and its panels.
- [ServerModuleSpec](https://svartz.dev/reference/api/core/servermodulespec.md) — A plugin's server module and the JSON options its factory receives.
- [ServerRegistry](https://svartz.dev/reference/api/core/serverregistry.md) — What a build knows about its server plugins; `virtual:svartz/server` exports one per vault.
- [ServerRoute](https://svartz.dev/reference/api/core/serverroute.md) — One active server plugin in a generated registry.
- [ServerVaultSettings](https://svartz.dev/reference/api/core/servervaultsettings.md) — Public settings of the vault a server plugin belongs to.
- [SiteVaults](https://svartz.dev/reference/api/core/sitevaults.md) — Every vault in the config, and the one a `SvartzPlugin.forVault` call resolves the plugin for.
- [SocialImageMetadata](https://svartz.dev/reference/api/core/socialimagemetadata.md) — Public metadata a theme may place on a generated social preview.
- [SvartzPlugin](https://svartz.dev/reference/api/core/svartzplugin.md)
- [SvartzServer](https://svartz.dev/reference/api/core/svartzserver.md) — Serves a vault's server plugins: SvelteKit's `handle`, and the `load` of the route that renders plugin pages.
- [SvartzTheme](https://svartz.dev/reference/api/core/svartztheme.md)
- [TagIndexEntry](https://svartz.dev/reference/api/core/tagindexentry.md)
- [TargetConfig](https://svartz.dev/reference/api/core/targetconfig.md)
- [ThemeArtifactRequirements](https://svartz.dev/reference/api/core/themeartifactrequirements.md) — Declares which pipeline artifacts the theme needs. `search` and `toc` are derived from the canonical `index` — not independent.
- [ThemeComponentRegistry](https://svartz.dev/reference/api/core/themecomponentregistry.md) — Named component entries the theme provides for the runner/shell. All entries are optional; custom components extend via the index signature.
- [ThemeLayoutMap](https://svartz.dev/reference/api/core/themelayoutmap.md) — Maps named layout slots to component loaders. Required: `defaultPage` and `notePage`. Custom slots are extensible via the index signature.
- [ThemePluginPreset](https://svartz.dev/reference/api/core/themepluginpreset.md) — Plugins the theme ships with. Merged into the pipeline using standard plugin merge semantics: replace by id if existing, append if new.
- [ThemeRenderCapabilities](https://svartz.dev/reference/api/core/themerendercapabilities.md) — Declarative flags indicating what the theme can render.
- [ThemeRouteDefinition](https://svartz.dev/reference/api/core/themeroutedefinition.md)
- [TocEntry](https://svartz.dev/reference/api/core/tocentry.md)
- [VaultNoteView](https://svartz.dev/reference/api/core/vaultnoteview.md)
- [VaultView](https://svartz.dev/reference/api/core/vaultview.md) — Published, vault-scoped data for SvelteKit loaders and theme components.

## Types

- [AnalyticsConfig](https://svartz.dev/reference/api/core/analyticsconfig.md) — Public analytics settings shipped to the browser only when selected by a consumer.
- [ArtifactBag](https://svartz.dev/reference/api/core/artifactbag.md)
- [CustomDomainRoute](https://svartz.dev/reference/api/core/customdomainroute.md)
- [DateSource](https://svartz.dev/reference/api/core/datesource.md)
- [DevBindings](https://svartz.dev/reference/api/core/devbindings.md) — What `svartz dev` stores in `DEV_BINDINGS`: resolves the bindings, vars and `.dev.vars` of the app's Wrangler config.
- [Graph](https://svartz.dev/reference/api/core/graph.md)
- [HookOptions](https://svartz.dev/reference/api/core/hookoptions.md)
- [LinkResolutionStrategy](https://svartz.dev/reference/api/core/linkresolutionstrategy.md)
- [MaybePromise](https://svartz.dev/reference/api/core/maybepromise.md)
- [PageRenderer](https://svartz.dev/reference/api/core/pagerenderer.md) — Renders a GET of one of the plugin's pages; `undefined` answers 404. Pages render on every request and are never prerendered or cached. Forms on them post to the plugin's `/_svartz/<id>/` routes, which redirect back.
- [PageResult](https://svartz.dev/reference/api/core/pageresult.md) — What a page renderer answers: the page, or a same-site path to send the reader to instead.
- [PermissionAction](https://svartz.dev/reference/api/core/permissionaction.md) — What a permission lets someone do.
- [PermissionSlug](https://svartz.dev/reference/api/core/permissionslug.md) — `namespace:feature:action`, where the namespace is the declaring plugin's id: `annotations:comments:delete`.
- [PluginChangeHook](https://svartz.dev/reference/api/core/pluginchangehook.md)
- [PluginChangeHookInput](https://svartz.dev/reference/api/core/pluginchangehookinput.md)
- [PluginError](https://svartz.dev/reference/api/core/pluginerror.md)
- [PluginFactory](https://svartz.dev/reference/api/core/pluginfactory.md)
- [PluginHook](https://svartz.dev/reference/api/core/pluginhook.md)
- [PluginHookInput](https://svartz.dev/reference/api/core/pluginhookinput.md)
- [RunnerPlugin](https://svartz.dev/reference/api/core/runnerplugin.md)
- [ServerHandler](https://svartz.dev/reference/api/core/serverhandler.md) — Answers a request under the plugin's prefix. `undefined` answers 404.
- [ServerModuleFactory](https://svartz.dev/reference/api/core/servermodulefactory.md) — A server module's default export: builds the handler once from the plugin's options and the build data its hooks set in `getCompilerContributions(ctx).serverData` (`undefined` when they set none). A plugin with `pages` answers `{ handle, page }`.
- [StageName](https://svartz.dev/reference/api/core/stagename.md)
- [TailwindThemeConfig](https://svartz.dev/reference/api/core/tailwindthemeconfig.md)
- [ThemeComponentLoader](https://svartz.dev/reference/api/core/themecomponentloader.md) — Reference to a Svelte component — sync or lazy.
- [ThemeError](https://svartz.dev/reference/api/core/themeerror.md)
- [ThemeFactory](https://svartz.dev/reference/api/core/themefactory.md)
- [ThemeRequiredFeature](https://svartz.dev/reference/api/core/themerequiredfeature.md)
- [WranglerAssets](https://svartz.dev/reference/api/core/wranglerassets.md)
- [WranglerBuild](https://svartz.dev/reference/api/core/wranglerbuild.md)
- [WranglerConfig](https://svartz.dev/reference/api/core/wranglerconfig.md)
- [WranglerConfigFields](https://svartz.dev/reference/api/core/wranglerconfigfields.md)
- [WranglerEnvRecord](https://svartz.dev/reference/api/core/wranglerenvrecord.md)
- [WranglerLimits](https://svartz.dev/reference/api/core/wranglerlimits.md)
- [WranglerObservability](https://svartz.dev/reference/api/core/wranglerobservability.md)
- [WranglerPlacement](https://svartz.dev/reference/api/core/wranglerplacement.md)
- [WranglerRoute](https://svartz.dev/reference/api/core/wranglerroute.md)
- [WranglerTriggers](https://svartz.dev/reference/api/core/wranglertriggers.md)
- [ZoneIdRoute](https://svartz.dev/reference/api/core/zoneidroute.md)
- [ZoneNameRoute](https://svartz.dev/reference/api/core/zonenameroute.md)

## Functions

- [createProtectionSalt](https://svartz.dev/reference/api/core/createprotectionsalt.md) — Generate a fresh salt once per password group and build.
- [createServer](https://svartz.dev/reference/api/core/createserver.md) — Build a vault's `SvartzServer`. Each factory runs once: on its plugin's first request or page, or for an `eager` plugin before the handle answers its first request of any kind.
- [createServerHandle](https://svartz.dev/reference/api/core/createserverhandle.md) — The SvelteKit `handle` of `createServer`, for apps that render no plugin pages.
- [createVaultEntryView](https://svartz.dev/reference/api/core/createvaultentryview.md) — Apply the deployment base to one published entry, including a newly unlocked hidden note.
- [createVaultView](https://svartz.dev/reference/api/core/createvaultview.md) — Compose SvelteKit's deployment base with the index's vault-mounted URLs once.
- [decodeRoutePath](https://svartz.dev/reference/api/core/decoderoutepath.md) — Decode a percent-encoded URL pathname once; preserve slashes and return undefined for malformed escapes.
- [definePlugin](https://svartz.dev/reference/api/core/defineplugin.md) — Wrap a plugin factory with runtime validation and hook normalization. The returned factory produces normalized plugins ready for the runner.
- [defineTheme](https://svartz.dev/reference/api/core/definetheme.md) — Define a theme with runtime validation. Accepts either a static theme object or a factory function. Returns a callable factory that validates the manifest on each invocation.
- [deriveProtectionKey](https://svartz.dev/reference/api/core/deriveprotectionkey.md) — Derive a non-exportable session key from a password and the group's public salt.
- [executeHandleChange](https://svartz.dev/reference/api/core/executehandlechange.md)
- [executeStage](https://svartz.dev/reference/api/core/executestage.md)
- [getCompilerContributions](https://svartz.dev/reference/api/core/getcompilercontributions.md)
- [isPluginEnabled](https://svartz.dev/reference/api/core/ispluginenabled.md)
- [markdownCopyFor](https://svartz.dev/reference/api/core/markdowncopyfor.md) — The emitted Markdown copy of the page at a request `pathname`, if it has one. Map keys are decoded and end in a slash; request paths arrive percent-encoded, and without the slash under `trailingSlash: 'never'`.
- [matchThemeRoute](https://svartz.dev/reference/api/core/matchthemeroute.md)
- [materializeTheme](https://svartz.dev/reference/api/core/materializetheme.md) — Load every theme component before server rendering or hydration begins.
- [mergePlugins](https://svartz.dev/reference/api/core/mergeplugins.md) — Layered merge of plugin lists.
- [mergeProtectedIndex](https://svartz.dev/reference/api/core/mergeprotectedindex.md) — Merge only unlocked, listed group discovery into a browser-local vault index.
- [mountBrowserScripts](https://svartz.dev/reference/api/core/mountbrowserscripts.md) — Mount active scripts and return one disposer for the current route.
- [normalizePathname](https://svartz.dev/reference/api/core/normalizepathname.md)
- [normalizePlugin](https://svartz.dev/reference/api/core/normalizeplugin.md) — Normalize a plugin: validate shape + convert function shorthand hooks to object form. Throws PluginValidationError on invalid plugins. Warnings emitted via console.warn for unknown keys and disabled-with-hooks.
- [openProtectedPayload](https://svartz.dev/reference/api/core/openprotectedpayload.md) — Authenticate before returning bytes. Wrong passwords and altered bytes reject.
- [resolveProtectedBridgeImports](https://svartz.dev/reference/api/core/resolveprotectedbridgeimports.md) — Substitute only generated bridge specifiers before importing decrypted JS.
- [resolveThemeRouteToArtifactKey](https://svartz.dev/reference/api/core/resolvethemeroutetoartifactkey.md)
- [runLifecycleHooks](https://svartz.dev/reference/api/core/runlifecyclehooks.md)
- [runStages](https://svartz.dev/reference/api/core/runstages.md)
- [sealProtectedPayload](https://svartz.dev/reference/api/core/sealprotectedpayload.md) — Seal one group-owned payload. The ID is authenticated, so route swaps fail.
- [sortPluginsForStage](https://svartz.dev/reference/api/core/sortpluginsforstage.md) — Sort normalized plugins for a specific stage by enforce tier. Within each tier, config array order is preserved (stable sort). Only returns plugins that have a hook for the given stage.
- [validatePluginShape](https://svartz.dev/reference/api/core/validatepluginshape.md) — Validate a plugin against the Effect Schema. On failure, inspects the raw input to throw PluginValidationError with message parity to the legacy manual validation path.
- [validateTheme](https://svartz.dev/reference/api/core/validatetheme.md)

## Variables

- [CONTRACT_VERSION](https://svartz.dev/reference/api/core/contract_version.md) — Current contract version. Themes must declare a contractVersion and plugins may; `defineTheme` and plugin normalization fail one whose semver major differs from this constant.
- [CustomDomainRouteSchema](https://svartz.dev/reference/api/core/customdomainrouteschema.md) — Route = string | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute
- [DEV_BINDINGS](https://svartz.dev/reference/api/core/dev_bindings.md) — `globalThis` slot through which `svartz dev` hands server plugins local Cloudflare bindings. The dev server (Node) sets it to a function resolving the bindings; the router (SSR, same process) reads it per request in dev.
- [FnSchema](https://svartz.dev/reference/api/core/fnschema.md) — Effect Schema definitions for SvartzPlugin shape validation. Canonical source of truth for the plugin contract structure. Author-facing types remain plain TS — these schemas are internal.
- [HOOK_PARALLEL_DEFAULTS](https://svartz.dev/reference/api/core/hook_parallel_defaults.md)
- [HookInputSchema](https://svartz.dev/reference/api/core/hookinputschema.md)
- [HookObjectSchema](https://svartz.dev/reference/api/core/hookobjectschema.md)
- [HookOptionsSchema](https://svartz.dev/reference/api/core/hookoptionsschema.md)
- [KNOWN_PLUGIN_KEYS](https://svartz.dev/reference/api/core/known_plugin_keys.md)
- [PAGE_ROUTE_SEGMENT](https://svartz.dev/reference/api/core/page_route_segment.md) — Path segment under which plugin pages render in the theme shell: `<base><mount>/-/<page>/`.
- [PluginSchema](https://svartz.dev/reference/api/core/pluginschema.md)
- [SEARCH_INDEX_OPTIONS](https://svartz.dev/reference/api/core/search_index_options.md) — Shared MiniSearch schema for artifact generation and browser search.
- [SECRET_ENV_NAME_PATTERN](https://svartz.dev/reference/api/core/secret_env_name_pattern.md) — Server-only environment variable names. Client-public `PUBLIC_` and `VITE_` names are refused.
- [SERVER_PLUGIN_ID_PATTERN](https://svartz.dev/reference/api/core/server_plugin_id_pattern.md) — Plugin ids that serve requests, and the page names plugins claim, double as one URL path segment.
- [SERVER_ROUTE_SEGMENT](https://svartz.dev/reference/api/core/server_route_segment.md) — Path segment under which every server plugin answers: `<base><mount>/_svartz/<plugin-id>/`.
- [STAGE_NAMES](https://svartz.dev/reference/api/core/stage_names.md)
- [TailwindThemeConfigPropertyRecordSchema](https://svartz.dev/reference/api/core/tailwindthemeconfigpropertyrecordschema.md) — Generic theme property: map of name to value (or nested). All theme keys use this shape; extend per-key when needed (e.g. theme-minimal).
- [TailwindThemeConfigSchema](https://svartz.dev/reference/api/core/tailwindthemeconfigschema.md)
- [THEME_FEATURE_STAGES](https://svartz.dev/reference/api/core/theme_feature_stages.md) — Explicit feature requirements are distinct from rendering capabilities.
- [WranglerAssetsSchema](https://svartz.dev/reference/api/core/wranglerassetsschema.md) — Assets config; main/assets can be auto-populated at build from vault outDir.
- [WranglerBuildSchema](https://svartz.dev/reference/api/core/wranglerbuildschema.md) — Custom build (inheritable).
- [WranglerConfigFieldsSchema](https://svartz.dev/reference/api/core/wranglerconfigfieldsschema.md) — Wrangler config fields shared by root and env.<name>. Covers inheritable and non-inheritable keys from the config; no nested env. A `cloudflare-workers` target is its Worker's Wrangler config, so keys this doesn't list (newer bindings such as `images`) pass through untyped and Wrangler validates them.
- [WranglerConfigSchema](https://svartz.dev/reference/api/core/wranglerconfigschema.md) — Full top-level wrangler config. Users can set env (e.g. dev, prod) per vault; each env key holds a partial config (inheritable keys only) merged with the top-level by wrangler.
- [WranglerEnvRecordSchema](https://svartz.dev/reference/api/core/wranglerenvrecordschema.md)
- [WranglerLimitsSchema](https://svartz.dev/reference/api/core/wranglerlimitsschema.md) — Limits (inheritable).
- [WranglerObservabilitySchema](https://svartz.dev/reference/api/core/wranglerobservabilityschema.md)
- [WranglerPlacementSchema](https://svartz.dev/reference/api/core/wranglerplacementschema.md) — Placement (inheritable).
- [WranglerRouteSchema](https://svartz.dev/reference/api/core/wranglerrouteschema.md)
- [WranglerTriggersSchema](https://svartz.dev/reference/api/core/wranglertriggersschema.md) — Triggers / cron (inheritable).
- [ZoneIdRouteSchema](https://svartz.dev/reference/api/core/zoneidrouteschema.md)
- [ZoneNameRouteSchema](https://svartz.dev/reference/api/core/zonenamerouteschema.md)
