Skip to main content
Submitted by lwinmaungmaung on
NestJS standalone

NestJS standalone is included in documentation. However, You will not know exactly what to do if you are not familiar with it. In this blog, I would like to share what it's used to achieve and how we can use it for some reasons.

NestJS standalone and Push notification 

The main selling point on NestJS is it's basic feature, NodeJS. In normal server apps like PHP, it is some sort of listen and reply. It means no push notification. The hook or entry must be available or declared to use it properly. It does not have subscribe or monitor live to solve this problem.

NodeJS has a leap advantage on this sort of thing. If you need to subscribe to any listener, you don't have to wait in timely manner or long pooling to wait everything. You don't need any timely hit to the server. 
 


My use case with standalone

I use standalone for a reason. When the use push something on the my payment channel. The bank will send the notification on my phone. I will share the notification via Pushbullet or some other notification platform and update my database immediately.

The first step I am using is Pushbullet. It works extremely well but at that time, PHP has limited functionality to read every notification in real time. 

There is a question arisen that why don't I use a hook in my PHP or Laravel apps and expose a URL for the hook? 

The simple answer is no. I don't want to expose the URL. Expose means public. Public means anyone is accessible. Reverse of this is limited. Limited means authentication required. Simple vs complicated.

That is where standalone comes in. I request and listen the API from Pushbullet and just simple lines of code without any cron or timely manner. 

When the request comes in, I update the database and notify my server to send the payment message. 

Now, the problem is solved without using any large security consideration.

So NestJS standalone is really great and when I see it again, it reminds me of my old times.

Find on my YouTube channel about my work in review of standalone.