Overview:
This repo is a starting point for using tRPC in Next.js within a monorepo setup. It allows you to write your server in one place and serve it from wherever you want. Instead of writing a separate REST server, you can use Next.js to handle the server functionality with tRPC.
Features:
- Integration of tRPC in Next.js
- Monorepo setup with NX
- Access to database using Prisma
- Multiple apps within the same monorepo
- Custom routers for each app
Installation:
To install and run the different apps within the monorepo, follow these steps:
- Install NX globally:
npm install -g nx
- Clone the repository:
git clone [repository-url]
- Run the desired app using NX:
nx serve [app-name]
For example, to run app1, use the command:
nx serve app1
If you don’t have NX installed globally, use the following command:
npx nx serve [app-name]
For example:
npx nx serve app1
Note: Each app runs on port 4200, so you will not be able to run all apps simultaneously.
Summary:
This repo provides a starting point for using tRPC, Prisma, and Next.js within a monorepo setup. It allows you to write your server code in one place and easily serve it using Next.js. The apps within the monorepo demonstrate the usage of tRPC and different routers for querying data. By including Prisma, you can also connect to a database in one of the apps. Overall, this repo showcases the integration of multiple technologies to create a powerful and flexible server-setup for your Next.js applications.