Giter Club home page Giter Club logo

monorepo-example's Introduction

Monorepo Example

This project was generated using Nx.

POC checkilist

  • Setup Monorepo with Nx
  • Install NextJS with Typescript support
  • Support for styled-components
  • Shared ui-components
  • Storybook configuration for existent components
  • Install main React dependencies: react-query, formik
  • Absolute paths for apps in tsconfig.base.json
  • Microfrontends POC: embed app within another
  • Support for NextJS Dynamic routing to redirect Experiments
  • Feature Flag support with Optimizely
  • Test SSR component and route
  • State management using React hooks (Redux style)
  • Define Styled Components Theme
  • PWA configuration
  • Consider Tailwind as addition of styled-components
  • Document nx code generators to maximize reusability and structure
  • Docker container
  • Deployment with Github Actions
  • Playwright for E2E testing

App Structure

  • UI Components
    • Navbar
    • Bottom navbar (mobile)
    • Journal
    • Notifications (push nots?)
  • New insights-app
    • Daily insights (education)
  • New discussions-app
    • Secret Chats
  • New daily-notes
    • Edit text

Tech Stack

  • Nx (Nrwl)
  • React
  • NextJS
  • Storybook
  • React Query
  • Styled Components
  • Formik

Generate an application

Run nx g @nrwl/react:app my-app to generate an application.

Generate a library

Run nx g @nrwl/react:lib my-lib to generate a library.

You can also use any of the plugins above to generate libraries as well.

Libraries are shareable across libraries and applications.

Nx cheatsheet and tools

Create a new App or Lib

When using Nx, you can create multiple applications and libraries in the same workspace.

๐Ÿ’ก You can use any of the plugins in the community to generate applications

Create new React app

npx nx g @nwrl/react:app <app_name>

Create new NextJS app

npx nx g @nrwl/next:app <app_name>

Create a new React Component library

npx nx g @nwrl/react:lib <lib_name>

Code scaffolding

Whit the help of generators, Nx allows to do code scaffolding

Generate a new Reacn Component

npx nx g @nrwl/react:component BottomNav --project=ui-components --style=styled-components --export

Visualize packages dependencies

npx nx dep-graph

Development

Start app in dev mode

To Run the dev server.

npx nx insights-app:serve

Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Storybook

Add Storybook config to a app or lib

nx g @nrwl/react:storybook-configuration <project-name>
`

> This also regenerates `stories` for all components that don't have any defined

#### Run storybook
```sh
npx nx run ui-components:storybook
`

## Build

Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io).

Run `nx affected:test` to execute the unit tests affected by a change.

## Running end-to-end tests

Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).

Run `nx affected:e2e` to execute the end-to-end tests affected by a change.

## Learning resources

- [Nx Official Documentation](https://nx.dev)
- [Full React and Nx Course โ€“ Egghead](https://egghead.io/courses/scale-react-development-with-nx-4038)
- [Using Storybook and Nx to build your Design System](https://blog.nrwl.io/build-your-design-system-with-storybook-nx-e3bde4087ad8)

monorepo-example's People

Contributors

fjcero avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.