Skip to content

Instantly share code, notes, and snippets.

@firxworx
Last active September 20, 2022 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save firxworx/be67827457fd323038bd7908c421026f to your computer and use it in GitHub Desktop.
Save firxworx/be67827457fd323038bd7908c421026f to your computer and use it in GitHub Desktop.
create nx monorepo with nextjs + nestjs

set up an nx monorepo with nextjs front-end and nestjs back-end

yarn global add nx

# start with an empty monorepo and use nx as the cli (vs angular)
yarn create nx-workspace [monorepo_name] --preset=empty --cli=nx

# start with empty monorepo using yarn package manager and js/ts plugin installed
yarn create nx-workspace --package-manager=yarn --preset=ts

cd [monorepo_name]

If starting a fresh project w/ yarn preferred, consider removing package-lock.json and running yarn.

yarn add -D @nrwl/next
yarn add -D @nrwl/nest

nx generate @nrwl/next:application client
nx generate @nrwl/nest:application api --frontendProject client

You may wish to add a script to package.json for the API:

"start:api": "nx serve api"

nx commands reference: https://nx.dev/latest/node/getting-started/nx-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment