feTS (Fetch API + TypeScript) is a modern TypeScript HTTP framework designed for building performant and type-safe REST APIs. It prioritizes end-to-end type-safety, ease of setup, and a superior developer experience by leveraging the Web Fetch API standards. The framework is currently stable at version 0.8.6 and maintains an active development pace with frequent patch releases and minor version updates every few months, incorporating bug fixes, dependency upgrades, and new features. A key differentiator is its deep integration with TypeScript, coupled with `@sinclair/typebox` for defining robust schemas. This approach enables automatic runtime validation and OpenAPI specification generation, significantly reducing common API development pitfalls and ensuring consistent type adherence across the entire application stack, from client to server. It's built for Node.js environments and requires version 16.0.0 or higher.
npm install fetsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates creating a basic feTS server with a GET route using path parameters and a POST route with a JSON body, showcasing TypeBox schema integration for type-safety and validation.
Upgrade to `fets@0.8.6` or higher to correctly respect `Type.Optional` for request bodies in OpenAPI spec generation and validation. Ensure your TypeBox schemas accurately reflect whether a request body is truly optional.
Review and update your TypeBox schemas and the types used in your route handlers to match the stricter parameter typing. Ensure all request parameters strictly conform to their schema definitions.
Ensure your project is configured for ESM. Use `import` statements for all feTS modules and ensure your `package.json` includes `"type": "module"` or uses `.mjs` file extensions for your source files.
Change `const { symbol } = require('package')` to `import { symbol } from 'package'` for all module imports. Ensure your `package.json` has `"type": "module"`.Carefully review your TypeBox schemas and the corresponding TypeScript types in your route handlers. Ensure that the shapes of the data being sent, received, or returned precisely match the defined schemas.
If the request body is genuinely optional, ensure your TypeBox schema for the request body is wrapped with `Type.Optional(Type.Object(...))` and you are on `fets@0.8.6` or higher. Otherwise, provide the required request body in your client request.