Skip to content

API Reference

Farrow provides a complete set of APIs for building type-safe web applications. This documentation provides detailed API reference for all core modules.

Core Modules

farrow-http

TypeScript-first Web Framework - Provides type-safe routing and automatic validation

  • HTTP/HTTPS server creation and configuration
  • Type-safe routing patterns and automatic validation
  • Powerful Response builder system
  • Modular router and middleware system
  • Context management and error handling
  • Static file serving and CORS integration
  • Express integration support

farrow-schema

Powerful Type Validation and Serialization Library - Handle data easily through type-driven design

  • Complete basic type system (String, Number, Boolean, Date, ID)
  • Flexible composite types (List, Optional, Nullable, Record, Tuple)
  • Structured type definitions (ObjectType, Struct)
  • Union and intersection types (Union, Intersect, Literal)
  • Schema manipulation tools (pickObject, omitObject, partial, required)
  • Built-in and custom validator system
  • Complete TypeScript type inference support

farrow-pipeline

Type-safe Middleware Pipeline Library - Provides functional programming style request processing

  • Synchronous and asynchronous Pipeline creation
  • Type-safe context management system
  • Container concept and dependency injection
  • Pipeline composition and middleware execution
  • Utilities and error handling
  • Async tracing support

Quick Navigation

HTTP Service

Core API

Advanced Features

Schema Validation

Type System

Validation & Formatting

Helper Tools

Pipeline System

Core Features

Context System

API Conventions

Naming Conventions

  • Types: PascalCase (e.g., ObjectType, HttpError)
  • Functions: camelCase (e.g., createContext, pickStruct)
  • Constants: UPPER_CASE (e.g., DEFAULT_PORT)
  • Files: kebab-case (e.g., farrow-http)

Type Annotations

All APIs include complete TypeScript type definitions:

typescript
// Function signature
function createContext<T>(defaultValue: T): Context<T>

// Type definition
type RequestInfo = {
  readonly pathname: string
  readonly method?: string
  readonly query?: RequestQuery
  readonly body?: any
  readonly headers?: RequestHeaders
  readonly cookies?: RequestCookies
}

This is a third-party Farrow documentation site | Built with ❤️ and TypeScript