Fireship · @fireship
Nx Quickstart - How to Scale a JavaScript Project
Uploaded June 4, 2019 · Length 9:40
Summary
Learn how to use Nx to simplify project organization, share code, and scale a JavaScript project with multiple front-end applications and a back-end.
- nx
- javascript
- project organization
- code sharing
- mono repo
- angular
- react
- typescript
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
one of the biggest challenges of
- 0:01
building a full stack web application is
- 0:03
managing complexity if you're building a
- 0:05
serious product you likely have multiple
- 0:07
front-end applications that communicate
- 0:09
with a back-end that share interfaces
- 0:10
with multiple team members that need to
- 0:12
collaborate efficiently today we're
- 0:14
going to look at NX from Narwhal a tool
- 0:16
that can dramatically simplify the way
- 0:17
you organize tests and share code
- 0:19
between multiple JavaScript applications
- 0:21
if you're new to the channel like and
- 0:22
subscribe and you can find the full
- 0:23
tutorial on NX dev the tool itself is
- 0:26
based on the best practices developed at
- 0:28
Google to scale thousands of
- 0:30
applications across thousands of
- 0:31
developers in a single mono repo but you
- 0:34
don't need to be operating at Google
- 0:35
scale to see the benefits of NX it can
- 0:37
be a very powerful tool for projects of
- 0:39
all sizes and not just angular but full
- 0:41
stack JavaScript in general so why do
- 0:43
you big companies like Google Microsoft
- 0:44
and Facebook like to manage their code
- 0:46
in mono repos or in other words use a
- 0:48
single git repository to manage multiple
- 0:50
apps and libraries the simple answer is
- 0:52
that this approach helps manage
- 0:54
complexity by applying best practices
- 0:56
organization-wide this delivers
- 0:58
consistency and predictability in your
- 0:59
code while also maximizing the ability
- 1:01
to share code between projects but you
- 1:04
can't just put all of your code in a
- 1:05
single repo and expect to reap the
- 1:07
benefits you need the right tool in
- 1:08
place to test build and deploy your apps
- 1:10
at scale and that's where NX comes in
- 1:12
over the next 10 minutes we'll look at
- 1:14
how complexity can grow very quickly in
- 1:15
a full stack project we'll build two
- 1:17
front-end applications one with angular
- 1:19
and one with react and then a shared
- 1:21
back-end with nest on top of that we'll
- 1:23
add multiple shared libraries that can
- 1:25
be used by all three of these apps let's
- 1:27
go ahead and create a new NX workspace
- 1:28
to see how it can help us manage a
- 1:30
project like this from the command-line
- 1:32
run npx create NX workspace followed by
- 1:35
your organization or product name this
- 1:38
will give us an empty workspace and
- 1:39
we'll be writing most of our code in the
- 1:41
apps and Lidz directories right out of
- 1:43
the gate NX is going to help you
- 1:44
separate your shared code from your
- 1:46
application code for example you might
- 1:48
have two front end applications one for
- 1:50
your customers and one for your
- 1:51
employees those apps would live in the
- 1:53
apps directory but they might share
- 1:55
common UI elements that would go in the
- 1:56
libs directory so this works really well
- 1:58
when you have a design system where you


