Skip to content

Latest commit

 

History

History
76 lines (53 loc) · 2.97 KB

README.md

File metadata and controls

76 lines (53 loc) · 2.97 KB

next.js-monorepo-starter

Best practices on using Next.js in a TypeScript monorepo

highlight features

  • Using Turborepo
  • Integrated internationalization with next-intl .
  • Integrated package manager [email protected]
  • Configure the behavior of turbo by adding a turbo.json file in your Workspace's root directory turbo
  • Using next.js app-router
  • Integrated tailwindcss
  • Integrated eslint V9
  • Integrated hyperse next-env for auto customized environment over next.js
  • Integrated zod
  • Integrated @svgr/webpack allow directly import .svg as component
  • Integrated vitest for unitest also support tspath alias
  • Integrated husky for commit hook
  • Integrated lint-staged for commit hook
  • Integrated git cz
  • Integrated changesets
  • Integrated commitlint
  • Integrated code-inspector-plugin([shift + ⌥option]) to resolve page/component's code is located.

tsconfig.json

  • tsconfig.json (vitest, eslint)
  • tsconfig.dev.json yarn dev
  • tsconfig.build.json yarn build

Note

the paths tsconfig.json also can be resolved for apps/*, we should avoid to use ts paths alias to write code for mono-module like core

  1. utils we can use alias
  2. core we should not use alias

If you are looking for single repo next.js best practices starter please see below link

https://github.com/hyperse-io/next.js-turborepo-starter

Remote Caching

Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.

By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:

cd my-turborepo
npx turbo login

This will authenticate the Turborepo CLI with your Vercel account.

Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:

npx turbo link

Useful Links

Learn more about the power of Turborepo:

Multi-Zone Next.js Applications

Multi Zones are an approach to micro-frontends that separate a single large application on a domain into smaller applications that each serve a set of paths.