Prerequisites
- A Veryfront project with
veryfront.config.ts. - For a first-party extension: the matching package installed.
- For a local extension: a folder under
extensions/with a default-exported factory (see Extension authoring).
Where extensions run
Extensions run wherever you run the project:veryfront dev, veryfront start, and any runtime you host yourself.
Veryfront Cloud is the exception. It reads a project’s configuration file as
data rather than importing it, so an extension factory never executes there.
A default import of a first-party @veryfront/ext-* package is accepted: the
factory call evaluates to an inert { name } declaration that the platform
ignores with a warning, because it provides its own capabilities. Any other
import is refused by veryfront deploy before it creates a release, with the
line it refused named. See
Deploying a config that declares extensions.
Enable an extension
Add extension factories toveryfront.config.ts:
veryfront.config.ts to force reload during development.
Enable legacy decorator metadata
The default esbuild transform supports decorator syntax but does not emit TypeScript runtime type metadata. Install the explicit SWC bundler extension when class-validator, TypeORM, or a dependency-injection library needsdesign:type, design:paramtypes, or design:returntype:
tsconfig.json:
emitDecoratorMetadata.
Projects that use standard decorators or validation libraries without runtime
type reflection do not need the extension.
Isolated route preparation follows inherited configuration only inside the
project boundary, including project-owned node_modules. Copy an external
workspace configuration into the project before using it in an isolated
runtime. Trusted host execution can follow configuration outside the project.
Enabling experimentalDecorators routes local Deno API modules through
per-route SWC bundles. Separate route bundles do not share module-level state
from a common project import. The extension reads only the two decorator flags
from TypeScript configuration; other TypeScript emit settings are not forwarded
to SWC. The active legacy transform rejects source-map requests because it does
not compose SWC and esbuild maps yet. Review the extension package README before
treating module singletons or compiler-specific output as part of your route
contract.
Authorize React Server Actions
Server Actions require an application-owned authorization provider. Create a local extension that publishes the provider through the active extension generation:403, and removing the provider makes the endpoint fail closed
with 503. Configure CSRF protection independently through security.csrf;
the authorization provider does not enable or replace it.
Server Action arguments must be JSON-compatible: finite primitives, dense
arrays, and plain records. Convert FormData, class instances, dates, and
other application objects before calling an action. Each request accepts at
most RSC_ACTION_MAX_TOP_LEVEL_ARGUMENTS top-level arguments; nested arrays
use the separately documented authorization snapshot bounds. See the
veryfront/extensions/auth reference
for the exact provider DTO, bounds, outcomes, timeout, cancellation, and
generation-retirement behavior.
Migrate from the legacy Server Action guard
The old import-map override atrendering/rsc/server-action-guard.ts is no longer consulted and its former
default allowed every action. Remove that override, publish
RscActionAuthorizationProviderName as shown above, and deploy the provider
with the framework upgrade. Until the active generation owns a valid provider,
Server Action requests intentionally return 503; there is no core allow-all
fallback.
Enable Node.js WebSocket upgrades
The standardveryfront npm/CLI distribution installs and auto-activates the
Node.js transport extension, including for local HMR. Custom Node service
distributions must install it alongside veryfront:
veryfront.config.ts entry is required. To disable the builtin when
WebSocket support is intentionally unavailable, use:
Deploying a config that declares extensions
A project that targets both self-hosting and Veryfront Cloud can keep one configuration file. Self-hosted, an imported first-party factory activates the extension:@veryfront/ext-* factory call becomes an inert { name } declaration that
the platform accepts and ignores with a warning, because it provides its own
capabilities. The extension itself runs only where you run the project.
Factory options in a dual-target file must stay inside the declarative data
language: literals and getEnv reads. An option that needs code, such as a
callback, keeps the file self-hosted only, because the hosted evaluator
validates the whole program as data even where a value is discarded.
Imports of packages outside the first-party set are still rejected at deploy
time, as are declarations naming unknown extensions.
First-party extension areas
Veryfront applies explicit disable directives and higher-priority project
overrides before importing optional first-party built-ins. A package that is
not installed is skipped. An installed package that fails to load, returns an
invalid extension, or leaves a required contract unavailable stops activation;
the currently active extension generation remains in service until the
replacement passes preflight.
Verify it worked
Restartveryfront dev after changing extension configuration:
- The dev log should print a setup line for each loaded extension.
- Any contract the extension provides should now be resolvable through the
matching consumer. For example, setting
CACHE_TYPE=extensionlets the proxy use a registeredTokenCacheStoreto share OAuth tokens across processes without a core Redis dependency. - If the factory throws during setup, the dev server prints the setup error with the extension name. Fix the error and reload.