Ready for development!
A template of a monorepo to create a react application.
- Monorepo tooling (Yarn workspaces and Lerna)
- Precommit validation (Husky and Lint-staged)
- Linting with recommended rules (Eslint,Prettier and Stylelint)
- Github actions (test, lint, etc)
- Storybook (with HMR)
- CSS in Js (Emotion)
- HMR on packages (React fast refresh)
- App running in CSR and SSR
- Unit testing (Jest and React testing library)
- Bundling (Webpack 5)
- Prevent duplicated versions of packages (Dedubcheck)
- HTTP requests on server/client Isomorphic and state management (Apollo/client)
- Deployed to production (Heroku)
- End 2 End tests (Cypress)
- Auto update typescript project references(Update-ts-references)
- Generator to create packages in the monorepo (Hygen)
- Graphql schema validation and type checking (eslint-plugin-graphql) and (apollo-tooling)
- Automatic create PRs to upgrade versions ([renovatebot])
- Automatic use correct node version ([.nvmrc])
- Automatic create and validate the graphql schema on pipeline
- Jest shared configs easily
- Jest with recommend rules for react/node projects
- Tsconfig with recommend rules for react/node projects (tsconfig/bases)
- Package Manager (Yarn 2)
- Multiple team project handling tool (Codeowners and Merge bot)
- Document how to handle peerdependencies on the monorepo
- Load tests (Artillary)
packages/ // feel free to add more components in this folder
app/ // main app that will use all the components
src/
index.ts
button.tsx
styles.tsx
package.json // everytime you need a new devDependency add it here
tsconfig.json // every package from the monorepo that you import you need to add it to references
storybook/ // storybook that will run all the components
stories/ // feel free to add more components in this folder
header/
button/
index.tsx
index.stories.tsx
package.json // everytime you need a new devDependency add it here
tsconfig.json // every package from the monorepo that you import you need to add it to references
header/ // a header component
button/ // a button component
cypress/
integration/ // include ir all the tests for cypress to run
package.json // everytime you need a new devDependency add it here
tsconfig.json // everytime you add a new package modify this file by adding the new package path
Run all the commands from the root folder The monorepo is built in a way where you don't need to change from the root to run any command
For the schema to donwload correctly you need node 14 instead of 16 because of the following issue: apollographql/apollo-tooling#2415
npx apollo schema:download --endpoint=https://graphql-pokeapi.graphcdn.app/graphql schema.json
npx apollo codegen:generate --localSchemaFile=schema.json --target=typescript --includes=packages/app/**/**.tsx --tagName=gql --addTypename types
yarn
yarn start
yarn start:server
yarn build
yarn watch
yarn lint
yarn test
yarn test:dependencies
yarn storybook
yarn test:e2e
note: you need to start the client
On your project do this steps:
Login in your heroku account
heroku login
This will create a project in the heroku account you loggedin previously
heroku create
Can be master or main the next command depending on your repo
git push heroku master
Note: This part requires you to have a heroku account
They are updated automatically as soon as you do yarn
https://github.com/wixplosives/sample-monorepo
https://baltuta.eu/posts/typescript-lerna-monorepo-the-setup
https://medium.com/loftbr/creating-a-design-system-with-monorepo-bc18e055fb3c
https://dev.to/givehug/next-js-apollo-client-and-server-on-a-single-express-app-55l6
https://github.com/givehug/devto-monorepo
https://www.digitalocean.com/community/tutorials/react-react-router-ssr
https://www.digitalocean.com/community/tutorials/react-react-router-ssr
https://blog.logrocket.com/boost-your-productivity-with-typescript-project-references/
https://github.com/pmmmwh/react-refresh-webpack-plugin/tree/main/examples/typescript-without-babel
https://www.apollographql.com/docs/react/performance/server-side-rendering/
https://dgraph.io/blog/post/apollo-react-hooks-with-typescript/
Feel free to contribute to the project
MIT Β© Joao Ferreira