UNPKG

next-ts-api

Version:

A powerful TypeScript-first API client generator for Next.js applications with full type safety and automatic api type generation.

39 lines (25 loc) • 1.56 kB
![Next-TS-API](https://raw.githubusercontent.com/zahinafsar/next-ts-api/refs/heads/main/resource/cover.png) šŸš€ A powerful TypeScript-first API client generator for Next.js applications with full type safety and automatic route type generation. [![npm version](https://badge.fury.io/js/next-ts-api.svg)](https://badge.fury.io/js/next-ts-api) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ## šŸ“š Documentation **[View Full Documentation →](https://zahinafsar.github.io/next-ts-api)** - Setup Guide - Core Concepts - API Reference - Examples - Contributing Guidelines ## Why Next-TS-API? In Next.js 13+ applications, while Server Actions provide type safety for mutations, data fetching is often better handled through API routes. Next-TS-API bridges the type safety gap by providing end-to-end type safety for your Next.js API routes, ensuring both your client-side API calls and server-side implementations are fully type-safe. ## Features - šŸ”’ **Full Type Safety**: Automatically generates TypeScript types for your API routes - šŸŽÆ **Zero Configuration**: Works out of the box with Next.js App Router - šŸ”„ **Auto-completion**: Get full IDE support for your API routes, methods, and payloads - šŸ› ļø **Type Inference**: Automatically infers request/response types from your route handlers - šŸ“¦ **Typed File Uploads**: Send multipart form data with the same inferred types as JSON bodies ## Quick Start ```bash npm install next-ts-api ``` ## License MIT Ā© Zahin Afsar