Skip to content

KATT/trpc-suspense

Repository files navigation

Prisma + tRPC

Try in CodeSandbox: https://githubbox.com/trpc/trpc/tree/main/examples/next-prisma-starter

Features

  • 🧙‍♂️ E2E typesafety with tRPC
  • ⚡ Full-stack React with Next.js
  • ⚡ Database with Prisma
  • ⚙️ VSCode extensions
  • 🎨 ESLint + Prettier
  • 💚 CI setup using GitHub Actions:

Setup

npx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter
cd trpc-prisma-starter
yarn
yarn dx

Requirements

  • Node >= 14
  • Docker (for running Postgres)

Development

Start project

npx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter
cd trpc-prisma-starter
yarn
yarn dx

Commands

yarn build      # runs `prisma generate` + `prisma migrate` + `next build`
yarn db-nuke    # resets local db
yarn dx         # starts postgres db + runs migrations + seeds + starts next.js 
yarn test-dev   # runs e2e tests on dev
yarn test-start # runs e2e tests on `next start` - build required before
yarn test:unit  # runs normal jest unit tests
yarn test:e2e   # runs e2e tests

Files of note

Path Description
./prisma/schema.prisma Prisma schema
./src/api/trpc/[trpc].tsx tRPC response handler
./src/routers Your app's different tRPC-routers

Created by @alexdotjs.

Releases

No releases published

Sponsor this project

 

Languages