MIT License

项目介绍

ts-rest/ts-rest 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 MIT License 许可证,目前获得 3.3k 个 Star、181 次 Fork。

仓库全名
ts-rest/ts-rest
开源许可证
MIT License
Star 数
3.3k
Fork 数
181

README 摘要

ts-rest Maintenance status ts-rest is no longer maintained. There are no planned releases, including V4, bug fixes, security updates, or support. I no longer have the time or capacity to maintain the project or run its community. I'm sorry for the long silence, and grateful to everyone who used or contributed to ts-rest, and to everyone who sponsored my work. Existing releases, source code, and documentation are…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ts-rest 用什么语言开发?

主要使用 TypeScript 编写,采用 MIT License 许可证,目前有 3.3k 个 Star。

ts-rest 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 ts-rest 的源码?

可以直接克隆仓库:git clone https://github.com/ts-rest/ts-rest.git,默认分支为 main;安装与运行步骤见仓库 README。

ts-rest 最近还在维护吗?

仓库最近一次更新为 1 周前,当前没有未关闭的 Issue;Star 数为 3.3k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

🌄 - RPC-like client, contract, and server implementation for a pure REST API

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
3710
价值分
2059
活跃状态
归档

语言占比

CSS
HTML
JavaScript
MDX
Makefile
TypeScript
Vue

Release

README

ts-rest

Maintenance status

ts-rest is no longer maintained. There are no planned releases, including V4, bug fixes, security updates, or support.

I no longer have the time or capacity to maintain the project or run its community. I’m sorry for the long silence, and grateful to everyone who used or contributed to ts-rest, and to everyone who sponsored my work.

Existing releases, source code, and documentation are available as-is. Independent forks are welcome, including forks of individual adapters, under the existing MIT licence. You do not need approval from the original maintainers to continue the project independently.

The unfinished V4 work is available for forks to build on, but is not a supported release.

Incrementally adoptable RPC-like client and server helpers for a magical end to end typed experience 🪄

GitHub Repo stars License Bundle Size

Introduction

ts-rest offers a simple way to define a contract for your API, which can be both consumed and implemented by your application, giving you end to end type safety without the hassle or code generation.

Features

  • End-to-end type safety 🛟
  • RPC-like client side API ⚡️
  • Small Bundle Size 📉
  • No Code Generation 🏃‍♀️
  • Zod support for runtime validation 🔒
  • Full optional OpenAPI integration 📝

👉 Start reading the official Quickstart Guide 👈

Super Simple Example

Easily define your API contract somewhere shared

const contract = c.router({
  getPosts: {
    method: 'GET',
    path: '/posts',
    query: z.object({
      skip: z.number(),
      take: z.number(),
    }), // <-- Zod schema
    responses: {
      200: c.type<Post[]>(), // <-- OR normal TS types
    },
    headers: z.object({
      'x-pagination-page': z.coerce.number().optional(),
    }),
  },
});

Fulfill the contract on your server, with a type-safe router:

const router = s.router(contract, {
  getPosts: async ({ params: { id } }) => {
    return {
      status: 200,
      body: prisma.post.findUnique({ where: { id } }),
    };
  },
});

Consume the api on the client with a RPC-like interface:

const result = await client.getPosts({
  headers: { 'x-pagination-page': 1 },
  query: { skip: 0, take: 10 },
  // ^-- Fully typed!
});

Quickstart

Create a contract, implement it on your server then consume it in your client. Incrementally adopt, trial it with your team, then get shipping faster.

👉 Start reading the official Quickstart Guide 👈

Contributors ✨

MASSIVE Thanks to all of these wonderful people (emoji key), who have helped make ts-rest possible:

Youssef Gaber
Youssef Gaber

💻 🤔 ⚠️
Per Hermansson
Per Hermansson

📖 💻
Grégory Houllier
Grégory Houllier

📖
Michael Angelo
Michael Angelo

📖
Pieter Venter
Pieter Venter

📖
Rifaldhi AW
Rifaldhi AW

📖
Jonathan White
Jonathan White

💻 📖
Max Brosnahan
Max Brosnahan

💻 🤔
Oliver Butler
Oliver Butler

💻 🤔 📖 🚇 🚧
Adrian Barylski
Adrian Barylski

💻 📖 ⚠️
Neil A. Dobson
Neil A. Dobson

💻
Eric Do
Eric Do

📖
Ben
Ben

💻 📖 ⚠️
LW
LW

💻 🐛
Andrew Vance
Andrew Vance

📖

Star History

Thank you to everyone who helped ts-rest grow since its first commit in 2022.

评论

暂无评论