Find Similar Packages for @trpc/client
@trpc/clientSimilar Packages:
Npm Package Weekly Downloads Trend
3 Years
🌟 Show real-time usage chart on @trpc/client's README.md, just copy the code below.
## Usage Trend
[![Usage Trend of @trpc/client](https://npm-compare.com/img/npm-trend/THREE_YEARS/@trpc/client.png)](https://npm-compare.com/@trpc/client#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
@trpc/client1,045,398
38,624588 kB20615 days agoMIT
README for @trpc/client

tRPC

tRPC

End-to-end typesafe APIs made easy

Demo

@trpc/client

Communicate with a tRPC server on the client side.

Documentation

Full documentation for @trpc/client can be found here

Installation

# npm
npm install @trpc/client

# Yarn
yarn add @trpc/client

# pnpm
pnpm add @trpc/client

# Bun
bun add @trpc/client

Basic Example

import { createTRPCClient, httpBatchLink } from '@trpc/client';
// Importing the router type from the server file
import type { AppRouter } from './server';

// Initializing the tRPC client
const trpc = createTRPCClient<AppRouter>({
  links: [
    httpBatchLink({
      url: 'http://localhost:3000/trpc',
    }),
  ],
});

async function main() {
  // Querying the greeting
  const helloResponse = await trpc.greeting.query({
    name: 'world',
  });

  console.log('helloResponse', helloResponse); // Hello world
}

main();