• Stars
    star
    1,800
  • Rank 25,807 (Top 0.6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A TypeScript RPC framework, with runtime type checking and serialization, support both HTTP and WebSocket. It is very suitable for website / APP / games, and absolutely comfortable to full-stack TypeScript developers.

TSRPC

EN / 中文

A TypeScript RPC framework with runtime type checking and binary serialization.

Official site: https://tsrpc.cn (English version is on the way)

Features

  • Runtime type checking
  • Binary serialization
  • Pure TypeScript, without any decorater or other language
  • HTTP / WebSocket / and more protocols...
  • Optional backward-compatibility to JSON
  • High performance and reliable, verified by services over 100,000,000 users

Create Full-stack Project

npx create-tsrpc-app@latest

Usage

Define Protocol (Shared)

export interface ReqHello {
  name: string;
}

export interface ResHello {
  reply: string;
}

Implement API (Server)

import { ApiCall } from "tsrpc";

export async function ApiHello(call: ApiCall<ReqHello, ResHello>) {
  call.succ({
    reply: 'Hello, ' + call.req.name
  });
}

Call API (Client)

let ret = await client.callApi('Hello', {
    name: 'World'
});

Examples

https://github.com/k8w/tsrpc-examples

Serialization Algorithm

The best TypeScript serialization algorithm ever. Without any 3rd-party IDL language (like protobuf), it is fully based on TypeScript source file. Define the protocols directly by your code.

This is powered by TSBuffer, which is going to be open-source.

TypeScript has the best type system, with some unique advanced features like union type, intersection type, mapped type, etc.

TSBuffer may be the only serialization algorithm that support them all.

API Reference

See API Reference.

More Repositories

1

tsrpc-examples

JavaScript
242
star
2

tsbuffer

TypeScript type serializer used by TSRPC.
TypeScript
37
star
3

tsrpc-browser

TSRPC Client for browser
TypeScript
9
star
4

tsrpc-cli

TSRPC CLI Tools
TypeScript
9
star
5

tsrpc-proto

TSRPC service proto definition
TypeScript
6
star
6

ts-interface-validator

TypeScript interface validator
TypeScript
6
star
7

tsrpc-docs

Docs for TSRPC, https://tsrpc.cn
JavaScript
6
star
8

tsrpc-miniapp

TSRPC MiniApp Client (Wechat App, QQ App...)
TypeScript
6
star
9

k8w-linq-array

LINQ-like functions extended to native Array
TypeScript
6
star
10

create-tsrpc-app

create-tsrpc-app
TypeScript
5
star
11

tsrpc-base-client

TSRPC Base Client
TypeScript
5
star
12

webgl_2d_benchmark

webgl 2d benchmark, pixi.js vs egret vs layaair
JavaScript
4
star
13

tsbuffer-proto-generator

TypeScript
4
star
14

cocos-custom-gizmo-example

Custom gizmo example for cocos 3.6
TypeScript
4
star
15

tsrpc-weapp

TSRPC Client for WeChat App
TypeScript
4
star
16

pixi-minigame-test

【测试工程】pixi.js 和 webpack一起使用,创作微信小游戏。
JavaScript
4
star
17

tsrpc-antd-pro

Admin template by TSRPC & ANTD Pro
TypeScript
3
star
18

kunit

Javascript unit test framework support wechat app. 支持微信小程序的JS单元测试工具
TypeScript
3
star
19

fullts

Full-stack framework in TypeScript, based on TSRPC and React.
TypeScript
3
star
20

k8w-local-storage

同时兼容浏览器和微信小程序的LocalStorage
TypeScript
3
star
21

k8w-cocos-util

Cocos Creator Utils
TypeScript
3
star
22

tsbuffer-cli

TSBuffer CLI Tools
TypeScript
2
star
23

tsbuffer-validator

[WIP] Validator for TSBuffer values
TypeScript
2
star
24

tsbuffer-schema

TSType Schema declarations
TypeScript
2
star
25

k8w-extend-native

Extended native JS
TypeScript
2
star
26

tsrpc-example

Example project for TSRPC
TypeScript
1
star
27

tsrpc-2x-test-server

TypeScript
1
star
28

tsrpc-scripts

1
star
29

k8w-super-promise

Promise with cancel and always
TypeScript
1
star
30

tstype

@types/tstype
1
star
31

fullts-cli

CLI Tool for FullTS [WIP]
1
star
32

weapp-template

微信小程序工程化框架:TypeScript + LESS + WebPack
JavaScript
1
star
33

k8w-super-object

Useful functions extended to native Object
TypeScript
1
star
34

fullts-example

Example project for FullTS and TSRPC
TypeScript
1
star
35

tsrpc-common

TSRPC Common files
1
star
36

k8w-crypto

Crypto library (support both node and browser)
TypeScript
1
star
37

tsrpc-protocol

Base protocol for TSRPC
TypeScript
1
star
38

tenglin-react-less-ts-template

TypeScript
1
star
39

ts-node-symlink-problem

demo proj for ts-node symlink problem
TypeScript
1
star
40

nodejs-c10k-test

NodeJS c10k test
JavaScript
1
star
41

k8w-promise-mysql

Simple native Promise wrapper for mysqljs/mysql
TypeScript
1
star
42

k8w-weapp-util

微信小程序常用接口的Promise封装
TypeScript
1
star
43

vue-cli-symlink-issue

Reproduction for vue-cli about symlink issue
Vue
1
star
44

k8w-transparent-proxy

A docker image for simple transparent port proxy
Dockerfile
1
star
45

tsrpc-ws

[WIP] TSRPC WebSocket Version
TypeScript
1
star
46

sz2019-weapp-match

深圳南山区2019年小程序开发大赛获奖作品
TypeScript
1
star
47

k8w-super-collection

1
star
48

review-meeting-tool

回顾会议工具(ThoughtWorks流程)
HTML
1
star
49

weapp-template-webpack

TypeScript + LESS + WebPack 微信小程序开发框架
JavaScript
1
star
50

typescript-react-webpack-template

A template project
TypeScript
1
star
51

vscode-settings

vscode settings for typescript development
Shell
1
star
52

bjev-2019-annual-h5

北汽新能源2019年会H5
HTML
1
star
53

docker-pm2-node

Docker image for node runtime with pm2
JavaScript
1
star