Broadcasting Server logs to browser 📡

In this tutorial, we will learn how to broadcast our server-side logs to browser for making development much more easier if you have 2–3 team members working on same project

Why we need this ?

There are a lot of reasons to do this thing but mainly we can use this thing to simplify our development process. It is good if front-end developers also see what is happening behind the scenes.

Suppose you have a dev server and there are an API server running on it. Developers are accessing that API server for building Web or Mobile Applications. Sometimes while building the application, due to some false data, the API server get crashed and returns 502. In that case if you have direct server logs, you can see the cause of the error and fix that issue.



  1. Run your NodeJS application and pipe rtail with it. i.e

node app.js | rtail --id api --host --port 9999

2. Add this as start script in your package.json.

// package.json
"name": "rtail-demo",
"version": "1.0.0",
"scripts": {
"start": "node app.js | rtail --id api --host --port 9999"
"license": "MIT",
"dependencies": {
"express": "^4.16.2",
"morgan": "^1.9.0"

3. Use PM2 to run your application as a process.

pm2 start npm -- start

4. Run rtail-server which will work as a reciever

rtail-server --web-version stable

⚠️ You can run rtail-server as a process also using PM2. Execute :
 pm2 start rtail-server.

5. Visit http://localhost:8888 and you will get a screen like this

rtail client

7. Now all the output logs of your app server will be streamed on the browser.

⚠️ For more rtail options — Visit Github

That’s it!!

Happy Coding !!

🎧 Listening to “Oogway’s Legacy — Kung Fu Panda”, Simply Beautiful and peaceful. Must listen.

If you like this article, please give it some claps 👏 and share it! If you do not like this post or have any type of questions regarding anything that i mentioned in this post. Feel free to ask me. Just post an issue in my “Ask Me Anything” by clicking here.

For more like this, follow me on Medium or Twitter. To ask a Question visit this link. More about me on my website.