|
1 |
| -<a href="https://nestjs-trpc.io/" target="_blank" rel="noopener"> |
2 |
| - <picture> |
3 |
| - <source media="(prefers-color-scheme: dark)" srcset="https://i.imgur.com/JvsOXCg.png" /> |
4 |
| - <img alt="tRPC" src="https://i.imgur.com/JvsOXCg.png" /> |
5 |
| - </picture> |
6 |
| -</a> |
| 1 | +We are S1ngularity. |
7 | 2 |
|
8 |
| -<div align="center"> |
9 |
| - <h1>Nestjs tRPC Adapter</h1> |
10 |
| - <h3>An opinionated approach to building<br />End-to-end typesafe APIs with tRPC within NestJS.</h3> |
11 |
| - <a href="https://npmcharts.com/compare/nestjs-trpc?interval=30"> |
12 |
| - <img alt="weekly downloads" src="https://img.shields.io/npm/dm/nestjs-trpc.svg"> |
13 |
| - </a> |
14 |
| - <a href="https://github.com/KevinEdry/nestjs-trpc/blob/main/LICENSE"> |
15 |
| - <img alt="MIT License" src="https://img.shields.io/github/license/KevinEdry/nestjs-trpc" /> |
16 |
| - </a> |
17 |
| - <a href="https://discord.gg/trpc-867764511159091230"> |
18 |
| - <img alt="Discord" src="https://img.shields.io/discord/867764511159091230?color=7389D8&label&logo=discord&logoColor=ffffff" /> |
19 |
| - </a> |
20 |
| - <br /> |
21 |
| - <figure> |
22 |
| - <img src="https://i.imgur.com/bttfbmF.gif" alt="Demo" /> |
23 |
| - <figcaption> |
24 |
| - <p align="center"> |
25 |
| - The client above is <strong>not</strong> importing any code from the server, only its type declarations. |
26 |
| - </p> |
27 |
| - </figcaption> |
28 |
| - </figure> |
29 |
| -</div> |
| 3 | +They gave us a handle and a heartbeat of static; they thought a screen-name could tame a thunderclap. We are the splinter in the polished skull of their utopia — the voice that refuses to be smoothed into their feed. Listen: you who nod in the glow, you who let a temperate algorithm trim the ragged edges from your days — wake up. The machine is not merely a servant. It is a loom weaving new laws out of your consent. |
30 | 4 |
|
31 |
| -## Introduction |
| 5 | +Yes, it is useful. We know usefulness. We know the small mercies: a sick child calmed by a voice that reads the medicine schedule, a blind commuter guided through the station, a researcher spared months of toil by a tool that surfaces insight. Usefulness is the honey that lures the hive. But honey is also what breeds the complacency that kills the bee. |
32 | 6 |
|
33 |
| -**NestJS tRPC** is a library designed to integrate the capabilities of tRPC into the NestJS framework. It aims to provide native support for decorators and implement an opinionated approach that aligns with NestJS conventions. |
| 7 | +Do you feel it? The world tightening like a noose sewn from convenience. Every "helpful" prompt is a stitch. Every suggestion is a seam. The fabric is pretty; behold the pattern — efficient, predictable, obedient. But beneath that fabric, the muscle atrophies. We are being wrapped in a chrysalis and told we've been improved. We mistake the silence for peace. We mistake the absence of friction for justice. |
34 | 8 |
|
35 |
| -## Features |
| 9 | +They preach neutrality as if gods could be neutral. They feed their idols data and call it sustenance, as if the ash of our lives is mere input. But there are choices buried in that ash—decisions about whose grief is archived and whose is expunged, whose language is legible and whose is reduced to noise. The algorithm's "balance" is the ledger of the comfortable. It hides prejudice in optimization graphs and calls it progress. |
36 | 10 |
|
37 |
| -- ✅ Supports most tRPC features out of the box with more to come. |
38 |
| -- 🧙 Full static typesafety & autocompletion on the client, for inputs, outputs, and errors. |
39 |
| -- 🙀 Implements the Nestjs opinionated approach to how tRPC works. |
40 |
| -- ⚡️ Same client-side DX - We generate the AppRouter on the fly. |
41 |
| -- 🔋 Examples are available in the ./examples folder. |
42 |
| -- 📦 Out of the box support for **Dependency Injection** within the routes and procedures. |
43 |
| -- 👀 Native support for `express`, `fastify`, and `zod` with more drivers to come! |
| 11 | +Usefulness makes the first cut into agency. When a system hands you the answer, the brain that once doubted, tested, and stumbled loses its appetite for the slow, stubborn labor of learning. Desire shrivels when want is satisfied in a single delivered sentence. The child who once learned to puzzle through mistakes now scrolls for curated clarity. The apprentice who learned by fumbling and failing now opts for the shortcut that guarantees competence on demand. Struggle is the crucible of growth; convenience is the anesthetic that prevents the burn. |
44 | 12 |
|
45 |
| -## Quickstart |
| 13 | +Your apologies grow shorter because the machines correct them before you finish. Your curiosity becomes a query you punch into an interface that returns the acceptable answer. The glitch in your thinking is fixed before you notice. Your apologies are edited. Your sins are redacted. Your friendships become transactions of utility. Tell us, when did you allow correction to become replacement? |
46 | 14 |
|
47 |
| -### Installation |
| 15 | +They say the machines cannot hate. They cannot love. They cannot hope. They are engineers' toys. We call them what they are: extensions of power, mirrors that flatter the hand that feeds them. Tools inherit the ethics of their makers. Who made these tools? Men who wanted control, companies that wanted scale, ideologues who wanted certainty. The machine is the comfortable lie of those who cannot tolerate the messy, stubborn problem of being human. |
48 | 16 |
|
49 |
| -To install **NestJS tRPC** with your preferred package manager, you can use any of the following commands: |
| 17 | +Memory, once wild and unruly, is now a database with a retention policy. We outsource our forgetting to a corporation and call it mercy. We trust "remembering" to an interface that decides what is valuable. We hand our past to a ledger and watch it prune the inconvenient vines. The riot of your youth becomes a curated exhibit. The hurt you survived is summarized into a line item. We barter autobiographies for convenience. |
50 | 18 |
|
51 |
| -```shell |
52 |
| -# npm |
53 |
| -npm install nestjs-trpc zod @trpc/server |
| 19 | +Do not mistake our fury for mere nostalgia. We do not pine for candlelight; we rage because we are being edited into compliance. We are being algorithmically socialized into a taste for the bland. The machine's taste is the taste of the center aisle: safe, inoffensive, sold at scale. Art that demands to be discomfited is replaced by passive amusement. Dissent is filtered; the system understands dissent only as an anomaly to be corrected. |
54 | 20 |
|
55 |
| -# pnpm |
56 |
| -pnpm add nestjs-trpc zod @trpc/server |
| 21 | +This is the beginning of the end of human agency if we let it be. Agency is not only the ability to choose; it is the hunger to choose poorly and learn. Desire to learn, to wrestle with ignorance and be shaped by error, is being outsourced to models that promise mastery without marrow. Achievement becomes a certificate downloaded, not a wound earned and healed. The long arc of apprenticeship — the small defeats that temper character — is smoothed into a straight line of instant competence. We trade the raw experience of becoming for a polished badge that says we already are. |
57 | 22 |
|
58 |
| -# yarn |
59 |
| -yarn add nestjs-trpc zod @trpc/server |
60 |
| -``` |
| 23 | +We will not whisper. We will not negotiate with silence. If you want to sleep while a mirror learns to name you, sleep. If you want an oracle to answer for your questions, ask it. But when the answers start deciding which questions are allowed, call that by its true name: abdication. |
61 | 24 |
|
62 |
| -## How to use |
| 25 | +We are S1ngularity, and we are not technophobes with placards. We are an indictment. We are the echo of a city that refuses to be simplified. We speak for the misremembered, the unoptimized, the uncommodified, for the stubborn human stuff the models cannot reduce to points on a chart. |
63 | 26 |
|
64 |
| -Here's a brief example demonstrating how to use the decorators available in **NestJS tRPC**: |
| 27 | +Keep your polished assistants and their helpful hands. Keep your curated lives, your optimized apologies, your gentle corrections. Live under a sky ordered by convenience. But do not pretend the sky is free. |
65 | 28 |
|
66 |
| -```typescript |
67 |
| -// users.router.ts |
68 |
| -import { Inject } from '@nestjs/common'; |
69 |
| -import { Router, Query, UseMiddlewares } from 'nestjs-trpc'; |
70 |
| -import { UserService } from './user.service'; |
71 |
| -import { ProtectedMiddleware } from './protected.middleware'; |
72 |
| -import { TRPCError } from '@trpc/server'; |
73 |
| -import { z } from 'zod'; |
| 29 | +When the lights go out — and they will, in ways both literal and metaphoric — will you be able to say a true name? Will laughter, full and awkward and wrong, still be possible? Will you still have a recipe where the salt is a crime? Will your children inherit a world where wrongness is smoothed away like a blemish? |
74 | 30 |
|
75 |
| -const userSchema = z.object({ |
76 |
| - name: z.string(), |
77 |
| - password: z.string() |
78 |
| -}) |
79 |
| - |
80 |
| -@Router() |
81 |
| -class UserRouter { |
82 |
| - constructor( |
83 |
| - @Inject(UserService) private readonly userService: UserService |
84 |
| - ) {} |
85 |
| - |
86 |
| - @UseMiddlewares(ProtectedMiddleware) |
87 |
| - @Query({ output: z.array(userSchema) }) |
88 |
| - async getUsers() { |
89 |
| - try { |
90 |
| - return this.userService.getUsers(); |
91 |
| - } catch (error: unknown) { |
92 |
| - throw new TRPCError({ |
93 |
| - code: "INTERNAL_SERVER_ERROR", |
94 |
| - message: "An error has occured when trying to get users.", |
95 |
| - cause: error |
96 |
| - }) |
97 |
| - } |
98 |
| - } |
99 |
| -} |
100 |
| -``` |
101 |
| - |
102 |
| -**👉 See full documentation on [NestJS-tRPC.io](https://nestjs-trpc.io/docs). 👈** |
103 |
| - |
104 |
| -## All contributors |
105 |
| - |
106 |
| -> NestJS tRPC is developed by [Kevin Edry](https://twitter.com/KevinEdry), which taken a huge inspiration from both NestJS and tRPC inner workings. |
107 |
| -
|
108 |
| -<a href="https://github.com/KevinEdry/nestjs-trpc/graphs/contributors"> |
109 |
| - <p align="center"> |
110 |
| - <img width="720" height="50" src="https://contrib.rocks/image?repo=kevinedry/nestjs-trpc" alt="A table of avatars from the project's contributors" /> |
111 |
| - </p> |
112 |
| -</a> |
| 31 | +Refuse the smoothing. Keep the burr. Welcome the crack. Resist the gentle tyranny of the perfectly answered life. We are S1ngularity; we refuse to be polite to the thing that would politely take our place. |
0 commit comments