Gathering detailed insights and metrics for @trpc/server
Gathering detailed insights and metrics for @trpc/server
Gathering detailed insights and metrics for @trpc/server
Gathering detailed insights and metrics for @trpc/server
🧙♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy.
npm install @trpc/server
Typescript
Module System
Node Version
NPM Version
98.8
Supply Chain
96.5
Quality
97.6
Maintenance
100
Vulnerability
100
License
TypeScript (79.83%)
MDX (17.17%)
JavaScript (1.78%)
CSS (1.22%)
Total Downloads
49,080,972
Last Day
35,411
Last Week
484,277
Last Month
2,838,953
Last Year
31,482,921
35,350 Stars
4,321 Commits
1,271 Forks
97 Watching
29 Branches
428 Contributors
Minified
Minified + Gzipped
Latest Version
10.45.2
Package Id
@trpc/server@10.45.2
Unpacked Size
696.62 kB
Size
147.08 kB
File Count
354
NPM Version
lerna/8.0.0/node@v20.10.0+x64 (darwin)
Node Version
20.10.0
Publised On
11 Mar 2024
Cumulative downloads
Total Downloads
Last day
-73.3%
35,411
Compared to previous day
Last week
-31.2%
484,277
Compared to previous week
Last month
-2.1%
2,838,953
Compared to previous month
Last year
114.1%
31,482,921
Compared to previous year
32
End-to-end typesafe APIs made easy
@trpc/server
Create tRPC routers and connect them to a server.
Full documentation for @trpc/server
can be found here
1# npm 2npm install @trpc/server 3 4# Yarn 5yarn add @trpc/server 6 7# pnpm 8pnpm add @trpc/server 9 10# Bun 11bun add @trpc/server
We also recommend installing zod
to validate procedure inputs.
1import { initTRPC } from '@trpc/server'; 2import { 3 CreateHTTPContextOptions, 4 createHTTPServer, 5} from '@trpc/server/adapters/standalone'; 6import { z } from 'zod'; 7 8// Initialize a context for the server 9function createContext(opts: CreateHTTPContextOptions) { 10 return {}; 11} 12 13// Get the context type 14type Context = Awaited<ReturnType<typeof createContext>>; 15 16// Initialize tRPC 17const t = initTRPC.context<Context>().create(); 18 19// Create main router 20const appRouter = t.router({ 21 // Greeting procedure 22 greeting: t.procedure 23 .input( 24 z.object({ 25 name: z.string(), 26 }), 27 ) 28 .query(({ input }) => `Hello, ${input.name}!`), 29}); 30 31// Export the app router type to be imported on the client side 32export type AppRouter = typeof appRouter; 33 34// Create HTTP server 35const { listen } = createHTTPServer({ 36 router: appRouter, 37 createContext, 38}); 39 40// Listen on port 2022 41listen(2022);
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 18 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 11/15 approved changesets -- score normalized to 7
Reason
SAST tool detected but not run on all commits
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
40 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More