All Projects → martpie → monorepo-typescript-next-the-sane-way

martpie / monorepo-typescript-next-the-sane-way

Licence: MIT License
A monorepo example using TypeScript and Next.js

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to monorepo-typescript-next-the-sane-way

Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+341.35%)
Mutual labels:  jest, nextjs, monorepo
Next Advanced Apollo Starter
Advanced, but minimalistic Next.js pre-configured starter with focus on DX
Stars: ✭ 131 (+25.96%)
Mutual labels:  jest, nextjs
Modern Monorepo Boilerplate
Modern Monorepo Boilerplate with Lerna, TypeScript, React/CRA, HMR, Jest, ESLint/TypeScript.
Stars: ✭ 127 (+22.12%)
Mutual labels:  jest, monorepo
Hangar
Hackathon sponsorship made easy
Stars: ✭ 34 (-67.31%)
Mutual labels:  jest, nextjs
portfolio
My personal portfolio website, proudly built with Next.js, TypeScript and Tailwind
Stars: ✭ 165 (+58.65%)
Mutual labels:  jest, nextjs
Moveit
🚀 NLW #4 | React+ TypeScript + NextJS + StyledComponents + Firebase + MongoDb +Axios
Stars: ✭ 39 (-62.5%)
Mutual labels:  jest, nextjs
Express Webpack React Redux Typescript Boilerplate
🎉 A full-stack boilerplate that using express with webpack, react and typescirpt!
Stars: ✭ 156 (+50%)
Mutual labels:  jest, tslint
Opensource
Delivering delightful digital solutions. Open Source packages with combined ~85M/month downloads, semantically versioned following @conventional-commits. Fully powered by Jest, @Babel TypeScript, @Airbnb @ESLint + @Prettier, @YarnPKG + @Lerna independent versioning, GH @Actions & automated dep updates with @RenovateBot.
Stars: ✭ 459 (+341.35%)
Mutual labels:  jest, monorepo
Lerna Yarn Workspaces Monorepo
🐉 A Monorepo with multiple packages and a shared build, test, and release process.
Stars: ✭ 201 (+93.27%)
Mutual labels:  jest, monorepo
mock-spy-module-import
JavaScript import/require module testing do's and don'ts with Jest
Stars: ✭ 40 (-61.54%)
Mutual labels:  jest, monorepo
ng-mono-repo-starter
Angular Mono Repo Starter
Stars: ✭ 79 (-24.04%)
Mutual labels:  jest, monorepo
Egghead Next
The frontend for egghead.io.
Stars: ✭ 896 (+761.54%)
Mutual labels:  jest, nextjs
Next Right Now
Flexible production-grade boilerplate with Next.js 10, Vercel and TypeScript. Includes multiple opt-in presets using Storybook, Airtable, GraphQL, Analytics, CSS-in-JS, Monitoring, End-to-end testing, Internationalization, CI/CD and SaaS B2B multi single-tenancy (monorepo) support
Stars: ✭ 671 (+545.19%)
Mutual labels:  jest, monorepo
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (+9.62%)
Mutual labels:  jest, monorepo
react-component-library-lerna
Build your own React component library managed with lerna, presented with storybook and published in private npm registry.
Stars: ✭ 55 (-47.12%)
Mutual labels:  jest, monorepo
Nextjs Ts
Opinionated Next JS project boilerplate with TypeScript and Redux
Stars: ✭ 134 (+28.85%)
Mutual labels:  jest, nextjs
Typescript Library Starter
Starter kit with zero-config for building a library in TypeScript, featuring RollupJS, Jest, Prettier, TSLint, Semantic Release, and more!
Stars: ✭ 3,943 (+3691.35%)
Mutual labels:  jest, tslint
Entria Fullstack
Monorepo Playground with GraphQL, React, React Native, Relay Modern, TypeScript and Jest
Stars: ✭ 434 (+317.31%)
Mutual labels:  jest, monorepo
100 Days Of Code Frontend
Curriculum for learning front-end development during #100DaysOfCode.
Stars: ✭ 2,419 (+2225.96%)
Mutual labels:  jest, nextjs
tangerine-monorepo
A "fast" TypeScript-based Node.js monorepo setup powered by esbuild & turborepo
Stars: ✭ 191 (+83.65%)
Mutual labels:  jest, monorepo

Monorepo + TypeScript + Next.js: The Sane Way

This repo is an experiment to set-up a monorepo for a Next.js project using modules located in other directories. Everything is not perfect and "real-world" ready, but it should be a good first step.

  • Strict TypeScript: potential bugs are not an option
  • Transpiled server-side code: needed if you are going to re-use modules for both client and server-side Not anymore, Next.js is plenty powerful now and does not need it anymore in 99% of the cases
  • Jest
  • TypeScript
  • ESLint (now included in Next.js 10)
  • Transpile local packages with Next.js on-demand + HMR

My approach completely changed after a couple of projects, I realised the previous approach of having common configuration files was a bad practice:

  • Not a true monorepo where every subfolder is a separate app
  • Difficult to deploy and test on CI

Now, configuration files are repeated in each sub-folders, which means you need to be more careful regarding config and dependencies versions, but things are much easier to manage for developers and text editors.

Todos

  • GitHub actions sample
  • ESLint + Jest everywhere

More in details

TypeScript

The config is at the root of each project: <root>/<sub-project>/tsconfig.json.

Unit-tests

Jest is used for unit tests and all test files should be put in __tests__ folders to match the Jest philosophy and not pollute your directories too much.

The config is at the root of each project: <root>/<sub-project>/jest.config.js and all the tests can be run with npm run test:unit in each folder.

Linting

npm run test:lint

Root folder

Put everything you want there, a Next app, shared code, a react-native app, a CRA, even Wordpress if you want.

Next.js and local modules

Next.js will transpile modules thanks to the next-transpile-modules package. Transpiled modules can be changed by editing the transpileModules option in website/next.config.js.

This setup works thanks to npm symlinking local dependencies in website/'s node_modules folder. Yarn workspaces would work as well (though requiring some adaptation from this bolerplate).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].