- 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
huskyfor 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 devyarn lintyarn typesyarn testyarn test --coverageAttension! 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 startAfter this open yet another terminal and run tests
yarn test:apiyarn test:allyarn build:analyzeyarn storybookyarn build:storybookDeploy it to the cloud with Vercel (Documentation).