Develop application in Angular, Node.js, NestJS and Firebase - node.js

I have an application developed in Angular, Nodejs and Firebase.
At the moment all the logic and business rule of my application in Angular is within the services that Angular provides, so I need to perform dependency injection in my components for the consumption of the data of the Cloud Firestore.
My company is expanding with other applications that are also in healthcare, and I need to create a backend to handle every business rule of my application in a separate way from my Angular project.
I recently met NestJS, and I would love to use it as the backend of my application developed with Angular.
My question is whether you can restructure my application in Angular, Node.js, and the persistence of Cloud Firestore and Firebase Authentication offline data by creating a backend with Nestjs so that you can continue to use the benefit of working with my application on offline mode.
A summary of what I need:
1. Create a backend with Nestjs where my entire business rule will stay.
2. Consume the backend written in Nestjs in my Angular application so that you can insert, update, and delete data from my database in Cloud Firestore.
3. Reuse modules in other applications Angular or other front-end development frameworks.
4. In my Angular application, I do not want to make HTTP requests to consume the data from my backend, since I want to use the benefits of Cloud Firestore persistence of offline data.
I realized that there is the Cloud Firestore API RPC, could I work with NestJS gRPC? Reminding me that I would like to keep data persistence offline in my Angular application.
Is it possible to have a well-written system with Angular, Node.js, NestJs and the features that Firebase offers?

As far as I have understood your question, you want localstorage functionality in the app, you want structure of the app like
frontend is always getting data from localstorage
whenever app gets access to network, it refreshes its localstorage with cloud firestore behind the scenes so that app will never get slow
Please correct me if I am wrong

No support for this use case yet.
Learn more about current limitations here:
https://www.youtube.com/watch?v=oDvdAFP6OhQ&t=527s

Related

Looking for an initial web application generator like JHipster but with NodeJs

I'm looking for a tool what I can use for generate an initial web application.
Previously I used JHipster for my Applications, which uses Java Spring on server side, but currently I don't want to maintain a Spring backend only a NodeJs.
Requirements:
using Angular as frontend
using NodeJS as backend
using Firebase for (authentication, collection and data storage)
pre built Authentication mechanism (including user register and login)
Do you have any suggestion?
Or how can I speed up these initial steps?
you could use https://github.com/jhipster/generator-jhipster-nodejs it does not use Firebase

Can we say Cloud Firestore a web server?

I have done angular project using cloud firestore as my database for my school and I need to mention which server I have used in this project.
As said on https://firebase.google.com/docs/firestore/ is a database so it is incorrect to call it a web server. Anyway you should point that you used this technology, but as a cloud database.
Cloud Firestore is a flexible, scalable database for mobile, web, and
server development
For "school" project and minimal architecture, you can use cloud firestore as your primary database. You can access database directly from your native or hybrid app.
If you want to build a web server, then I think Cloud Functions should be better answer.

Creating an custom API using existing API

I am trying to set up a custom API for my application. This is a corporate application that I installed in my environment. The application comes with it's own out-of-the-box REST API, but I'm looking for a way to create my own custom API leveraging the existing one. The reason I want to create a custom API is because of all the customizations that have been made to the underlying database. I'm looking at using Node.js and the Express application framework to create the custom API, but all the use cases I've seen for this are for creating new APIs from scratch. I guess my question would be, how can I integrate my existing web services API into a Node.js (Express) set up. My existing web services API runs an Apache Tomcat web service. This publishes the existing web service endpoints in a format like this:
http://://?fields=,...
I'm looking for tips, pointers or something that can point me in the right direction. If there are any alternate (better) solutions available aside from Node.js (Express) I am open to exploring that as well.

Is it good practice to have a React Native app Publish directly to a Google Pub/Sub topic?

We are building a serverless platform consisting of Android and iOS apps build using React Native and on the backend we use Google Cloud Functions and Firebase. Given that some actions are handled by multiple Cloud Functions, we thought it would be a good idea to have the apps Publish to a Pub/Sub topic and then have the different Cloud Functions fire Subscribe events when the apps publish. Is it good practice to have a React Native app Publish directly to a Google Pub/Sub topic or should we have an HTTPS Cloud Function do the topic publishing?
If it is good practice for the apps to do the Pub/Sub, any tips on how to handle the credentials? There is a Node.js client but not a React Native one in particular. The main issue seems to be with the environmental variable you are supposed to set (e.g. export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/[FILE_NAME].json").
Thanks!
If you are going to communicate with firebase (or any server) from the client´s device, best practice is so that you use clients authentication, and not some secure token for all.
There is the benefit, that firebase comes with client authentication.
I would look into 2 ways.
use firebase directly as a queue. it´s actually capable of doing that just fine and comes automatically with firebase authentication. (see https://github.com/firebase/firebase-queue)
use firebase cloud functions. The benefit is, authentication is automatically included if you logged in the user with firebase authentication. From there, you can write a simple cloud function to add data to your queue. (see https://firebase.google.com/docs/functions/callable)

Is it a good idea to build a db layer of a webpage only with REST WebServices?

We want to build a website, which interact with database only with REST WebServices. So if we want to build a mobile app later, the app can simple use these WebServices. So we thought we will use Python/Django or PHP/Yii to build the database layer, made only of REST WebServices. In the frontend backbone.js interact with the WebServices to do CRUD-Operations with the database.
Is that a good idea with regard to performance and security? How do big sites and apps handle the interaction between frontend and database layer nowadays?
Personally I think this is a bad idea but only slightly.
Instead of having a logic-less CRUD only array of web services why not instead create an array of functional web services. That way you can keep your business rules server side.
Maybe you already had this in mind but consider that whether the user is on your mobile app or your website you don't want them creating usernames with strange characters in them. A strictly CRUD array of web services wouldn't check for these kinds of business rules.

Resources