turbo-pothos-prisma-nextjs-template
turbo-pothos-prisma-nextjs-template copied to clipboard
Turborepo + Pothos + Prisma + Next
Turborepo + Pothos + Prisma + Next Template
Technology stack
- Backend: Node.js, Pothos GraphQL, Prisma and Apollo Server
- Frontend: React.js, Next.js and Apollo Client
Monorepo Setup
-
apps/api
: Node.js app, provides all the apis and connects to the database. -
apps/web
: Main app powered by Next.js -
apps/admin
: Next.js app for admin purposes -
packages/ui
: Internal component library used by bothweb
andadmin
applications -
packages/apollo-hooks
: Libary of apollo-graphql hooks generated by GraphQL Code Generator forweb
andadmin
app to consume
Requirements
-
General
- Yarn
This repository uses Yarn as a package manager.
-
Enviroment Variables
Inside the
apps/web
andapps/admin
directoriesNEXT_PUBLIC_SERVER_URL="http://localhost:8080/graphql"
Running the app
-
To install project deps, run
yarn install
-
Initialize the database or sync the database schema
yarn db:push
-
Generate the pr the prismas client and types
yarn db:generate
-
Seed the database
yarn db:seed
-
Run app
-
Start the server
yarn dev:api
-
Start server + web
yarn dev:web
-
Start server + admin
yarn dev:admin
-
Start server + admin + web
yarn dev
-
Generating GraphQL Hooks
-
To generate the graphql hooks, run
yarn generate:hooks
This command will detect all the graphql files inside the
apps/web
andapps/admin
directories and generate the hooks for them.