- Install docker and nx globally
npm i- Create
.local.envfrom.env npm start:dev- Go to GQL Playground. Create User :
mutation {
signUp(signUpInput:{
email: "[email protected]",
password:"testtest"
}){
id
}
}
- Nx
- Create workspace
npx create-nx-workspace full-stack —preset=nest - Add nest app
nx g @nrwl/nest:app my-nest-app --tags "scope:api"
- Create workspace
- Nest
- Add nest package
npm install --save-dev @nrwl/nest - Useful packages
npm i @nestjs/platform-fastify @nestjs/graphql @nestjs/mercurius graphql mercurius - Generate nest resource
nx g @nrwl/nest:resource -p api --directory="app/resources" --type="graphql-code-first" --crud --name {name} - Generate nest:lib with api scope
nx g @nrwl/nest:lib api/data-access-db --buildable --tags "scope:api" - ! Validation pipes works together with gql default validation, skipMissingProperties essential.
- Add nest package
- Prisma
- Add prisma field under package.json
"schema": "libs/api/data-access-db/src/lib/schema.prisma" - Add docker compose.yml to spin up database
- ! Check out
prisma-nestjs-graphqldocs if types/validation support needed - ! Create
.local.envwith needed variables
- Add prisma field under package.json
- NextJS
- Add next package
npm install --save-dev @nrwl/next - Create next app
nx g @nrwl/next:app web - Turn on
swcMinify: trueto make build faster
- Add next package
- GraphQL Code Generator
- Add needed packages
npm i -D graphql-codegen @graphql-codegen/cli @graphql-codegen/near-operation-file-preset @graphql-codegen/typed-document-node @graphql-codegen/typescript-operations @graphql-codegen/typescript @graphql-codegen/typescript-urql - Run generate if config in place
"gen:gql": "graphql-codegen --config tools/gql-codegen/gql-codegen.yml --watch"
- Add needed packages
