Skip to content

ivanms1/turbo-pothos-prisma-nextjs-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Turborepo + Pothos + Prisma + Next Template

Technology stack

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 both web and admin applications
  • packages/apollo-hooks: Libary of apollo-graphql hooks generated by GraphQL Code Generator for web and admin app to consume

Requirements

  • General

    • Yarn

    This repository uses Yarn as a package manager.

    • Enviroment Variables

      Inside the apps/web and apps/admin directories

      NEXT_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 and apps/admin directories and generate the hooks for them.