Monday, January 10, 2022

React.js Vulnerabilities And It’s Solutions That You Should Not Ignore

 

React.js Vulnerabilities And It’s Solutions That You Should Not Ignore

React,js vulnerabilities and it's solution

At a first glance, cybersecurity appears to be intangible. App’s unique features, attractive user interface and smooth performance will be of no use unless it is safe. It is applicable to apps based on React.js too. Most of the businesses are facing issues regarding app security. If you’re also one of them, then you are at the right place. Here we came with some react.js security vulnerabilities and how to fix them? Before digging into it, let’s see some common react.js cyberattacks.

Most Common React.js Cyberattacks-

React.js logo

Each time when React.js is updated, new security flaws emerge that go undiscovered. Hence it is difficult to cover all the possible cyberattacks that React.js may be vulnerable to. Let’s have a look at most common react.js cyberattacks-

  • Distributed Denial of Service (DDoS)-

DDoS attacks overwhelm a web app infrastructure with more traffic than it is able to handle. Their main purpose is to make an application inaccessible and unavailable to its users. Some common ways to conduct DDoS attacks are UDP, ICMP, SYN and HTTP request flooding. As an attacker tries to exhaust resources, like memory and CPU processing time, a server and firewall must process every request and respond to it.

  • Cross-Site Scripting (XSS)-

Adding malicious scripts into the code of a web app is called XSS. This script gets selected by the browser and interpreted as valid, and then malicious code run as a part of app. XSS attack might allow the attacker to steal user passwords, collect sensitive data from app’s pages, make requests to servers and so on. 

  • XML External Entity Attack (XXE)-

This kind of attack occur in online apps that employ XML(Extensible Markup Language). Text based language used in web apps to store and organize data. XML parser needs to convert XML into understandable code and XXE injections generally target such parsers. Using XXE, a perpetrator can perform a CSRF or DDoS attack.  Here the problem is that XML parsers are vulnerable to XXE by default, hence it’s upto your development team to ensure that the code is free from such vulnerabilities.

  • Cross-Site Request Forgery (CSRF)-

To commit CSRF attack, a perpetrator crafts an email or web page that will convince a victim to perform a state-changing request on web app. It can be granting permissions. Generally an attacker exploits links or invisible images to conduct a GET request or a form for PUT or POST request. Javascript code provides a way to craft that requests, but it will be prevented by any modern browser unless it’s allowed on the web app server.

React.js Security Vulnerabilities And It’s Solutions-

Here are some of the most common react.js vulnerabilities- Server side rendering, Dangerous URL schemes, Broken authentication, SQL Injections, DangerouslySetInnerHTML, Escape hatches. Let’s see each one in detail.

1. Server Side Rendering-

Main advantage of React is SSR(server side rendering). This features ensures a faster page load, better performance and ease of incorporating SEO. But it makes react apps prone to attacks. But why? Lots of React apps use Redux for app state management, that uses JSON, lightweight data-interchange format, to set initial app state:

<script>
 //WARNING: See the following for security issues around embedding JSON in HTML:
// https://redux.js.org/recipes/server-rendering/#security-considerations window._PRELOADED_STATE__= ${JSON.stringify(preloadedState).replace(/</g, ‘\\u003c’
)}
</script>

This is harmful because “JSON. stringify” will not recognize sensitive data or XSS code. Though the above example has code to mitigate simple XSS attacks, it’s not silver bullet by any means. Also, it’s worth mentioning that SSR opens a way for hackers to exploit vulnerabilities in third-party NPM packages. 

A solution to this is-

  • Use Regular-Expressions
  • Use serialize-javascript package

2. Harmful URL Schemes-

When hackers add harmful code starting with Javascript to URLs, links to other pages become harmful. Whenever a user clicks on a link, script in the browser is activated. React.js app security doesn’t restrict use of URLs that don’t start with “HTTP:” or “HTTPS:” and it lacks capabilities to protect against possible attacks.

Solution to this is-

  • Avoid the use of URLs as input. Create an application that takes YouTube video ISs instead of YouTube video URLs.
  • If the above option is not available, use trusted third-party tools like Sanitize URL NPM package to sanitize these harmful links. Ensure that everyone from the development team is using the same sanitization code.

3. Escape Hatches-

Main advantage of React is, it saves developers time from manually putting data into the browser DOM to render components. But there are some of the cases where programmers require direct access to the DOM elements.

For such cases, react offers escape hatches, like “findDOMNode” and “createRef”. App can manipulate element directly without going through React, because an escape hatch returns the native DOM elements with their full API. It leads to an XSS vulnerability. 

Solution to this is-

  • When direct output is required, use proper DOM APIs to generate HTML nodes.
  • Don’t output the HTML code, only text
  • Sanitize data with DOMPurify before putting it into page

Thursday, January 6, 2022

Gatsby Vs Next.js- Which One To Choose In 2022?

Gatsby vs Next.js

Every day new frameworks enter the market and choosing a perfect technology or platform for developing a business solution becomes more difficult. And when you want to choose between two prominent frameworks, it’s even more difficult. So to ease the selection process, here we came with the comparison of Gatsby and Next.js. But before digging into the comparison let’s have a look at features and advantages of Gatsby and Next.js.

What Is Gatsby?

Gatsby logo

It is an open-source frameworks used to develop static websites and apps that combine the functionalities of GraphQL, React and Webpack into a single tool. Gatsby is gaining the position of being the first choice for modern app and web development. It uses pre-configuration to develop websites with features like faster page loads, server side rendering, code-splitting, data prefetching, image loading etc. The incredible speed of Gatsby is all due to PRPL architecture. Developed by Google, PRPL architecture is used to build apps and websites that work smoothly on various devices with unreliable internet connections. PRPL stands for-

  • Push the critical resources for initial URL route. 
  • Render initial route.
  • Pre-cache remaining routes. 
  • Lazy-load and create remaining routes on-demand. 

Features Of Gatsby-

1. Great Performance-

Gatsby provides great performance by maximizing site performance using various strategies. These strategies include effective code-splitting, inherent critical assets, preloading and pre-fetching of assets and so on.

2. Gatsby Cloud-

Gatsby provides custom cloud infrastructure to build websites with incremental builds, deploying powerful developer previews, auto-generated lighthouse reports, real-time CMS previews. 

3. Modern Workflow-

Gatsby provides support for all the new web standards and amalgamates technologies like GraphQL, Webpack and React. Hence Gatsby offers complete support for every single modern workflows.

4. On-point Documentation-

Documentation of Gatsby is considered a gold standard for any open-source documentation. With clear, comprehensive and contextual documentation, even beginners can easily learn it.

What Is Next.js?

Next.js logo

Next.js is an open-source development framework, built on top of Node.js. It is used to enable React-based functionalities for web apps that include, static website development and server-side rendering. Next.js is based on React, Webpack, Babel and is gaining popularity among the developers’ community too. 

Next.js supports effective front-end development, as it uses Jamstack architecture that differentiates between front-end and backend. It is known to reduce the burden on web browsers by using server-side rendering that dynamically generates HTML through the server whenever any request is received.  Next.js extends great support to static page generation, including CDN caching, static page generation etc. Hence it is perfect for developing large-scale apps and dynamic websites with robust server interactions.


Wednesday, January 5, 2022

Challenges In Cross Platform App Development And It’s Solutions

Challenges In Cross Platform App Development And It's Solutions

Cross-platform apps development gained a huge popularity as it allows to develop apps that can run on various platforms. These apps uses reusable code that can be used across platforms to produce the same features. Hence it saves time and money for developers. But Cross-platform development can result in slew of performance and usability issues. Apart from these, there are some more challenges while developing best cross platform app. Let’s see these challenges and their solutions. But before digging into it, let’s see what is cross platform app development.

What Is Cross Platform App Development?

Cross Platform App Development
Cross Platform App Development

Term “cross-platform application development” or “multi platform app development”  is self-evident. It allows programmers to create mobile solution that is compatible with multiple operating systems and platforms simultaneously(Android, iOS, Windows).

Main reason of why developers are switching from native to cross-platform development is the faster development time. There are lots of cross-platform app development frameworks available to meet the user’s requirements.

Challenges In Cross Platform App Development –

Although cross-platform apps development offers many appealing features, there are some challenges in cross platform app development. Here are some of those.

1. Poor UI/UX-

This may seem surprising, but most cross-platform apps fail due to unnecessary features and difficult to navigate designs. Native apps are all about animation features, 3D effects and beautiful blend of graphics enhanced by hardware features. But most cross-platform apps cannot take advantage of all functionality that mobile devices provided, which results in poor user experience. 

Every device has its unique characteristics, that makes it difficult to provide same functionality with single universal code. As a result, programmers must simplify features to ensure that screen layouts and images are consistent across all devices. 

2. Switching The Platform-

Most of the cross-platform frameworks use their Javascript subject and this create issues when you use reusable codes. Thus, finding the issue amongst the whale coding becomes a hectic task that increases time and cost required for mobile app development. 

3. Delayed Access To Latest Features-

One who choose to design a cross-platform mobile app will tuned to the framework they choose. Issue with them is they have a delay in updating. Apple provides new capabilities to iOS and Google adds new features to Android, frameworks must adapt their development tools to integrate new functionality. It needs some time. The integration process with local settings becomes lengthy with this platform. The integration process with local settings becomes quite lengthy with this platform.  

4. Limited Updates-

Sometimes, operating system does not support all features that the framework uses. For example, when iOS platform introduces new update or adds new element, you need to update iOS version of app accordingly, but you can’t do the same with Android until google releases the same update. 

5. Poor Customizations And Navigation Integration-

Development frameworks couldn’t  support every features that you need, including some options connected with hardware functionality, integration with device local settings and inbuilt storage access. Lack of features support may result in blocking the app operation. 

6. Loss Of Code-

Using a framework for cross platform development is a cost-effective option.  Platform ties you into your project just like a site builder allows you to create pages but don’t allow you to reuse them on other sites. Always think before you select the framework. If in case you want to switch to another framework, all your efforts can be lost. 

7. Limited Tool Support-

Go with cross-platform app development only if you are sure about the features that you want to include in your project and confident about the framework that it will handle all. There might not be enough tools for app customization. According to the techies, the greatest programming languages for cross-development are Java, javascript and ruby on rails. Though they aren’t ideal. Then what are your options to deal with this? Hiring experienced cross platform developers will be a great idea. 

Solutions-

1. Platform-

You must select whether your software will be available on a single or several operating systems. If you want to grab a broader audience, cross platform is a way to go. Whereas, if you want to reach ios and android customers, creating a great user experience with native solutions would be your top priority.

2. Native Feel-

You must consider how native your mobile app to feel to the user. App designing with material design or human interface guidelines makes digital products very attractive and user friendly. Whereas you can achieve this by using some popular cross-platform frameworks.

3. Flexibility-

Obviously, flexibility is important in any app development. It allows you to go from one framework to another. Just ensure that the structure you’re working with is adaptable. 

4. Complexity-

It refers to the extent to which you want to take the product. To deal with this issue, determine whether you want to use an MVP to test idea or whether you’re ready to go with a full-fledged app. 

5. Costing-

While choosing cross platform development, you should consider both sides of the issue. It is feasible. It’ll initially cost you less and you can develop it at lower cost. But due to maintenance and upgraded features the price will rise. Multiplatform mobile app development will be useful for small projects.

6. Maintenance-

Know more 

Tuesday, January 4, 2022

Best Practices To Improve Mobile App Data Security

 

Best practices to improve mobile app data security

Over the last few years, mobile apps have become an integral part of our lives from ordering food, booking tickets, banking, online shopping and so on. User data of these mobile apps are very sensitive and hence causes huge loss if it falls into wrong hands. In this digital age, cybersecurity breaches and attacks are becoming very common. Hence, it is necessary to secure the user data. Here we came with some mobile app security best practices. But before digging into it let us see what is mobile app security and security threats in ios and android apps.  

What Is Mobile App Security?

Mobile app data secuirty

Mobile app security testing focuses on security posture of mobile apps on different platforms such as iOS, Windows, Android. It involves assessing apps for security issues in the context of platforms at which they are designed to run, framework that is developed with and anticipated set of users.  Mobile apps plays important role in online presence of business and lots of businesses rely on mobile applications to connect with users. App breaches can be related to issues such as storing user’s data without encryption on a local database, session token change and so on. 

Mobile App Security Testing Checklist OWASP-

1. Insecure Data Storage-

Mobile devices may get lost or stolen and hence malicious attackers can easily access data. Sensitive data can be extracted by the piece of malware or the attacker can exploit the vulnerabilities which results in data leak and access to sensitive data. 

Solution- Create a threat model to know what information is processed by application and how API handles the data. Assess whether applied encryption is effective and protect the encryption keys. Implement technologies to protect against tampering by obfuscation, buffer overflow, avoid caching/data storing, deploy sound.

2. Insecure Authentication-

Mobile applications should authenticate the identity of users before allowing access. Authentication bypasses are frequently carried out by exploiting existing flaws like mobile app’s backend server’s incorrect validation of service requests. Mobile applications must verify and retain user identity, especially when transmitting sensitive data such as banking information.

Solution- Avoid the use of local authentication methods. Reassign this task to the server and only download app data after authentication. Also, avoid the use of vulnerable authentication methods like device identification, saving passwords locally, apply multi-factor authentication and follow general best practices.

3. Code Tampering-  

Sometimes ecommerce apps contain manipulated mobile app versions. Modified app is an example where a hacker changes the binary of an app to include malicious content, install a backdoor etc. Haacker can re-sign these falsified apps to third-party app stores and publish modified versions. Also, you can send them directly to the victim through a phishing attack, to get them to download the app.

Solution- For the build, prop the ro. build.tags=test keys that show build of a programmer or non-official ROM. Check for several known rooted apks., attempt SU command directly.

iOS Mobile App Vulnerabilities-

1. Zero Day System Vulnerabilities-

It has been discovered but not made public. Using a remote exploitation technique, these vulnerabilities lead to silent installation of attacks like mRATs on a device. Once the attacker may be able to steal passwords, company data and emails and record all keyboard and screen activity. They could also use the phone as a botnet to steal contacts or text messages. AV solutions that depend on known attack patterns to detect attacks, are not able to protect against unknown attacks. Businesses need a solution that can detect any suspicious behavior from an app, a device or the network to find and mitigate the impact of zero-day mobile attacks.

2. iOS Survellience And Mobile Remote Access Trojans(mRATs)-

These assaults jailbreak the smartphone, removing built-in security features and install mRAT software, allowing the attacker to take control of the phone. iOS software from the app store can be loaded on the device once it has been jailbroken. Users unwittingly download these apps and become infected with mRATs. There is no mobile antivirus that can defend from types of attacks. Issue is made worse by the fact that jailbreak can be readily hidden from Mobile device management(MDM) solutions. Well known forums like xCon, for instance, freely disclose strategies to avoid MDM detection. All that is required is a mechanism to tell when a device has been jailbroken and capacity to spot surveillance activity. 

3. WiFi Man In The Middle Attack-

Whenever a mobile connects to a rogue WiFi hotspot, a MitM attack occurs. Due to the communications run through an attacker-controlled network device, they can listen in on and change the network’s communication. MitM attacks have always been an issue for wireless devices, however increased use of smartphones have become far more appealing targets for this attack.  Due to the limited screen size of mobiles, URLs are generally hidden from users, who don’t verify that the URL the browser is referring to is the correct one. Best way to protect from such issues is to use a VPN to encrypt and isolate communication. To maximize the user experience, VPN should be activated just when rogue hotspots and other dangerous factors are detected. 

Android Mobile App Security Vulnerabilities-

As the android ecosystem is open source, there are more chances of data breaches on the operational level. As the android is so fragmented, new versions of the system are only slowly deployed to customer’s devices, stifling the security of the system. Let’s have a look at android app security problems.

1. App Permissions-

Most of the users easily press the “Access” button when the app requests certain rights. Thus, what makes this security risk? Providing specific permissions to an app, users are authorizing app to access private and sensitive data on their android smartphones. As a result, when it comes to android app development, developers should strive to construct applications that need as minimal permissions as feasible. 

2. Android Fragmentation Risks-

While building a strong security solution, fragmentation is the main issue that android app development services encounter. Generally android apps have multiple versions hence, it becomes difficult for app developers to create a solution which works for all of them. Also, users don’t always upgrade their android devices to the most recent version, causing some security measures to fail. It is important to note that android devices that haven’t been updated are vulnerable to security issues and malware attacks. 

3. OS Customization-

Though it may appear usual, customizing the operating system is a security risk for android apps. Customization of the OS to make it more practical, comfortable, or user-friendly is very common. Whereas, some users have a habit of modifying the OS by integrating launchers and customization layers. It leads to security issues, hence customizing the OS is a major issue in Android app development.

Best Practices To Improve Mobile App Data Security-

Mobile app security best practices ensure that the application is free from risks and doesn’t reveal the user’s personal information. Before the software is posted to an app store for public use, programmers must  ensure that all security tests are completed. Here are some of the mobile app security best practices.

1. Use Of Right Architecture-


Monday, January 3, 2022

Most Common Mistakes To Avoid In Node.js Development

Most Common Mistakes To Avoid In Node.js Development

Node.js has given cutting-edge web applications with two way, real-time connections where both server and client could communicate with each other. Regardless of how difficult Node.js makes writing safe code, and how easy it makes writing highly concurrent code, the platform has been around for quite a while and has been used to build number of robust and sophisticated web services. These web services scale well and have proven their stability through their stability through their endurance of time on the internet.

But just like any other platform, Node.js is vulnerable to developer issues. Some of these mistake lowers the performance, while others make Node.js appear straight out unusable for what you are trying to achieve. Here we’ll discuss most common mistakes that Node.js developers make, and how it can be avoided.

Know the features of latest version Node.js 17 at- What’s New In Node.js 17?

Most Common Mistakes To Avoid In Node.js Development-

Node.js logo

1. Event Loop Blocking-

Being a single-threaded environment, no two parts of apps can run in parallel. Simply, since Node.js runs on single-thread, anything that blocks event look, blocks everything. Concurrency is achieved by handling input-output operations asynchronously. For instance, What allows Node.js to focus on other parts of app is a request to database engine, from Node.js to fetch some documents. 

// Trying to fetch an user object from the database. Node.js is free to run other parts of the code from the moment this function is invoked..
db.User.get(userId, function(err, user) {
	// .. until the moment the user object has been retrieved here
})

But a part of CPU-bound code in Node.js instance with thousands of clients connected is all it takes to block the event loop, that makes all the clients wait. CPU- bound codes include attempting to sort a large array, running a long loop, and so on. For instance:

function sortUsersByAge(users) {
	users.sort(function(a, b) {
		return a.age < b.age ? -1 : 1
	})
}

Calling this “SortUsersByAge” function may be fine if run on a small “users” array, but with a large array, it will have a horrible impact on performance. If this must be done and you’re certain that there will be nothing waiting on the event loop(for instance, if this was part of command line tool that you’re building with Node.js and it wouldn’t matter if entire thing ran synchronously), then this may not be an issue.

But in Node.js server instance trying to serve thousands of users simultaneously, such a pattern can prove fatal. 

If users array was retrieved from the database, the best solution will be- to fetch it already sorted directly from the database. If event loop blocked by loop written to compute the financial transaction data, it could be deferred to some external worker/queue setup to avoid hogging the event loop.

There’s no perfect solution for this type of Node.js problem, instead every case needs to be addressed individually. Main idea is to not do CPU intensive work within front-facing Node.js instances- the ones client connect to concurrently. 

2. Deeply Nesting Callbacks-

Generally, nested callbacks referred to as “callback hell”, is not a Node.js issue in itself. But this can cause problems making code quickly spin out of control:

function handleLogin(..., done) {
	db.User.get(..., function(..., user) {
		if(!user) {
			return done(null, ‘failed to log in’)
		}
		utils.verifyPassword(..., function(..., okay) {
			if(okay) {
				return done(null, ‘failed to log in’)
			}
			session.login(..., function() {
				done(null, ‘logged in’)
			})
		})
	})
}

In this way, by nesting callbacks, you can easily end up with error-prone, hard to read and also maintain code.

One solution is to declare these task as small functions and then link them. Though the clean solution is to use utility Node.js package that manages asynchronous Javascript patterns like Aync.js:

function handleLogin(done) {
	async.waterfall([
		function(done) {
			db.User.get(..., done)
		},
		function(user, done) {
			if(!user) {
			return done(null, ‘failed to log in’)
			}
			utils.verifyPassword(..., function(..., okay) {
				done(null, user, okay)
			})
		},
		function(user, okay, done) {
			if(okay) {
				return done(null, ‘failed to log in’)
			}
			session.login(..., function() {
				done(null, ‘logged in’)
			})
		}
	], function() {
		// ...
	})
}

Just like “async.waterfall”, there are lost of functions that Async.js provides manage with different asynchronous patterns. 

3. Invoking Callbacks, Multiple Times-

Javascript is popular because of relying on callbacks. Callbacks were the only way asynchronous elements of your code communicated with each other in Node.js until promises came into picture. Still package developers  design their APIs around callbacks and hence callbacks are in use. Mistake that developers make while using callbacks is calling them multiple times.

Thursday, December 30, 2021

What’s New In Next.js 12?

 

What’s New In Next.js 12?

What's New In Next.js 12

These days, Next.js is the most loved framework in the React ecosystem because of the great features that it provides such as hybrid static & server rendering, Typescript support, smart bundling, route pre-fetching and so on. On 26th October 2021, Next.js released its new version, which is Next.js 12. It includes features like performance optimization, middleware, react 18 support etc. If you’re going to use Next.js for your next project, then you are at the right place. Knowing the latest features of Next.js 12 will help you in development. Let’s see the amazing new features of Next.js 12.

What’s New In Next.js 12?

Next.js logo

1. Middleware-

Middleware enables you to catch HTTP request and run some code and logic before it is complicated. We know that having middleware in web application is not new and you can experience similar concept being used in other programming languages or in Javascript frameworks such as Express.js. 

One of the benefit of having middleware in next.js 12 is that you can combine it with the features offered by the framework. While implementing a middleware, create a file as _middleware.js in directory which includes the routes that you want to intercept. If you want to create middleware that will manage web app pages, create a fine in /pages/_middleware.js

import { NextResponse } from "next/server";
   
const secretKey = "preview-mode";
 
export function middleware (request) {
  const headerKey = request.headers.get("secret-key");
 
  if (headerKey === secretKey) {
    return NextResponse.next();
  }
 
  return new Response(null, { status: 401 });
}

Programmers can use a Middleware for various use cases like localization, logging, Redirect/Rewrite, authentication, A/B testing and so on. Middleware makes use of runtime that supports standard Web APIs. If anyone want to implement a middleware in Next.js app, just run it locally using next start, or host it on Edge platforms such as Vercel, using brand new Edge Function.   

Vercel Edge Functions are serverless functions such as AWS Lambda or Azure Functions, except that they are deployed in CDNs, close to end users, enabling web app to work faster.

2. ES module support and URL import-

In the Next 12 version, ES module support is default. ES modules is official ECMAScript module standard for Javascript and supported by Node.js and its major browsers.

Next 12 prioritizes ES modules over CommonJS. But still it supports importing NPM modules that use CommonJS. It helps developers to incrementally adopt ES modules without affecting changes. Next 12 experimentally supports URL imports of packages that use ES modules. Meaning that a package can be imported directly from URL and there is no need for installation or separate build step. Also, these packages are cached locally to support offline development. It results that Next.js can process remote HTTP(S) resources such as local dependencies.

Next supports both client and server URL import. When Next detects URL import, it creates a next.lock file to track remote resource. While using this feature, add allowed URL prefixes inside next.config.js:

module.exports = {
  experimental: {
    urlImports: ['https://cdn.skypack.dev']
  }
}

And import modules:

import confetti from 'https://cdn.skypack.dev/canvas-confetti'

Any CDN which serves ES modules will work. For instance, JSPMunpkg and jsDelivr.

3. Rust compiler-

Performance optimization is a key feature of Next 12. So as to improve the performance, Next.js replaced the Babel compiler with an extensible Rust compiler – SWC.  It takes the advantage of native compilation. SWC is faster than Babel on a single thread and 70 times faster on four cores.

With Rust compiler, Next.js offers optimized bundling and compiling with 3 times faster builds for production. This results in faster build time on production and quick feedback in local development, better developer experience and faster development time.

4. Smaller Images Using AVIF-

Inbuilt image optimization API of Next.js supports AVIF images. It enables 20 percent smaller images compared to WebP. This is opt-in feature and can be enabled by modifying image.format property in next.config.js file:

module.exports = {
  images: {
    formats: ['image/avif', 'image/webp']
  }
}

5. Bot-aware ISR fallback-

ISR(Incremental Static Regeneration allows you to update static pages after building website without need to rebuild a complete website. With the use of ISR, static pages are generated dynamically at runtime rather than build time. While using ISR, Next.js determines the pages to be generated by static site generation using paths returned from getStaticPath function. Thus if you return paths to the 1000 most viewed articles, these pages are generated at build time.

Other pages in application can be generated on demand using fallback:blocking or fallback:true.

fallback:blocking is favored because when a request is made to a page that has not been generated, Next will server-render that page the first time and serve subsequent requests from the cache. However, while using fallback:true, Next.js will promptly serve a static page on the first request with loading state. And when the data finishes loading, Next will re-render the page and cache the data. But with the Bot-Aware ISR fallback feature, when using fallback: true for web crawlers like search bots, Next.js will automatically server-render ISR pages. However, Next will still serve a static page with loading state to noncrawler user agents. Hence it prevents crawlers from indexing loading states.

6. React 18 Support-

Even before the officially release of Next.12, it provides support for React 18. Now, you can use experimental features such as React.lazy, Suspense or APIs such as startTransition in Next.js apps. With the support for React concurrent mode, now we can use server-side Suspense and SSR streaming. 

Read more


Tuesday, December 28, 2021

What Is Remix? All You Need To Know About

What is Remix

There are lots of React frameworks available in the market. However, the React framework has something special to offer. Remix is a react framework used for server-side rendering(SSR). Means both backend and frontend can be made using a single Remix app. Data is rendered on the server and served to the client side with minimum Javascript. In contrast to vanilla React, where data is fetched on the frontend and then rendered on screen, Remix fetches data on backend and serves HTML directly to the user. Here we’ll discuss all the basics of React Remix.

What Is React Remix?

Remix logo

React Remix is a new react framework that  lets you focus on user interface and work back through web fundamentals to deliver a fast, slick and resilient user experience. Main goal of React Remix is to provide new development tool to boost build time, performance on runtime and development fluidity. Also it is focussed on SEO improvements and accessibility.

Benefits Of Using React Remix-

1. Transitions-

Remix handles all loading states for you, you just need to tell Remix what to show when the app is loading. IN frameworks such as Next.js, you want to set the loading state using some state management library like Redux or Recoil. Libraries can help you to do the exact same in other frameworks, Remix has this built-in. 

2. Nested Pages-

Any page in the route folder is nested in this route rather than being separate. Meaning that, one can embed these components into your parent page, that means less loading time. Benefit of doing this is that, we can enforce error boundaries to embedded pages, that will help with error handling.

3. Traditional Forms-

Previously, when developers used PHP, they used to specify a form method and action with a valid PHP URL; we’ll use a similar approach in Remix.It doesn’t sound fun as we are used to onClick, onSubmit, and HTTP calls. Remix manages this situation in a different way by providing functions such as action and loader for server side operations. In these functions, form data is easily available, means there’s no need to serve Javascript to the frontend to submit a form.

Consider that, you have a simple website and you don’t actually need to serve javascript to frontend. This traditional form method works best for this situation. In other frameworks, you might need to serve Javascript to make a fetch or an axios call, but you don’t need to do it in Remix. It keeps things simple.

4. Error Boundaries-

Consider a case that, you get an error in a Remix component or a nested route, errors are restricted to the component and the component will fail to render or simply it will show error. In other frameworks, it will break the entire page, and will see a huge error screen. 

While error boundaries can be implemented in Next.js also, Remix has this built-in and it’s a great feature for production builds and so user doesn’t get locked out of the entire page for simple error.

Features of React Remix-

1. React Remix Routing, Nesting Routes, Suspense Cache, Scroll Restoration-

NextJS builds the routes based on project structure. We declare inside the pages folder the files we want and the framework uses the names to build all application routing system.  React Remix does the same using a folder called routes. It builds the routes based on the File System too. And this is biggest innovation in React Router. Rather than only replicating GatsbyJS or NextJS, they added Nesting Routes. Meaning that, we can have nested routes where children inherit parent layout without replicating in the code the container component.

Project Structure

In react router is used to provide loader for component and then will cache the rendered component. In this way, it doesn’t take care of browser history. Means if you change the order to get to a particular page, the cache will pick the rendered component as usual. In React Remix, they need to change this way, enabling a Suspense Cache based on Location. Whenever we push a page to history state, it becomes unique and Suspense caches the component based on the Location and not on the properties. If we navigate back and forward, or if we push again same page again by visiting it from the navigation link, it will be another record.

Concluding with routing features, it included a great functionality called scroll restoration. Every page will cache the scroll position if we get back to it and can continue from where we stop. Here main role is played by the Suspense that can store same pages but with different scrolls, if they are part of different location in history state.

2. React Remix Error Handling-

One more great feature of Remix is about Error boundaries. In React we can catch app errors having a top level component with function like componentDidCatch. In Remix, you can use Nested Error Boundaries and once more it is an export function, as far as the others before. Remix is easing everything.

// Use for runtime errors
export function ErrorBoundary({ error }: { error: Error })
{
console.error(error);
return (
  <div>
   <h1>There was an error</h1>
   <p>{error.message}</p>
  </div>
   );
  }

//Used for loaders or actions
export function CatchBoundary() {
const caught = useCatch();

let message;
switch (caught.status) {
case 401:
message = (
 <p>Oops! The page does not exist.</p>
);
break;

default:
 throw new Error(caught.data || caught.statusText);
}

return (
<div>
<h1>
{caught.status}. {caught.statusText}
</h1>
{message}
</div>
);
}

You can export ErrorBoundary for general runtime errors. You can use CatchBoundary for loaders or actions errors.

3. Server Side Rendering-

Simple answer to “What is React Remix” is Server Side Rendering. It is performant at runtime so helps to build better website particularly for first time user visit. This can improve SEO as NextJS is doing. Also, SSR can run in development mode and there is a small difference more and it is related with data loading. 

4. SEO tags-

SEO improvement is another goal of React Remix and they perfectly achieved it. A React Router can be used to improve SEO without using other libraries to improve meta tags or page title and react router uses an export to set meta tags. It is possible to set the page title and description. 

Monday, December 27, 2021

Top 10 App Performance Monitoring Tools

Top 10 App Performance Monitoring Tools

Applications are an important part of our life as we use it for our day to day tasks like online shopping, ordering food, cab booking and lots of like this. So many businesses are creating apps to deliver the best service to their customers. Hence it is also important to develop the best performing app. Only developing the best performing app is not sufficient, it is also important to monitor the app performance and make changes accordingly. But how could you monitor the app performance? Here comes the need of App performance monitoring tool.

App performance monitoring tools can reduce management burden, provide single platform to manage the burden by managing all the apps instead of managing and troubleshooting every app individually. It also ensures the issues related to app performance are defined and identified. App performance can be monitored or tracked using various categories like load time, response time and apdex score. Here we’ll discuss the best app performance monitoring tools. But before diving into the app performance monitoring tools, let’s see what app performance monitoring is.

Also know- Best Tips to improve your mobile App performance

What Is App Performance Monitoring?

App performance monitoring encompasses controlling overall performance, including code, app dependencies, transaction timings and user experience. One can observe the instances where users encountered problems and why it happened by using the warning issued to monitoring tool. It gives you a complete insight into app performance, helping DevOps teams to identify problems and preparing to respond to similar issues in the future. Here are the components of the application performance management solution.

  • Basic server metrics
  • Custom application metrics
  • Application server metrics
  • Detailed transaction trace
  • Individual performance web request
  • Performance use and performance
  • Code level performance profiling
  • Application error
  • Application log data

Tips To Select Best App Performance Monitoring Tool-

Traditionally, app performance management solutions were available only to large businesses and were used to track business transaction. But, in recent years, APM tools have grown more inexpensive and essential for all enterprises. APM technologies have become an important aspect of DevOps initiatives.

Important things to consider-

  • SaaS vs On-premises
  • Cloud support
  • Pricing
  • Programming language
  • Ease of use

Let’s see App performance monitoring tool list.

Top 10 App Performance Monitoring Tools-

1. AppDynamic Application Performance Monitoring-

AppDynamic Logo

Started in 2008, it provides automated cross-stack intelligence for BI and app performance monitoring. According to Gartner’s study report, AppDynamics was rated APM leader for the 9th time. Product suits like End user monitoring, Infrastructure visibility, business performance, app performance make up the AppDynamic Platform. Here are spem of the features of AppDynamic-

  • End to end transaction tracking
  • Code level visibility
  • Languages support: Java, .Net, Node.js, Python, C++
  • Dynamic baseline and alerting

2. New Relic Application Performance Monitoring-

New Relic logo

Since 2008, it has swiftly expanded and evolved into an essential tool for programmers, business executives and IT support teams. Now it supports customers and helping them in improving the performance of their applications. Also it offers APM for mobile apps, infrastructure monitoring, advanced browser performance monitoring etc. Here are some of the great features of Relic-

  • App monitoring performance trends at a glance
  • Performance tracking of individual SQL statements
  • Code level diagnostics
  • Cross app tracing
  • Languages- Ruby, node.js, PHP, Go, .NET, Java
  • Monitor critical business

3. Scout(SolarWinds)-

Scout Logo

It delivers auto-discovered topological visualizations of programs and their components by using its agent. You might need more time to learn so you may have to wait until enough data points have been collected before you stop getting false positives. Here are some of the great features of Scout-

  • Memory leak detection
  • Automatic Dependencies Population
  • Languages: Ruby on Rails
  • Github integration
  • Slow database query analysis

4. Stackify Retrace-