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
| Name | Description | Source |
|---|
CommonSchemas | Lazy-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_FAILED | HTTP request input validation failures (replaces ValidationError) | source |
Functions
| Name | Description | Source |
|---|
apiNotFound | Create a 404 Not Found response. | source |
apiRedirect | Create an HTTP redirect response. | source |
badRequest | Create a 400 Bad Request response. | source |
createHandler | Create a Veryfront request handler for development or production. | source |
createValidatedHandler | Create a validated API handler wrapper that auto-validates body/query with Zod schemas | source |
createValidationError | Create an input validation error. Convenience wrapper around INPUT_VALIDATION_FAILED.create(). | source |
defineConfig | Define a Veryfront project configuration object. | source |
forbidden | Create a 403 Forbidden response. | source |
getEnv | Read an environment variable from the active project scope. | source |
json | Create a JSON response with the correct content type. | source |
notFound | Return a 404 result from a data loader. | source |
parseFormData | Parse and validate multipart or URL-encoded form data. | source |
parseJsonBody | Parse and validate a JSON request body. | source |
parseQueryParams | Parse and validate query parameters from a request URL. | source |
redirect | Return a redirect result from a data loader. | source |
sanitizeData | Sanitize data to prevent XSS and prototype pollution attacks. | source |
serverError | Create a 500 Internal Server Error response. | source |
startServer | Start a Veryfront server in development or production mode. | source |
toNodeHandler | Convert a Web API request handler into a Node.js HTTP listener. | source |
unauthorized | Create a 401 Unauthorized response. | source |
Types
| Name | Description | Source |
|---|
APIContext | Context object passed to API route handlers. | source |
APIHandler | Function signature for API route handlers. | source |
APIResponse | Structured response shape for API route helpers. | source |
APIRoute | Route module shape with method handlers and an optional default handler. | source |
DataContext | Context passed to getServerData(). | source |
InferGetServerDataProps | Utility type to infer props from a page with data | source |
MDXFrontmatter | Parsed frontmatter values from an MDX page. | source |
PageContext | Runtime page context passed to page components. | source |
PageWithData | Page with data fetching capabilities | source |
StartServerOptions | Server options. Defaults to development mode with HMR. Set mode: "production" for a production server. | source |
StaticPathsResult | Return type for getStaticPaths(). | source |
ValidatedHandlerConfig | Configuration for createValidatedHandler(). | source |
ValidatedHandlerFunction | Handler signature that receives validated request data. | source |
VeryfrontConfig | Project configuration. The underlying zod schema stores extensions as unknown[]; this tightened alias surfaces the expected ExtensionConfigEntry[] shape to TypeScript consumers. | source |
VeryfrontHandler | Web API request handler with WebSocket upgrade and HMR helpers. | source |
VeryfrontServer | Running server instance with lifecycle controls. | source |
Reference modules:
User guides:
Architecture: