Skip to content

This project is a minimal trpc project that I coded by following the official trpc docs.

Notifications You must be signed in to change notification settings

compsci-simon/minimal-trpc-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal tRPC project

Description


This is a minimal trpc server and client that run on a standalone server without.

The project consists of a server folder which defines a db.ts to mock a primsa client. trpc.ts instantiates an instance of the the trpc back end and exports the router and publicProcedure method which exists on this instance. index.ts defines most of the back end logic. It defines a few procedures that can be called to find users, a user or create a user. It also instantiates an http server with the trpc appRouter.

The client folder contains a simple index.ts which creates what is called a proxy client. This proxy client is a proxy which forwards RPC's from the front end to the back end. This proxy also provides type checking on the front end which is a major feature of using tRPC. Two requests are made to the back end server as well, (1) to get a user with the id of 1, and another to create a user.

Goal


The goal of this project was to familiarize myself with the tRPC architecture by coding a minimal trpc server-client following the official docs.


Running


To start the server run npx tsx watch server, and then to have the client run use npx wait-port 3000 && npx tsx client

About

This project is a minimal trpc project that I coded by following the official trpc docs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published