A simple book gallery website to demonstrate monorepo of full stack nodejs using :
- NextJS
- NestJS
- GraphQL
- Jest
- Typescript
- MongoDB
- Antd
- Lerna
This project is made up of 3 packages that share code using Yarn Workspaces.
- web (React NextJS website)
- server (NestJS GraphQL server)
- common (code shared between web and server)
- Clone project
git clone https://github.com/alanyudh/fullstack-next-nest-graphql-jest.git
- Go into folder
cd fullstack-next-nest-graphql-jest
- Download dependencies
yarn
- Start your MongoDB server
- Create database called
fullstack-books
- Import the sample data on
data-mocks.csv
- In
packages/server
, copy the.env.example
toenv
and update the mongodb variables to match your configuration - Run
yarn build
# run web & server
yarn start:prod
# run web only
cd packages/web
yarn start:prod
# run server only
cd packages/server
yarn start:prod
# to run on development mode, replace `yarn start:prod` to `yarn start:dev`
once started, applications can be accessed at :
- web : http://localhost:3000
- server: http://localhost:4000
- graphql playground: http://localhost:4000/graphql
To perform jest test :
# test web & server
yarn test
# test web only
cd packages/web
yarn test
# test server only
cd packages/server
yarn test
- to run coverage test, replace
yarn test
toyarn test:cov
- to run both lint, type-check, and jest test, replace
yarn test
toyarn test-all