Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
TypeScript 3 monorepo example using Next.js, Yarn workspaces, and a shared React component package.

A full-stack Next.js TypeScript template focused on functionality over UI, featuring Zustand, TanStack Query, and ESLint 9 support.
typescript-monorepo-next-example is a Boilerplate sample that shows how to structure a TypeScript 3 monorepo around a Next.js application and a shared React component package. It provides step-by-step commands to create the workspace from scratch, using Yarn workspaces for dependency management and separate packages for the app and reusable UI components.
This repository is a working example of a TypeScript monorepo that combines a Next.js app (packages/app) with a shared component library (packages/component-a). It takes no input; you clone or replicate the structure to get a runnable Next.js site that imports a component from a separately managed package. The project runs on Node with Yarn and is maintained by the GitHub account deptno, which also publishes related example repos.
The setup starts by creating a root directory and running yarn init -y -p, then editing package.json to enable workspaces and define scripts. Next it creates packages/app with Next.js and TypeScript dependencies, configures next.config.js, .babelrc.js, and tsconfig.json, and adds a pages/index.tsx that imports from the component package. A separate packages/component-a folder holds the shared component and its own tsconfig.json. After running yarn, you compile the component with yarn build:packages and start the app with yarn start.
No, the README states that TypeScript 3 or above is required, so earlier versions will not work.
You would follow the pattern used for packages/component-a: create a new folder under packages/, run yarn init, add the necessary dependencies, and reference it from the app's package.json so Next.js can import it.
Run yarn to install dependencies, yarn build:packages (or yarn build:packages:watch) to compile the shared component, and yarn start to launch the Next.js development server.
The repository is described as an example, so it is intended as a reference for structuring a TypeScript monorepo rather than a fully featured production template.