Skip to main content

Documentation Index

Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

veryfront

Configuration, server bootstrap, routing, data fetching, and input validation.

Import

import {
  defineConfig,
  json,
  notFound,
  redirect,
  getEnv,
  createValidatedHandler,
} from "veryfront";

Examples

Configuration

import { defineConfig } from "veryfront";

export default defineConfig({
  // your project config
});

API routes

import { json } from "veryfront";
import type { APIContext, APIResponse } from "veryfront";

export function GET(ctx: APIContext): APIResponse {
  return json({ message: "Hello" });
}

Data loading

import { notFound } from "veryfront";
import type { DataContext } from "veryfront";

export function getServerData(ctx: DataContext) {
  if (!ctx.params.id) throw notFound();
  return { title: "Page" };
}

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
createHandlerCreate a Veryfront request handler for development or production.source
createValidatedHandlerCreate a validated API handler wrapper that auto-validates body/query with Zod schemassource
createValidationErrorCreate an input validation error. Convenience wrapper around INPUT_VALIDATION_FAILED.create().source
defineConfigDefine a Veryfront project configuration object.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
notFoundReturn a 404 result 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 request URL.source
redirectReturn a redirect result from a data loader.source
sanitizeDataSanitize data to prevent XSS and prototype pollution attacks.source
serverErrorCreate a 500 Internal Server Error response.source
startServerStart a Veryfront server in development or production mode.source
toNodeHandlerConvert a Web API request handler into a Node.js HTTP listener.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
DataContextContext passed to 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
StartServerOptionsServer options. Defaults to development mode with HMR. Set mode: "production" for a production server.source
StaticPathsResultReturn type for getStaticPaths().source
ValidatedHandlerConfigConfiguration for createValidatedHandler().source
ValidatedHandlerFunctionHandler signature that receives validated request data.source
VeryfrontConfigProject configuration. The underlying zod 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
Reference modules: User guides: Architecture: