veryfront/index.client

Import

TypeScript
import {  apiNotFound,  apiRedirect,  badRequest,  createValidatedHandler,  createValidationError,  csrfMutationHeaders,} from "veryfront/index.client";

Examples

TypeScript
import { getEnv, json } from "veryfront/index.client"; export function GET() {  return json({ mode: getEnv("MODE") ?? "development" });}

Exports

Components

NameDescriptionSource
CommonSchemasLazy-getter object that preserves the CommonSchemas.email call shape. Each access returns the cached Schema<T> (memoized inside defineSchema), so chained calls like CommonSchemas.email.parse(x) work as before.source
INPUT_VALIDATION_FAILEDHTTP request input validation failures (replaces ValidationError)source

Functions

NameDescriptionSource
apiNotFoundCreate a 404 Not Found response.source
apiRedirectCreate an HTTP redirect response.source
badRequestCreate a 400 Bad Request response.source
createValidatedHandlerCreate a validated API handler with bounded body/query validation. Bodies without a schema are preflighted through a clone, leaving the original request body available to the handler after its size is verified.source
createValidationErrorCreate an input validation error. Convenience wrapper around INPUT_VALIDATION_FAILED.create().source
csrfMutationHeadersAdd the double-submit token to a browser mutation aimed at this origin.source
defineConfigDefine a Veryfront project configuration object.source
defineConfigWithEnvDefine a Veryfront project configuration from the current environment name.source
forbiddenCreate a 403 Forbidden response.source
getEnvRead an environment variable from the active project scope.source
jsonCreate a JSON response with the correct content type.source
mergeConfigsMerge multiple partial Veryfront configuration objects into one config object.source
notFoundRender the 404 page from a data loader.source
parseFormDataParse and validate multipart or URL-encoded form data.source
parseJsonBodyParse and validate a JSON request body.source
parseQueryParamsParse and validate query parameters from a bounded request URL.source
redirectRedirect the request from a data loader.source
sanitizeDataSanitize JSON-like data by HTML-encoding string values and removing keys that can mutate an object's prototype chain.source
serverErrorCreate a 500 Internal Server Error response.source
unauthorizedCreate a 401 Unauthorized response.source

Types

NameDescriptionSource
APIContextContext object passed to API route handlers.source
APIHandlerFunction signature for API route handlers.source
APIResponseStructured response shape for API route helpers.source
APIRouteRoute module shape with method handlers and an optional default handler.source
CsrfMutationHeadersOptionsOptions for adding a CSRF token while preserving existing request headers.source
DataContextContext passed to getServerData().source
DataResponseMetadataCustom document response metadata returned from getServerData().source
DataResultProps, routing control, caching, and response metadata returned from getServerData().source
InferGetServerDataPropsUtility type to infer props from a page with datasource
MDXFrontmatterParsed frontmatter values from an MDX page.source
PageContextRuntime page context passed to page components.source
PageWithDataPage with data fetching capabilitiessource
ResponseCookieOne cookie emitted as a distinct Set-Cookie response field.source
StartServerOptionsServer options. Defaults to development mode with HMR. Set mode: "production" for a production server.source
StaticDataResultCache-safe result returned from getStaticData().source
StaticPathsResultReturn type for getStaticPaths().source
ValidatedHandlerConfigConfiguration for createValidatedHandler().source
ValidatedHandlerFunctionHandler signature that receives validated request data.source
VeryfrontConfigProject configuration. The underlying runtime schema stores extensions as unknown[]; this tightened alias surfaces the expected ExtensionConfigEntry[] shape to TypeScript consumers.source
VeryfrontHandlerWeb API request handler with WebSocket upgrade and HMR helpers.source
VeryfrontServerRunning server instance with lifecycle controls.source