next-workspaces
next-workspaces copied to clipboard
Next-js + yarn workspaces + typescript
Intro
- We are using yarn workspaces together with monorepo approach
- Each folder in this repo is a separate node module if it also includes package.json
- Next.js helps us with SSR and also with splitting the whole app into smaller peaces (apps). We were inspired by a so called Multi Zones feature
Our Structure
-- catalog // app for rendering shop products
-- checkout // app for handling cart and checkout process
-- core // shared functionality
Install
From a root folder:
yarn install
Build all apps
From a root folder:
yarn build
Run
Run all apps simultaneously
From a root folder
yarn start // run builded versions
yarn dev // run dev versions with hot reloading
Run one app separately
From an app folder
cd catalog
yarn start // run builded version
yarn dev // run dev version with hot reloading