Fireship · @fireship
Nest on Cloud Functions
Uploaded August 16, 2019 · Length 4:23
Summary
Combine Nest.js with Cloud Functions for scalable server-side applications.
- nestjs
- cloud functions
- firebase
- nodejs
- serverless
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
Nest j/s and firebase cloud functions
- 0:02
both are awesome tools for node
- 0:03
developers and today you'll learn how to
- 0:05
combine the two together but first I'd
- 0:07
like to welcome you to a new series
- 0:08
called the more you code where we'll
- 0:10
cover highly specialized topics in about
- 0:12
two to three minutes and the reason I'm
- 0:14
creating this series is because I have a
- 0:15
massive list of video ideas that just
- 0:17
don't really fit into the 10 to
- 0:19
15-minute format that YouTube prefers so
- 0:21
rather than be a slave to the YouTube
- 0:22
algorithm I'm going to release some
- 0:24
shorter videos that hopefully you find
- 0:26
useful so let me know what you think
- 0:27
about that idea in the comments because
- 0:28
I'll be giving away another t-shirt with
- 0:30
this video and congrats to Paul boma who
- 0:32
is last week's winner so let's just go
- 0:34
ahead and get right into it
- 0:35
we have nest which is a nodejs framework
- 0:38
for building scalable server-side
- 0:39
applications and then we have cloud
- 0:41
functions which is the actual
- 0:42
infrastructure that allows a server-side
- 0:44
application to scale infinitely sounds
- 0:46
like a pretty good match if you ask me
- 0:48
so let's look at two different ways we
- 0:50
can combine these two technologies
- 0:51
together friends who were majestic
- 0:54
translucent seeds shooting flaming
- 0:56
arrows I would follow you into the Mists
- 1:01
of Avalon that's me
- 1:03
the first option will look at starts
- 1:05
with a nest application and then brings
- 1:07
in cloud functions the second option
- 1:09
will do the exact opposite start with a
- 1:11
functions project and then bring in nest
- 1:13
so this first option is ideal if you
- 1:15
have an existing nest app that you want
- 1:17
to deploy cloud functions so we'll go
- 1:19
ahead and generate a new nest
- 1:20
application then from the parent
- 1:22
directory we'll go ahead and initialize
- 1:23
firebase functions we don't actually
- 1:25
want the functions directory so just go
- 1:27
ahead and delete it now by default the
- 1:29
firebase functions environment will be
- 1:31
looking for the functions directory so
- 1:33
we'll want to go into the firebase JSON
- 1:35
and change the source to server or
- 1:37
whatever the name of your nest
- 1:38
application is and then we'll want to
- 1:40
install the dependencies that we would
- 1:41
normally use in the functions
- 1:43
environment like firebase functions
- 1:44
admin Express and then also nest Jas
- 1:47
platform Express now when cloud
- 1:49
functions attempts to run your code it
- 1:51
will be looking for the main field in
- 1:52
the package.json and we'll set that up
- 1:54
as the dist index.js file and then
- 1:57
you'll also want to set the node engine
- 1:59
to 8 or 10 or whatever version you want


