NodeJS Development

Focused on delivering the most secure and quality solutions, Third Rock Techkno is a reliable NodeJS development company providing clients with high-speed data, improving data exchange as well as retrieval performance through innovative web app solutions. Our developers keep abreast with the latest tools to deliver the most advanced NodeJS development services to transform your idea into reality. We bring the best NodeJS web development services to our clients.

NodeJS development is a fast-growing framework to develop feature-rich backend solutions. This framework is useful in providing high-speed data, improved data exchange, and retrieval performance. Third Rock Techkno’s team of developers possess the knowledge of the latest NodeJS development tools to execute your idea and vision.

NodeJS Services

  • 1. NodeJS API Development and Integration
  • 2. NodeJS CMS Development
  • 3. NodeJS Server Side Development
  • 4. NodeJS Web App Development
  • 5. NodeJS Packages Development
  • 6. NodeJS Plugin Development
  • 7. Custom NodeJS Application Development
  • 8. NodeJS Chatbot Development
  • 9. NodeJS App Upgrade and Maintenance
  • 10. NodeJS Product Support and Maintenance

Our Existing Clients

We cater to a diverse clientele spanning across various industries.

Why Choose Us as Your NodeJS Development Company

Experienced Developers

Our seasoned NodeJs developers have the expertise to build secure, creative and highly-interactive web applications. Whether you are a startup or a small or medium-sized business, our customized solutions effectively cater to your needs.

Trusted Delivery Methods

We employ the agile methodology to keep you in the loop. Our company is known to deliver quality Node JS development services that meet your business goals, timeline, and budget.

Competitive Rates

We offer the most competitive rates on the market. Our personalized and cost-efficient Node JS development services meet different budget needs of our clients from different business verticals across the globe.

Transparent Work Approach

Our Node JS development company ensures complete project visibility right from the time you approach us with your needs. We use email, phone, Skype and other mediums for regular communication with you.

Customer Satisfaction

Our designers, developers, quality analysts, and a project manager – all strive for customer satisfaction. We deliver excellent services that not only align with our clients’ needs but also help them to take their business to the next level.

Client Testimonials

Our WORK speaks louder than our WORD. Find out how we helped clients overcome challenges and succeed.

Smoovr

Very good communication at all stages. Always prompt to reply. Excellent quality of work. The team at Third Rock Techkno was communicative, responsive, and accommodating as they produced high-quality work.

Jonathan Wood, Smoovr

Ontime

It was a pleasure working with the TRT team. Prior to contracting this group, I had a system created that was absolutely terrible and poorly developed. I also worked with a few freelancers that couldnt cut it either. TRT was actually able to execute on our concept and have built a truly solid system for our company.

Karl Pierre, Ontime

Features Of NodeJS Development

Asynchronous & Event-Driven

NodeJs is built to handle asynchronous I/O from the group and is an ideal solution for common web and network development issues. In addition to quick JavaScript execution, the real magic behind Node.js is known as the Event Loop. To meet big volumes demanded by clients, all I/O intensive operations in Node.js perform asynchronously.

Rapid Development

NodeJs application can be scaled in two ways– Horizontal Scaling and Vertical Scaling which further helps improve the application’s performance. In Horizontal Scaling, you can add more nodes to your current system whereas in Vertical scaling you can add more resources to a single node.

Lightweight And Extensible

NodeJs is based on JavaScript which can be executed on the client-side and server-side as well. Additionally, it supports the exchange of data using JSON which is easily consumed by JavaScript. This makes it lightweight as compared to other frameworks. This is the reason why most businesses choose Node JS development services to build their applications.

Blazingly Fast

NodeJs uses the V8 engine which is developed by Google for Chrome. V8 compiles JavaScript into native machine code directly which increases the speed and efficient implementation of the code. This empowers a Node JS development company to build quality web apps at a fast pace.

Community Friendly

NodeJs has a wide community of developers worldwide. They are highly active in the development of new packages or modules to support various types of application development.

Recent NodeJS Development Blogs

30 Jun 2020 | 9 Min Read
6 Types of Applications You Can Build With Node.js

Ryan Dahl first released a basic version of Node.js back in 2009. Since then, Node.js has emerged as the most reliable technology for building the back end of most apps. In this blog, we explore the different types of applications you can build with Node.js. In addition to that, we will also talk about the most famous apps built with Node.js. What is Node.js? Node.js is a JavaScript runtime environment with a formidable ecosystem and is built on Chrome’s V8 JavaScript engine. It is a fast, lightweight, scalable, and efficient environment. Node.js is the world’s largest ecosystem of open source libraries with outstanding features such as an event-driven model, serverless architecture, and many more. Node.js development trends in 2020 [https://www.thirdrocktechkno.com/blog/most-prominent-node-js-development-trends-in-2020/] maximize the value you get out of this framework. Therefore, Node.js is currently the first choice of 98% of the Fortune 500 companies [https://nodejs.org/de/blog/announcements/foundation-advances-growth/]. Not just that, it also tops the list of the most used frameworks and libraries. Source: Stack Overflow Insights [https://insights.stackoverflow.com/survey/2020#most-popular-technologies] Types of applications you can build with Node.js Node.js offers great advantages for a wide range of applications. Following are the top 6 kinds of applications you can build using Node.js: 1. Internet of Things (IoT) Internet of Things (IoT) refers to a network of physical devices such as sensors and beacons that share and exchange data through the internet. The data is normally transferred from devices to servers and from servers to the application that displays the data. Many a time, a single IoT system may consist of a great number of devices. Hence, the task of managing requests and data streams in the IoT system becomes very complex. Node.js serves as the most optimal solution for developing private and/or public IoT systems. Why use Node.js for IoT The biggest reason to choose Node.js for such networks is its remarkable ability to process multiple concurrent requests. Node.js has an event-driven architecture [https://medium.com/edge-coders/understanding-node-js-event-driven-architecture-223292fcbc2d] and facilitates asynchronous data processing. As a result, the servers of Node.js do not get blocked and the data requests are processed conveniently. Secondly, Node.js serves as a smooth and efficient application layer between the IoT devices and the databases that store the information emitted by these devices. Moreover, Node.js has minimal memory requirements. As a result, node.js developers can easily integrate it with single-board controllers like Arduino. These are commonly used in the creation of digital devices that constitute an IoT system. 2. Real-Time Chat Apps A real-time chat is an online communication tool that enables live transmission of text, audio, or video messages. These are based on Instant Messaging (IM) or Internet Relay Chat (IRC) technologies. Of course, they can facilitate both one-to-one and one-to-many group chats. Real-time chat apps are one of the most common types of applications you can build with Node.js.– be it social networking apps or an interactive commercial website. Why build real-time chat apps with Node.js Node.js has an Event API that allows developers to work in an event-driven approach with any data. This functionality greatly helps in implementing server-side events and push notifications. Both of these features are frequently used in real-time communication applications. The event-driven structure of Node.js also allows it to establish and maintain collaboration with WebSockets. A web socket is crucial for a quick exchange of messages between the client and server via one open connection. Thus, Node.js plays a hugely beneficial role in real-time chat apps. Node.js is capable of carrying out real-time messaging with lower latency and faster data transfer if you choose to install the WebSockets on the server-side as well as on the client-side. 3. Single-Page Applications (SPAs) A single-page application is a web application that fits on a single page on the browser. Instead of loading the entire new page, the app dynamically rewrites the current web page. This gives users an experience similar to that of a desktop app. Today, SPAs are widely used to create social networking apps, project management tools, and much more. Gmail is the most practical example of an SPA. It resorts to AJAX for seamless updates of recent messages. Why build SPA with Node.js Node.js is a robust runtime environment that can handle asynchronous calls and heavy I/O workloads with great efficiency. This makes it well-suited for complex SPAs. The event loop characteristic of Node.js authorizes it to delay multiple concurrent requests from the client. Thus, it ensures a subtle and consistent transition accompanied by seamless data updates. Lastly, Node.js is written in the same language (JavaScript) as used to build SPAs. This makes the work of developers quite simple because they can use the same language and data structure on the server and the client-side. In turn, the development process speeds up and enhances the maintainability of the SPAs. 4. Real-Time Collaboration Tools Real-time collaboration tools are the ones that enable multiple users to work on the same app simultaneously. There is a wide range of collaboration tools that offer us a bunch of software solutions. Some of the prominent use cases are project management (Trello) and collaborative editing of documents (Google Docs). Why build real-time apps with Node.js Real-time collaboration apps present a case similar to that of real-time chats. Node.js asynchronous and event-based architecture provides a great edge in building these apps. Collaboration apps generate multiple events and I/O requests simultaneously. For example, a group of students can edit the same document or even the same paragraph of that document. In this scenario, Node.js utilizes the WebSockets and Event API to make sure that the requests and data submitted by multiple users do not hang the server and that all the server-side data is delivered to the client without any delay. The push notifications given by Node.js promptly update the collaboration environment. This is to ensure that all the users have a single and coherent view of the application. 5. Streaming Apps Application streaming is a type of on-demand software distribution. They differ from remote server app in nature. Application streaming requires you to download only certain parts of the application on-demand on the device, while the other parts can be downloaded later as and when they are needed. This prevents the overloading of the server and the local computer. You can also run the application perfectly without any connection at all after it is completely downloaded. Streaming apps like Netflix are certainly one of the best types of applications you can build with Node.js. Why build streaming apps with Node.js An inherent feature of Node.js, Stream API, makes it an excellent choice for designing such streaming apps. Moreover, Node.js possesses a comprehensive interface of readable and writable streams that can be controlled and processed effectively. 6. Apps with microservices architecture When you build an application with a microservices architecture, you build it as a collection of separate modules. Each module plays a specific role in the app functionality and is developed and tested constantly. When the team has built all the modules, they integrate them to form the complete application. Large enterprise applications greatly benefit from this architecture type. This is because their development teams are vast and distributed geographically. This approach helps the entire team stay on track. Why use Node.js for microservices architecture Native Node.js frameworks like Koa and Express which enable you to create some highly flexible microservices modules. When integrated with Docker, Node.js contains microservices in their respective containers in a clean, well-differentiated manner. As a result, there is little chance of microservices hampering one another’s functionalities. Node.js is extremely lightweight and has minimal resource requirements. So building microservices with Node.js makes applications efficient and quickly deployable. Top Famous Apps Built With Node.js Because of its advanced features and limited resource requirements, a large number of corporate giants have adopted Node.js application development. So here is a list of 5 Node.js applications built by famous companies. 1. Node.js in PayPal PayPal, the world’s most popular online payment platform, decided to use Node.js in its application in 2013. Having to write the front end and the back end codes with different languages was the main challenge PayPal’s engineering team was facing. Node.js was the only way for them to solve this problem. Jeff Harrell, Director of Engineering at Paypal, explains, > “Node.js helps us solve this by enabling both the browser and server applications to be written in JavaScript. It unifies our engineering specialties into one team which allows us to understand and react to our users’ needs at any level in the technology stack.” 2. Node.js in LinkedIn The world-famous professional networking platform LinkedIn used to run its back-end on Ruby on Rails. However, the company decided to use Node.js for its mobile-app backend in 2011. As a result, the LinkedIn app became 20% faster with the help of Node.js. [http://highscalability.com/blog/2012/10/4/linkedin-moved-from-rails-to-node-27-servers-cut-and-up-to-2.html] Kiran Prasad, VP of Product at LinkedIn, elaborated, > “One reason was the scale. The second is, if you look at Node, the thing it’s best at doing is talking to other services. The mobile app has to talk to our platform API and database. We’re not doing massive data analytics. Node showed us huge performance gains compared to what we were using before, which was Ruby on Rails.” 3. Node.js in Netflix The global favorite video streaming app Netflix chose to build their entire user interface using Node.js. [https://thenewstack.io/netflix-uses-node-js-power-user-interface/] It sped up the development process manifolds. Moreover, Node.js also reduced the app startup time by over 70%. [https://netflixtechblog.com/making-netflix-com-faster-f95d15f2e972] Kristofer Baxter, the then UI engineering manager at Netflix, wrote in a blog, [https://netflixtechblog.com/making-netflix-com-faster-f95d15f2e972] > “Three large pain points shaped our new Node.js architecture: > Context switching between languages was not ideal. > Enhancement of markup required too much direct coupling between server-only code generating markup and the client-only code enhancing it. > We’d rather generate all our markup using the same API.” 4. Node.js in Uber Uber, one of the largest on-demand apps, needed a feasible solution for handling millions of data requests daily. Node.js, with its exceptional data processing features, was chosen by Uber as one of the app’s leading technologies. Matt Ranney, a senior staff engineer at Uber, had shared, > “One of the things that make Node.js uniquely suited to running in production is that you can inspect and change a program without restarting it. So very few other languages offer that capability. Not a lot of people seem to know that ability exists, but indeed you can inspect and even change your program while it’s running without restarting it.” 5. Node.js in GoDaddy A leading web hosting and domain registrar company, GoDaddy migrated the back end of its app to a full-fledged Node.js infrastructure. With the help of Node.js, GoDaddy app was able to reduce its dependence on hardware to a great extent. Antonio Silveira, the then VP of engineering at GoDaddy, had written in a statement, > “We are now using about 10x fewer servers to host our customer websites and we reduced the Time To First Byte (TTFB) considerably from ~60ms to something around ~12ms. Performance is a key differentiator when we talk about web applications, including a better position in Google’s search results.” The Bottom Line Node.js is efficient, runs on JavaScript, and speeds up the development process. So from SPA to IoT, there are many different kinds of applications you can build with Node.js. Its serverless architecture, microservices, and event emitters have made it a favorite amongst startups and enterprises alike. Third Rock Techkno [https://www.thirdrocktechkno.com/] is a leading node.js development company in India and the USA. From our pool of world-class developers, you can hire dedicated Node.js developers [https://www.thirdrocktechkno.com/hire-node-developer/] for your next project. If you want to build a Node.js app, we’d love to discuss the possibilities of your app ideas. Contact us [https://www.thirdrocktechkno.com/contact-us] for a free consultation call with our veteran IT consultants.

25 Jun 2020 | 8 Min Read
Most Prominent Node.js Development Trends in 2020

Node.js is an open-source JavaScript runtime environment that is built on the Google V8 engine. Over recent years, it has emerged as a reliable technology for developing scalable applications. Moreover, many corporate giants [https://yourstory.com/mystory/what-is-nodejs-a-list-of-popular-websites-built-on-ch5axxpbbm] like LinkedIn, PayPal, and The Wall Street Journal have built their web applications using Node.js. In this blog, we explore how Node.js stands in terms of popularity now and what are the most prominent Node.js development trends in 2020. Node.js Popularity in 2020 Node.js is extremely lightweight and highly flexible. In addition to that, it comes with an exhaustive library of JavaScript modules that simplify the development process. Being open-source and easily accessible is like the cherry on the cake. Thus, Node.js has become incredibly popular for both web and mobile application development. As of early 2020, more than 50% of the developers use Node.js in their projects. So what makes Node.js such a fan favorite? When you hire Node.js developers [https://www.thirdrocktechkno.com/hire-node-developer/] and ask them if Node.js is a good choice for your project, they will at once list numerous features that will convince you of its scalability and efficiency. The developers have been operating on Node.js for a long time now. They have already curated a robust client database and are able to build and design effective websites using Node.js. So most of them don’t even bother to explore other alternatives. For the ones who have recently tried Node.js, its efficient features have made the new-comers stick to the technology. Node.js Development Trends in 2020 Node.js development trends in 2020 are largely dominated by some of the most beneficial aspects of the framework. So let us look at the most recent features of Node.js that have made it such a developer-friendly technology. 1. Serverless architecture in Node.js Node.js is quite popular for its serverless architecture. So Node.js enables you to create an application without having to worry about the maintenance of servers. A serverless architecture means reduced reliance on hardware and servers. As a result, the hardware and maintenance costs of node.js architecture is negligible. Because of the serverless architecture, Node.js offers a number of benefits. The major advantages are improved code quality, diminished project cost, reusable code modules, and better flexibility. 2. Microservices facilitated by Node.js Node.js includes a bunch of microservices that solidify the maintenance of the codes. Thus, it provides assistance to the serverless approach and is highly productive for large scale projects. This feature enhances the functioning of an application and makes it faster. So a large number of businesses are already on the lookout for this feature to optimize their applications. Because of microservices, Node.js developers can regulate and change the codes without affecting other modules of applications. 3. Node.js and real-time apps Real-time apps have become an integral part of our routines now. From booking a cab to ordering food online, we don’t even realize how many times we use one or the other real-time app. So what made these apps a reality? You guessed it right, it’s Node.js. Real-time apps need lightweight processing with a strong backend and data serving platform. So a vast majority of real-time apps are powered by Node.js. That’s because Node.js is the best option out there that meets all the aforementioned requirements. However, these real-time apps run a high risk of overloading the server. Node.js makes use of Event API and Web Sockets to simplify two- way communication. Thus, it solves the problem by making the collaboration environment update smoothly. Apps that can be designed using Node.js include: * Video conferencing apps * Document sharing apps * Online gaming apps * Chatting Apps 4. GraphQL deployment in Node.js apps GraphQL is a data querying and manipulation programming language for APIs that is developed by Facebook. In 2019, GraphQL saw the highest peak [https://insights.stackoverflow.com/trends?tags=graphql] in its popularity. Interestingly, it is still growing and is all set to dominate Node.js development trends in 2020. GraphQL enables developers to make use of the sources of multiple data. Additionally, it facilitates the workflow of an application on different platforms and offers sample placeholder structures for new features. When you incorporate GraphQL in an existing or new Node.js application, its ability to fetch data increases by 50%. 5. Node.js in cloud computing Migration to the cloud for improved performance and cost-efficiency is not a new phenomenon anymore. Owing to its serverless architecture feature, Node.js proves to be extremely efficient in building a cloud-based app. Considering the popularity of Node.js, Google has made a range of Node.js tools [https://cloud.google.com/nodejs] available for developers. You can use these tools for faster cloud application development. Besides building new cloud apps from scratch, you can also apply Node.js in your existing cloud apps. Thus, a business can scale its existing cloud apps within a limited budget using Node.js. 6. IoT development using Node.js In its essence, Node.js serves as a runtime environment that runs an IoT software. Node.js microservices, real-time capabilities, and data-centric approaches are greatly beneficial in IoT development. Hence, it is one of the best alternatives for building IoT apps. The majority of IoT applications use Node.js because it results in faster and real-time execution. Node.js occupies very little memory and demands low resource requirements on the server-side. Therefore, Node.js in IoT development is definitely one of the most influential Node.js development trends in 2020. 7. Scalability The size of the businesses goes on increasing at a rapid pace. So they are constantly searching frameworks that can comfortably adapt and scale. Node.js is perfectly capable of offering scalability and flexibility to the developers. This makes it easier for web apps to offer better feature updates and host a wider audience seamlessly. 8.  Use of Node.js in business app development Most companies use Node.js for designing on-premise desktop apps or enterprise apps. Node.js has many strengths that make it a good fit for business app development: * Outstanding I/O capabilities * Light-weight code * Fast solution development speed The use of Node.js in business app development isn’t much of a recent advancement. However, it surely is going to remain a significant part of Node.js development trends in 2020. Top Node.js Frameworks That Will Dominate 2020 Node.js carries remarkable full-stack development capabilities. So it is largely responsible for shaping some of the commonly used JavaScript frameworks. Described as Node.js frameworks, they are expected to lead the development scene in 2020 and the years to come. The top Node.js frameworks in 2020 include: 1. Express.js [https://expressjs.com/] Express.js is a web application framework for Node.js. This framework is rich in configuration and customization features. So it has emerged as one of the most developer-friendly Node.js frameworks. Following are some of the features and benefits of Express.js: * It is relatively easy to configure and customize. * You can easily integrate it with various databases like MongoDB, Redis, and MySQL. * When used with Node.js, Express.js can build robust APIs for single-page, multi-page, and hybrid web apps. * Express.js is excellent for designing an app that requires handling multiple requests and notifications from customers. 2. Meteor.js [https://www.meteor.com/] Cross-platform apps are ubiquitous now. Businesses are doing everything to ensure a smooth consumer experience as they move from one browser/device to another. Meteor.js is more convenient than most other frameworks in building cross-platform applications because: * It embeds both the front- end and back- end development to a single coding language (Vanilla JavaScript), * Meteor.js paves the way for an innovative approach to scripting. * It makes debugging easier by providing assorted packages and libraries with a testing tool. * Vue, Angular, React [https://www.thirdrocktechkno.com/blog/angular-vs-react-vs-vue-which-framework-to-use-in-2020/] and other third-party tools can easily be integrated with Meteor.js. 3. Koa.js [https://koajs.com/] Koa.js is a smaller yet articulate and powerful Node.js framework. It is lightweight and facilitates speedy development of web applications. Some of the best Koa.js features are: * It simplifies the process of programming through an upstream and downstream flow of control. As a result, Koa.js boosts productivity. * Koa.js makes it possible for you to select the relevant modules for your web application. This is why it is one of the most flexible Node.js frameworks. * Building an app using Koa.js makes it very fast because the framework opts for ES6 generators and eliminates callbacks. * Koa.js is on the rise in popularity among the developers on GitHub. Moreover, it seems to be one of the rapidly rising Node.js development trends in 2020. 4. Nest.js [https://nestjs.com/] Nest.js is a meticulously constructed Node.js backend framework. It is very advantageous for the developers because it boosts their productivity. The main purpose of Nest.js is to build highly dependable server-side applications through rest API. * Nest.js is a simple framework and it is easy to learn. * Its lightweight framework can be applied to the ever-changing projects that require flexibility. * Nest.js provides all the basic features such as OOP, FP, and FRP because it is built using the TypeScript language. * Nest.js receives a CLI from Express.js that can be applied to design applications with a wide range of features. What does the future hold? Node.js is one of the very few software development technologies that has seen steady growth ever since it was launched. It is incredibly useful in simplifying database workflows and offers great solutions for leveraging real-time data. The demand for Node.js is certainly set to increase even further mainly because it can build both client-side and server-side apps using one set of codes. The use of node.js in building robust real-time apps is surely going to be a dominant trend in the upcoming years. The Bottom Line Node.js is one of the most powerful JavaScript frameworks.So it is heavily used for web application development. Node.js is a part of popular web development technology stacks [https://www.thirdrocktechkno.com/blog/how-to-choose-a-technology-stack-for-web-application-development/] like MEAN and MERN because of how developer-friendly this framework is. If you have an app idea in mind, it is wise to consider using a robust framework like Node.js to ensure the scalability of the app. Third Rock Techkno [https://www.thirdrocktechkno.com/nodejs-development-services/] specializes in providing top-notch Node.js development services with maximum ROI. To discuss the viability and costs associated with your project, set up a free consultation call with our experts here [https://www.thirdrocktechkno.com/contact-us]. You can also hire Node.Js developers [https://www.thirdrocktechkno.com/hire-node-developer/] from our pool of highly versatile developers.

23 Mar 2020 | 5 Min Read
Logging best practices for Node.JS application

Introduction Logging is helping developers reduce mistakes and cyber attacks. The application is dynamic in design. We can't always foresee how an application will react to changes in the data, errors or program. Logging in lets us comprehend our own programs better. An absolute logging solution is very important for all of the applications. A successful logging system improves the reliability of the application and makes it easy to maintain on the production server. Application logging is the process of collecting knowledge about the run time of your program. What are the logs? Logs are the events that reflect the various aspects of your application, it is the easiest mode of troubleshooting and diagnosing your application, if written correctly by the team. Importance of logging? As we already said that a good logging solution builds the application robustly. Every node.js module or application needs logging to know real-time errors. During development, it’s often useful to log debug messages to investigate specific issues. In those scenarios, it’s useful to log: * The value of a related variable * If a particular function was called * The return value for a function call * API responses * The sequence of particular events Log Levels Logging level exists for reason, they indicate us to put a log message into one of them, sorted by urgency. That allows us to filter the messages of the production log by the level of urgency. Logging levels severity specified by RFC5424 [https://tools.ietf.org/html/rfc5424]. These are described in the following table along with their numerical values.  Severity values MUST be in the range of 0 to 7 inclusive. Numerical CodeSeverity0 Emergency: system is unusable1Alert: action must be taken immediately2Critical: critical conditions3Error: error conditions4Warning: warning conditions5Notice: normal but significant condition6Informational: informational messages7Debug: debug-level messagesBest practices for logging Important parts of logs. Application logs are for both machines and humans. Humans use logs to debugging issues and machines use logs to generate reports and graphs for data analysis. Every log should consist of three parts. * Source of log * Timestamp * Context and level Source of log When we are using microservices architecture this becomes really crucial to know the source of the log, the details like service name, method, zone, etc.. Detailed metadata about the source is mostly handled by the log shipper agent. Which pushes logs into a centralized logging system. Timestamp When an event occurred or log generated it’s very important to have a timestamp of that moment. So make sure every log has a timestamp so that we can perform actions on that like sort or filter by occurrence time. Context and level While referring to logs to find bugs, if logs do not have enough information and if you have to refer back to source code to understand, it’s always frustrating for any developer. So while logging we should always pass enough context. E.g. A log without context would look like.‌ User transactions fail. The proper example with meaningful context looks like. User transaction fails due to invalid expiry date of the card. What and how to log Logs methods and inputs While debugging if we get to know which method was called and what the parameters were passed, it's really helpful to developers. So log methods entry along with parameters and exit points will help us a lot to find a place where we need to debug. Let’s check using a perfect example. exports.doTransaction = async (req, res, next) => { try { logger.info(`>>>>> Entering user controller (parameter: ${req.body})`); // process logger.info('<<<<< Leaving user controller'); res.json({ … }); } catch (error) { logger.error(':::::error: catch block error:::::'); next(error); } }; The log should not produce a side effect The logs should be stateless and should not produce any side effects. For example. If you see the cardModel.save  that will create a new resource in the database is called inside the logger, this is incorrect logger should only deal with information logging and not implementing business logic. exports.doTransaction = async (req, res, next) => { try { logger.info(`>>>>> Entering user controller (parameter: ${req.body})`); // process logger.debug('<<<<< saving card details cardModel.save(req.body.cardInfo) // Don’t do this '); ` res.json({ ... }); } catch (error) { logger.error(':::::error: catch block error:::::'); next(error); } }; Log errors with details If there is an error please be descriptive, mention what was attempted and why it failed. Log what failed and what you are trying to do next. exports.saveUser() { try { logger.info(`>>>>> Entering user controller (parameter: ${req.body})`); // Handle parameters checkUnique(username) const maskedUsername = maskUsername(username) } catch(error) { log.error(`Failed to do checkUnique with username ${maskedUsername}, ignoring it and trying to save it`, error); saveUserDetails(userDetails); } } Here we logged what failed and what we are doing in the next process. Sensitive information We have to make sure of some things while logging that we should not log sensitive information like username and password, financial information, card details, etc.. As developers, we should refer or consult with the product team to prepare a list of sensitive information mast it before logging. Correct usage of log levels If production applications have heavy traffic on a regular basis then the ideal log setup might generate GBs of logs. Hence we have to categorize our logs in groups, so we can get appropriate logs by filtering. Don’t use console.log Most developers have used console.log to log and debug code, as it is easy to use, easily accessible and no need to setup is required. Using console.log,  debug and info print in stdout, Hence we will not be able on-off debug and info. Similarly, console.warn and console.error both print in stderr, switching between them is very hard in production applications. To overcome all these issues we can use Winston [https://www.npmjs.com/package/winston] logging framework, and there are few more options are Bunyan [https://www.npmjs.com/package/bunyan], Pino [https://www.npmjs.com/package/express-pino-logger] etc.. Performance impact If the frequency of writing log is high it may impact the performance of the application directly.that's why we should only enable the error and warning level, and change the level to debug when we want to figure out the issue and switch it back to the error.‌ -------------------------------------------------------------------------------- Third Rock Techkno [https://www.thirdrocktechkno.com/] is a leading IT services company. We are a top-ranked web, voice and mobile app development company with over 10 years of experience. Client success forms the core of our value system. We have expertise in the latest technologies including angular, react native, iOs, Android and more. Third Rock Techkno has developed smart, scalable and innovative solutions for clients across a host of industries. Our team of dedicated developers combine their knowledge and skills to develop and deliver web and mobile apps that boost business and increase output for our clients.

Get in Touch

Is your mind buzzing with ideas?
Let us know about them!

Contact Us