Code like Google does with Nx

Diego Juliao

  • FullStack JavaScript Engineer 👨🏻‍🔬
  • Angular Package Creator 🅰️📦
  • Creator of ng deploy for @npmjs
  • Quality Advocate 🥑
  • Bike Traveler 🚴‍♂️

I was Born 👶

But I Live 🏠

ngx-deploy-npm

How does Google Code?

Case of Study

Distributed on NPM 📦

23 📦

Compose Angular Ecosystem

How to manage all those packages

With Separated Repos?

Let's See and Example

Let's Start a StartUp!

ACME Company

VATIN Challange

| CTRY |   Name   | Ex            |
| :--- | :------: | :------------ |
| 🇩🇪   | USt-IdNr | DE999999999   |
| 🇫🇷   |  n° TVA  | FRXX999999999 |
| 🇨🇴   |   NIT    | 11,338,854-3  |
| 🇻🇪   |   RIF    | J-30595991-8  |

ACME Company

VATIN

Value Added Tax Identification Number

ACME Company

VATIN Challange

Events

🇩🇪

 

🇫🇷

🇩🇪 🐞

 

🇨🇴

 

Product Team

Internal Tools Team

ACME Company

VATIN Challange

Events

🇩🇪

 

🇫🇷

🇩🇪 🐞

 

🇨🇴

 

Internal Tools Team

Product Team

🇯🇵

 

ACME Company in 5 Years

🇩🇪

 

🇦🇺

 

🇫🇮

 

🇲🇷

 

🇩🇯

 

🇨🇭

 

🇨🇦

 

🇦🇩

 

🇨🇳

 

🇲🇽

 

🇧🇭

 

🇧🇷

 

🇩🇯🐞

 

🇨🇦🐞

 

🇩🇪

 

🇦🇺

 

🇫🇮

 

🇲🇷

 

🇩🇯

 

🇨🇦

 

🇦🇩

 

🇨🇳

 

🇲🇽

 

🇧🇭

 

🇧🇷

 

🇨🇭🐞

 

🇩🇯🐞

 

🇨🇦🐞

 

Main Problems

  • Maintainability
  • Scalability
  • Agility
  • Code Reuse

Solution

Monorepo

A monorepo is a software development strategy where code for many projects are stored in the same repository

Source: Wikipedia

ACME Monorepo

Advantages

  • Ease of code reuse
  • Cross-project changes
  • Collaboration across teams
  • Large Scale Refactoring

What is NX?

Who founded NX?

Victor Savkin

Jeff Cross

Modern Tools

Applications and Libraries

📦

📦

📦

# Angular Library
nx g @nrwl/angular:library my-lib

# React Library
nx g @nrwl/react:library my-lib

# Typescript Library
nx g @nrwl/workspace:library my-lib

Libraries

# Angular Application
nx g @nrwl/angular:application my-app 

# React Application
nx g @nrwl/react:application my-app

# NestJS Application
nx g @nrwl/nest:application my-app

# Express Application
nx g @nrwl/express:application my-app

Applications

Dependency Graph

  • lint
  • test
  • build
  • e2e

Affected

Who is Using Nx?

Source: Nx Web Page

Do I need a large project to use Nx?

It Works Perfectly Fine!

Where to Learn?

Coming Soon

Bazel

Build and test Java, C++, Android, iOS, Go and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

Source: Nx Blog

Conclusion

Conclusion

  • Reuse code through our organization
  • Cross-project changes
  • Ease the maintainability

Monorepo is a just repo with all your projects

Conclusion

  • Create Projects and Libs
  • Run script only for the affected
  • Only for Typescript (for now)

Nx is an Extensible Dev Tools for Monorepos

Conclusion

Nx

Tha

Diego Juliao

  • FullStack JavaScript Engineer 👨🏻‍🔬
  • Angular Package Creator 🅰️📦
  • Creator of ng deploy for @npmjs
  • Quality Advocate 🥑
  • Bike Traveler 🚴‍♂️

Twitter: @ngVenezuela

Telegram: @ngVenezuela

Angular Venezuela

Code Like Google Does with Nx

By Diego Juliao

Code Like Google Does with Nx

  • 770