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
Updated on 06 Dec 2024
TypeScript (79.86%)
MDX (17.14%)
JavaScript (1.78%)
CSS (1.22%)
Cumulative downloads
Total Downloads
Last day
20%
Compared to previous day
Last week
-1.1%
Compared to previous week
Last month
1.7%
Compared to previous month
Last year
128.4%
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
security policy file detected
Details
Reason
30 commit(s) and 18 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 11/18 approved changesets -- score normalized to 6
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
39 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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