- https://github.com/vercel/next.js/tree/canary/examples/with-typescript-eslint-jest
- https://github.com/vercel/next.js/tree/canary/examples/with-apollo
- https://github.com/vercel/next.js/tree/canary/examples/custom-server-typescript
Bootstrap a developer-friendly NextJS app configured with:
- TypeScript CRUD API with prisma-2 and nexus-js
- Frontend GraphQL API schema and types generation.
- styled-components AND SASS/SCSS.
- Typescript and server
- Linting with ESLint
- Storybook
- Formatting with Prettier
- Linting, typechecking and formatting on by default using
husky
for commit hooks - Testing with Jest and
react-testing-library
Deploy the example using Vercel:
# Clone project
git clone https://github.com/prisma-cms/nextjs-nexus.git
# Install dependencies
yarn install
# Clone and edit .env file
cp .env.sample .env
# Deploy database migrations (set MySQL connection credentioals in .env file)
yarn prisma:deploy
# Build bundles
yarn build
# Start bundled project
yarn start
-
Edit prisma shema in prisma/schema.prisma
-
Push change to database
yarn prisma:db:push
- Create migration
yarn prisma:migrate:create --name migration_name
- Generate front GraphQL schema and types
yarn generate:types
- Start server in development mode
yarn dev
yarn lint
yarn types
yarn test
yarn test --coverage
Attension! For unit tests with real API started server required.
- Generate schemas if changed
yarn generate
- Build bundles
# Build bundles
yarn build
# Start bundled project
yarn start
After this open yet another terminal and run tests
yarn test:api
yarn test:all
yarn build:analyze
yarn storybook
yarn build:storybook
Deploy it to the cloud with Vercel (Documentation).