https://github.com/morellodev/trpc-demo
Simple tRPC demo app
https://github.com/morellodev/trpc-demo
Last synced: 12 months ago
JSON representation
Simple tRPC demo app
- Host: GitHub
- URL: https://github.com/morellodev/trpc-demo
- Owner: morellodev
- Created: 2022-03-10T10:07:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-12T10:37:45.000Z (over 4 years ago)
- Last Synced: 2025-01-29T17:11:24.759Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 148 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tRPC Demo
This sample project demonstrates the use of the [tRPC library](https://trpc.io). It is a monorepo (using [Yarn workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces)) with both a client and a server.
## Prerequisites
Run `yarn install` to install the dependencies from the project root directory.
### Server
In order to be able to fetch the data, you need to setup a database first. This project uses [Prisma](https://www.prisma.io), and a schema is already defined in `packages/server/prisma/schema.prisma`.
To setup the database:
1. Open the server `.env` file and set the `DATABASE_URL` variable to the URL of your database ([Prisma documentation](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-typescript-postgres))
2. Run `yarn workspace @w/server prisma db push` to align the database with the Prisma schema and generate the Prisma client ([Prisma documentation](https://www.prisma.io/docs/concepts/components/prisma-migrate/db-push))
### Client
The client is a simple React app managed by [Vite](https://vitejs.dev). It does not require any setup.
## Running The Project
Run `yarn dev` from the project root directory to start the server and the client.
The server runs on port `8080`, while the client dev server runs on port `3000`.