
Pawan Yadav is a highly skilled Software Engineer with over seven years of experience in developing scalable and robust applications using modern web technologies. Currently a freelancer, he has previously held senior positions at Deque and Cloudbloom, where he excelled in creating accessible design tools and innovative video platforms. Proficient in React, Node.js, TypeScript, and cloud services like AWS and Google Cloud, he has a strong foundation in both frontend and backend development. His work reflects a deep understanding of best practices, performance tuning, and risk analysis, underpinned by a commitment to continuous learning and a passion for leveraging technology to solve complex problems. He is eager to contribute his expertise to dynamic teams focused on building impactful software solutions.
Senior Principal Engineer / Fractional CTO (Self-employed)
Freelance / ConsultingSenior Software Engineer
DequeFull Stack Developer
CloudbloomSoftware Engineer (Contract)
Code SupplementSoftware Engineer (Contract)
PearsonSoftware Engineer (Contract)
UBSSoftware Engineer (Contract)
Glyde Rides
Visual Studio Code

Git
.png)
Firebase

MQTT
AWS (Amazon Web Services)
.png)
Docker

Salesforce CRM

HTML/CSS

Javascript

SFMC

Github


Eclipse IDE

Next JS
.png)
Heroku

Postman

OAuth 2.0

Plugins

Smart Contracts

Auth0

SDKs

AWS

Google Cloud

Kubernetes

GitHub

GraphQL
I'm a full stack developer by profession with 7 plus years of experience. Along with that, I have mostly worked with JavaScript frameworks like React, Angular, Node.js, and Express. Having said that part, I have worked with various projects out of which, these are native web apps, mobile apps, and even back-end apps that have been scaled up to 1,000,000. In addition to that, if I talk more about my recent project, so it was one of the recent OTT platforms where we have streamed the retention cup as well, and we were able to confidently host more than 1,000,000 requests. So that was one of the achievements for us, and more specifically, our system was easily able to bear this much amount of payload. So, like, that was good, and that's a brief about me. Thank you.
What is your approach to error handling and logging in a full stack application using React, NetJson, TypeScript? So with respect to error handling, we need to make sure that the application is not breaking. We have error boundaries in place, which we can wrap around various subcomponents and modules. This allows us to break down a large application into smaller modules, hosting them within a particular error boundary. If a module is breaking, it won't cause the complete app to break. In addition to that, when it comes to logging, there are various types of logs that are helpful for developers and end-users. We can have different logging levels in place, such as info logs, debug logs, error logs, and success logs. We can use tools like Winston and Pino to integrate logging into our platform, allowing us to show different types of logs with respect to different environments. We can also pass logs to a specific stream, such as elastic cache or a service provider, for analysis at a later time. This is especially useful in production environments where real-time analysis may not be feasible. Everyone is busy in production, so we can analyze logs to identify errors and error types. Based on this analysis, we can expand on these issues to improve our application.
When it comes to implementing feature flags and React to control the deployment of new features, there are several steps you can take. First, if there's a new feature being developed, it should be under a feature flag itself. This is because, when deploying your work to the dev branch and you're tight on budget, you cannot have multiple branching strategies and multiple environments to be hosted at the same time. So, you need feature flags to hide a specific feature behind a flag. To implement the feature flag, there are various ways to store the feature flags and RBAC (Role-Based Access Control) and feature-driven flags in the database itself. Alternatively, you can use existing platforms like LaunchDarkly that provide these flags. Once you fetch these flags to your application, you can simply get the flags and enable or disable a certain feature. When it comes to deployment, these flags are coming from a specific third party or organization or database, so you do not need to redeploy the application again. In my project, we were using access, a content management tool, to handle feature flags. We simply toggled the options, and that would enable or disable a particular feature in a full-fledged application.
When it comes to scalability, some of the best practices I follow when setting up state management in a Next.js application is to keep everything very loosely coupled. So, for example, if I'm talking about a user state, I'll keep that within a specific context, only if it's very specific to the Next.js app. I'll create a specific context and create that state there itself. In addition to that, if I feel like there is a state that is being shared in a user module as well as in a messaging module, I'll keep that state in Redux, because that's one of the global providers where we can share these states. Only shared states will be passed on to a global state. If you're talking about individual states, those should be sitting at the user level or the individual component level itself. The benefit of that is that once you're moving to a micro front-end architecture or any kind of architecture where you're breaking down the module itself, it will be very easy for you to extract that component out of it because once again, that is loosely coupled. This is one of the ways through which you can have better state management.
Can you detail an approach to converting a complex class component in React to use React Hooks instead? It's never a complex class component. So it can be of multiple lines as well, but we need to make sure that it is divided in a very efficient way. Having said that part, when we compare class components and functional components where we can use React Hooks, so there are multiple life cycle methods for which we need to use Hooks and state management as well. So let's talk about that. So when we talk about class components, we do have several life cycle methods. First, we get data straight from props. Then we have a component mounted. Then we have shouldComponentUpdate or not. The willUpdate method is deprecated after React 17 version. So we do have componentDidUpdate. Then at last, we have componentWillUnmount and getDerivedStateFromError. So this is with respect to error boundaries. So having said that, these life cycles are very specific to a particular class component. How can we achieve that in a functional component? So for that, we do have the useEffect hook. The useEffect hook is a combination of componentDidMount, componentDidUpdate, and componentWillUnmount. So this is a combination of these three life cycle hooks. When we talk about state management, how can we do state management. So in class components, we do have a state as a specific object where we can use the setState method itself, and that will update a part of the object or the complete object itself. We cannot have multiple states there. With respect to that, in functional components, we can have multiple states. So that's a benefit. You can break down your states into multiple states. So you can use the useState hook, and you can break down your states. So that will make it easier for you to maintain different modules of that complex component itself. We do if we are managing a complex state, we can use the useReducer hook instead of useState. So it works in a very similar way, but it passes an action dispatcher, and it maintains the state using the actions that you dispatch. In addition to that, if you want to maintain some references, you can use the useRef hook. So it is very similar to creating a ref in a class component. However, if you're talking about some context providers, you can use the useContext hook if you're dealing with context. So these are certain things that come into the picture. And if you're integrating any third-party libraries, like Redux, so mapping state to props and mapping dispatch to props will be very similar to using selectors and using dispatch in React Hooks. So that is how it is in React Hooks. Thank you.
When we deal with RESTful APIs and security, there are multiple things to consider. First, we can rate limit the API to prevent excessive exposure and usage. Secondly, we can only allow a specific set of origins to access the API through a cross-origin resource policy, which authorizes a set of origins to access the API. Regarding authentication and authorization, authentication is the process through which a user logs in and out of a system. Authorization, on the other hand, refers to the rules that govern what a user is allowed to do. To handle sensitive data, we need to have validators in place to prevent cross-site scripting attacks. We also need to use CSRF tokens to prevent cross-site forgery attacks. These tokens verify that the request is coming from an authorized user. Additionally, we need to implement content security policies and ensure that iframes cannot be easily injected. We must also protect against SQL injections and avoid using the eval keyword. Furthermore, we should consider implementing HTTP parameter pollution protection to prevent tampering with request headers. By keeping track of these security measures, we can ensure the integrity and security of our RESTful APIs.
As a direct snippet using hooks, can you find the bug related to the use state who can explain what is going wrong? So we do have this import statement, const my component. Okay. That's fine. Use effect, set time out, set count plus 1 after 1,000, and then we do have a return. First thing is that you have, like, returned I think so that does undefined at the moment. So written undefined from the components, it will not do anything. But what's the bug within the set count? Okay. So count plus 1. Because that is being happening very frequently in one second. So this count will not have the reference of the previous count. So for that, we need to use a callback here. So I think that will resolve the issue. Thank you.
Unless the TypeScript snippet, can you explain what is incorrect about the use of any type and how to rectify it following best practices? First of all, any type is not a good thing to use in TypeScript, but let's go over the code itself. Function handle API response responses any, void, console dot log, response dot data. Okay. So because this response is of any type, so our first thing, our intelligence will not, going to know that there is a data property or attribute within that response. Or how that data will be looking like, we are not sure about that. So instead of that, we should make it a little bit TypeScript. So we can simply say that, okay. This is a specific type for this response. We can use various interfaces, and even we can override these things. So once we have a data strict, particular attribute there itself, so it will even do various operations over that response object and the data object that is within that. Thank you.
When faced with a memory leak in a long-lived React application, how do you pinpoint and resolve the issue? So memory leaks can be due to various reasons, such as timers, allocating too much memory to an object, or creating it blindly. So, for that, we do have memory snapshots. You can use any browser and access the dev tools. Go to the memory that has been consumed. You will see a spike being offered after certain interval times, and it's not being stable. That means there is some kind of memory leak. The point is to pinpoint that specific memory leak. You need to create at least two memory snapshots within a certain amount of time where you can see a significant spike. When you compare these spikes, you will see that from where the exact memory leak is coming. Is it timers, or is it object allocation? And when you see that there are the particular places where there is a significant difference. Let's talk about objects because that's not common, but I want to give an example of that. So, we'll see that these objects are being created significantly. While expanding that particular snapshot, you will see that from which particular instance or which file we are initiating these objects. You can go to that specific file, analyze the code, and resolve the issue from then on. There are various heat maps and profilers, as well as various tools that have come into this industry through which we can pinpoint memory leaks.
Feature toggling is very similar to feature flags as we discussed earlier, in one of the questions. Feature toggling is derived from a certain feature flag. So, you can render it based on certain conditions. You can have a higher-order component that will say, okay, if you are getting this specific flag, we will enable that route so that our user can access that application. Because while we are going to do a production build, we need to make sure that these codes are being injected very seamlessly. So we can even request for the dynamic code. We are specifically talking about static site generation, dynamic site generation, and client-side rendering. These are certain differences where we can do the rendering based on these certain logics as well. That will enable us to toggle the feature flag. And because we are using TypeScript, the data will be strongly typed. We can utilize the beauty of TypeScript to handle the types very easily. Our intelligence will give us options and things to do with the data, and that will easily enable us to toggle these features.
What is your method for measuring and optimizing the end-to-end response time of API calls in a Next.js application? Response time of API calls depends on various factors, including latency, the latency of the server, the location of the service from which we're using a specific database, and how much time a query needs. There are multiple factors that come into play for these API calls. So, first, we'll go to the network dial. We'll see that, okay, this is the response time of this specific API call. If that's taking more than one second or maybe 800 milliseconds, that's not a good user experience. So, with respect to that, you'll see where it's taking time. Is it server latency? You can use the waterfall model itself. You'll see that. Okay. If the latency is good, then you can go towards the server and deep down into the query itself to see why it's taking that much time. That can depend on various factors like the database and the type of limiters you're using. But if the latency is not good, you need to check where the server is located and from where this request is coming. To avoid that, you can use various servers located in different countries. Now, having said that, there's a high possibility that the server is going up with tons of load. So, to avoid that load, you can use load balancers. You can use cache. Cache will not retrigger that specific query. It will fetch the results from its memory and return them to the user, as they're already computed. We can use these techniques to optimize API calls and analyze APIs, regardless of whether it's Next.js or any other application.