Nest on Cloud Functions
Key Takeaways
This video provides a quick setup guide for NestJS and Firebase Cloud Functions, making a Nest app serverless
Full Transcript
Nest j/s and firebase cloud functions both are awesome tools for node developers and today you'll learn how to combine the two together but first I'd like to welcome you to a new series called the more you code where we'll cover highly specialized topics in about two to three minutes and the reason I'm creating this series is because I have a massive list of video ideas that just don't really fit into the 10 to 15-minute format that YouTube prefers so rather than be a slave to the YouTube algorithm I'm going to release some shorter videos that hopefully you find useful so let me know what you think about that idea in the comments because I'll be giving away another t-shirt with this video and congrats to Paul boma who is last week's winner so let's just go ahead and get right into it we have nest which is a nodejs framework for building scalable server-side applications and then we have cloud functions which is the actual infrastructure that allows a server-side application to scale infinitely sounds like a pretty good match if you ask me so let's look at two different ways we can combine these two technologies together friends who were majestic translucent seeds shooting flaming arrows I would follow you into the Mists of Avalon that's me the first option will look at starts with a nest application and then brings in cloud functions the second option will do the exact opposite start with a functions project and then bring in nest so this first option is ideal if you have an existing nest app that you want to deploy cloud functions so we'll go ahead and generate a new nest application then from the parent directory we'll go ahead and initialize firebase functions we don't actually want the functions directory so just go ahead and delete it now by default the firebase functions environment will be looking for the functions directory so we'll want to go into the firebase JSON and change the source to server or whatever the name of your nest application is and then we'll want to install the dependencies that we would normally use in the functions environment like firebase functions admin Express and then also nest Jas platform Express now when cloud functions attempts to run your code it will be looking for the main field in the package.json and we'll set that up as the dist index.js file and then you'll also want to set the node engine to 8 or 10 or whatever version you want to use from there we need to create the actual server and we'll do that inside the source directory in this index TS file and this file will create an instance of an express app and then we'll write a function called create nest server and it's sponsibility is to wrap that Express app with our app module and nest then we'll go ahead and call this function and it returns a promise so we'll want to make sure to handle it with then and catch and then the last step is just to export the cloud function which will go ahead and call API and it's just a firebase HTTP function that takes the Express app as its argument and that's all there is to it we can now compile the server with NPM run build that will generate the dist folder and then we can run firebase serve only functions to serve the functions locally or deploy them with firebase deploy only functions then you should be able to make a request to that URL and get a response from the nest application now one thing that I'll mention is that this whole process could be made a lot easier if someone developed a schematic for this not that these setup is all that hard but as your functions already have a schematic that allow you to handle all the setup with a single command and that makes me kind of jealous as someone who primarily uses GCP but let's go ahead and move on to the second setup strategy you may have an existing firebase project that already has its own background functions and you want to add nest to that project for your HTTP functions in that case you would go into the functions directory and manually install the nest dependencies and then you'd likely want to create a nest CLI JSON file in the functions directory to use the nest CLI to automatically generate your code and as you can see here I can now call nest generate for an app module and a controller but at this point we'll get some errors because the cloud functions environment doesn't have things like decorators and able by default we can fix that by going to the TS config and then we'll add the options that would normally be present in a nest app from there we'll go into the index TS file and write these same exact code that we wrote in the previous example and now we can run npm run serve to serve the functions locally or firebase deploy only functions to deploy them and that gives you another option to set up an sas with cloud functions become best friends yep I'm gonna go ahead and wrap things up there but you can expect more nest content in the near future if this video helped you please like and subscribe and consider becoming a pro member at fire ship IO thanks for watching and I will talk to you soon [Music]
Original Description
A quick setup guide 🍳 for NestJS and Firebase Cloud Functions. Two strategies for making your Nest app serverless in the first episode of *The More you Code*. https://fireship.io/snippets/setup-nestjs-on-cloud-functions/
#nest #js #serverless
Don't forget to take the quiz 🤓
iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://play.google.com/store/apps/details?id=io.fireship.quizapp
Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Fireship · Fireship · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Angular 4 Development and Production Environments with Firebase
Fireship
OAuth with Angular and Firebase Tutorial
Fireship
Anonymous Authentication with Angular and Firebase - Lazy Registration
Fireship
Angular Router Guards for Firebase Users
Fireship
Angular Firebase CRUD App with NoSQL Database Tutorial
Fireship
Upload Files from Angular to Firebase Storage
Fireship
How to Deploy an Angular App to Firebase Hosting
Fireship
Sharing Data between Components in Angular
Fireship
Loading Spinners for Asynchronous Firebase Data
Fireship
Angular 4 Transactional Email with Google Firebase Cloud Functions
Fireship
Firebase Database Rules Tutorial
Fireship
Autocomplete Search with Angular4 and Firebase
Fireship
Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Fireship
Angular Drag-and-Drop File Uploads to Firebase Storage
Fireship
Text Translation with Firebase Cloud Functions onWrite and Angular 4
Fireship
Custom Usernames with Firebase Authentication
Fireship
Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Fireship
Simple Pagination with Firebase and Angular 4
Fireship
How to Connect Firebase Users to their Data - 3 Methods
Fireship
Add Toast Message Notifications to your Angular App
Fireship
Facebook-Inspired Reactions System with Angular and Firebase
Fireship
Learn NgModule in Angular with Examples
Fireship
Lazy Loading Components in Angular 4
Fireship
Stripe Checkout Payments with Angular and Firebase - Part 1
Fireship
Process Stripe Payments with Firebase Cloud Functions - Part 2
Fireship
Selling Digital Content in Angular with Stripe Payments - Part 3
Fireship
Angular 4 Full Text Search with Algolia - Part 1
Fireship
Algolia with Firebase Cloud Functions - Part 2
Fireship
Firebase Phone Authentication in Angular 4
Fireship
Top 7 RxJS Concepts for Angular Developers
Fireship
Learn Angular Animations with 5 Examples
Fireship
Advanced Firebase Data Filtering (Multi-Property)
Fireship
Realtime Maps with Mapbox + Firebase + Angular
Fireship
Angular Reactive Forms with Firebase Database Backend
Fireship
Send Push Notifications in Angular with Firebase Cloud Messaging
Fireship
Top 7 Ways to Debug Angular 4 Apps
Fireship
Infinite Scroll with Angular and Firebase
Fireship
Use TypeScript with Firebase Cloud Functions
Fireship
Realtime Graphs and Charts with Plotly and Firebase
Fireship
Role-Based User Permissions in Firebase
Fireship
User Presence System in Realtime - Online, Offline, Away
Fireship
Location-based Queries with GeoFire and Angular Google Maps
Fireship
Angular ngrx Redux Quick Start Tutorial
Fireship
Angular Ngrx Effects with Firebase Database
Fireship
Progressive Web Apps with Angular
Fireship
Angular Ngrx with Firebase Google OAuth User Authentication
Fireship
RxJS Quick Start with Practical Examples
Fireship
Send SMS Text Messages with Twilio and Firebase
Fireship
Firebase Database Performance Profiling
Fireship
Native Desktop Apps with Angular and Electron
Fireship
Subscription Payments with Stripe, Angular, and Firebase
Fireship
Firestore with AngularFire5 Quick Start Tutorial
Fireship
Angular HTTP Client Quick Start Tutorial
Fireship
Google Sign-In with Firestore Custom User Data
Fireship
Star Review System from Scratch with Firestore + Angular
Fireship
Angular Chatbot with Dialogflow (API.ai)
Fireship
Learn @ngrx/entity and Feature Modules
Fireship
Infinite Scroll Pagination with Firestore
Fireship
Faster Firestore via Data Aggregation
Fireship
Contentful - CMS for Angular Progressive Web Apps
Fireship
Related Reads
📰
📰
📰
📰
Kimi K3 is so popular Moonshot ran out of GPUs and paused new sign-ups
The Next Web AI
What smart people are saying about IBM’s AI warning and SaaSpocalypse fears
Dev.to AI
Dutch company ASML is $300bn from a trillion. AI could close the gap
The Next Web AI
ARR 2026 Meta Review score [D]
Reddit r/MachineLearning
🎓
Tutor Explanation
DeepCamp AI