This is a starter template for projects using NextJS, Prisma, Tailwind, and React-Query.
NextJS is used as the main frontend framework for this template. Prisma is a Typescript ORM that connects the Postgresql database to the frontend. It has type safety for your database models, so you don't have to worry about typings. TailwindCSS is a utility-first CSS framework that integrates well with server-side rendering. Lastly, React-Query is data-fetching library that is used to maintain server state to your application.
React Hook Form will be used to manage form state, while Zod is a schema validator that checks the input form values and validates them for any errors.
npm install -g pnpm
.create-next-app
.pnpm install
.npx prisma generate
. If there's an error with Typescript, reopen your IDE.pnpm dev
to start the development server./prisma/schema.prisma
before applying changes (using npx prisma db push
) to the Postgresql instance. Do not push changes to the Prisma schema unless authorized.src
src/pages
https://localhost:3000/
or https://localhost:3000/home
. Check out the NextJS documentation for dynamic routes.src/styles
global.css
global style is stored. Additional stylesheets are discouraged since we now have a global .css.src/components
src/lib
src/utils
fetcher.ts
file is used to fetch data from the api
folder.src/hooks
prisma
prisma.schema
file is located. Do not edit unless allowed.src/context
useQuery
and useMutation
hooks instead.src/types
query
page demonstrates server-side fetching using React-Query. In development, the files pages/query.tsx
, pages/api/data.ts
, components/TestForm
, and hooks/useGetData.ts
should be placed in .gitignore
.`