3

Modernizing Frontend Applications: A Guide

 1 year ago
source link: https://blog.bitsrc.io/modernizing-frontend-applications-a-guide-b0bac99be932
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Modernizing Frontend Applications: A Guide

0*HYm1KwCp_ljyEhyT.jpg

The ever changing requirements of clients have came to a point where we can’t serve them through legacy frontend applications. However, not many companies put the effort to modernize their existing frontend and end up spending trillions of dollars to keep the lights on in their legacy frontend applications.

Modernizing a frontend application not only helps to cut down the maintaining costs. It also brings about new features within the frontend framework to help deliver a better user experience to an end client. For example:

  1. Companies using a certain tech like NextJS are migrating from React 16 to React 18 to use performance-optimized features such as Streaming SSR.
  2. Companies are now changing the way they make frontends. They’ve moved from building monolith frontends to Microfrontends as they have realized the effort needed in building, deploying, and maintaining an application is significantly lower. Not only that but also these architectural changes ultimately make an application perform faster.

However, it takes work to modernize a frontend application. Many would peg it to be quite tricky because it often means that:

  1. First, you have to build your entire application from scratch.
  2. You will unlikely reuse code from your old framework due to mismatching syntax or structures.
  3. You must spend time understanding the new framework while revisiting the legacy application to understand its implementation, which can delay the launch.

Hence, this article will propose several things that you, as a developer or architect, can use to successfully modernize your legacy frontend applications to meet the ever-so-demanding workloads of the modern day and age.

Modernizing Frontend Applications

1. Start gradually — Build new components outside your legacy codebase

It’s essential to take your time with the process of modernization. If everything is done right at the get-go, there is no way of retaining the existing legacy code in case you go wrong at some point.

Hence, you should start by modernizing a part of your application first. It helps to better understand the new technologies and ease the transition process while preserving the legacy application.

The problem is you have to work in your legacy codebase and everything that comes with it — which makes it almost impossible to refactor or add a modular feature or functionality in an independent way. But there are tools that solve this problem and let you gradually modernize your legacy apps, one application component at a time.

Bit is a great solution to help implement a simple transition workflow. For example, Bit allows developers to work independently on “components” (i.e. features, app parts etc) with different technological stacks while utilizing an isolated development environment and release pipelines. Furthermore, it allows to create modernized reusable components that a migrating legacy frontend application can later consume.

0*sr-kiaP9BMGbjqt7.png
Figure: Composable microfrontends via Bit

The figure above shows a sample example of how a front-end will look like when designed using micro-frontends via Bit. It highlights in red a list of all independent components to comprise the application, thus enhancing re-usability, scalability and maintainability.

Additionally, the capability of working on single features at a given time allows developers to implement a more gradual transition rather than an “all or nothing” change.

Furthermore, every component you build is a feature that can be now used in any number of applications, old or new alike. It’s easier to manage and update your components to make sure all your apps are in sync and you avoid repeating work, code, setup, and decisions.

2. Choosing The Right Framework

It’s important to modernize while thinking about your frontend application in the long run.

Will the framework die out? Will the framework keep up with the complexity? For example, will you modernize your application using Vanilla JavaScript, Web Components, Stencil, or a frontend library like React?

Hence, it’s essential to select the proper framework to minimize complications. You need to select a framework that will help build loosely coupled, reusable frontend components is essential. For example, if you are maintaining two to three applications that use the same navigation bar, consider using a framework that allows such reusability.

By considering this, select the proper framework to proceed. Afterward, you can commence independent development of your frontend application using a desired technological stack via Bit.

Additionally, it is essential not to reinvent the wheel. If there is a component you need that someone has already implemented, use it rather than putting in an unnecessary effort to implement it. Bit Cloud offers a wide variety of readily available reusable components you can directly integrate into your modernizing frontend application to reduce development time drastically.

3. Think About SSR

The future of frontend development relies heavily on Server Side Rendering. In a nutshell, Server Side Rendering (SSR) is the process in which a server converts an HTML file to a fully rendered HTML page. In modernized frontends, SSR plays a massive role in delivering a rich user experience to the user.

For example, many applications nowadays leverage “Open Graph” to help generate preview cards on social media. One such preview is illustrated below.

0*TwvxGDcQiRtOkqTF.png
Figure: Creating a social post on LinkedIn using Open Graph

The figure depicted above shows how Bit leverages the use of Open Graph to display a preview card of their page on a social post.

The recommended way to implement such functionalities is via Server Side Rendering. However, such features are considered bare industry minimums and must be taken seriously when modernizing a legacy frontend. Hence, it is essential to pay attention to Server Side Rendering.

4. Thinking in Security

In legacy applications, you’re bound to be working on a monolith application where developers can navigate across all the components in your application. Therefore, it creates a less secure frontend. However, nowadays, most applications contain sensitive components that you may want only a few people working on. Hence, it is vital to consider security when modernizing a frontend application.

It is crucial to separate lines of access to specific frontend components to ensure that only authorized people are allowed to do so. With Bit, you can securely continue modernizing your frontend application using Bit Scopes. In addition, Bit Scopes will allow you to create independent collaboration spaces to place components, and only developers with write access to the scope can manage it.

5. Adopting Micro Frontends

A recent trend picked up by frontend development teams is the concept of “Microfrontends.” Microfrontends provide a more robust and efficient development workflow and are one of the critical things you should consider when modernizing your legacy frontend application.

Essentially, Microfrontends are branched out from Microservices with the sole purpose of rethinking how a website is developed. A web application is broken into a spectrum of features, where each part is built and maintained by independent development teams.

0*3WLxdPBIivU77eVR.png
Figure: Viewing Micro Frontends

The figure above depicts an architectural representation of a Microfrontend. A giant legacy monolith is re-architected and split into several features (with a clear business vision), each designed, built, and maintained by independent development teams.

Figure — Splitting Microfrontends across independent teams

The figure above depicts a simple implementation of Microfrontends where the application comprises of different components that are developed and maintained by two teams.

Microfrontends can significantly boost build and deployment teams as your application is no longer a giant monolith. Instead, you have a collection of mini frontend applications independently tested and deployed, creating a significantly lower deployment time. It is a critical factor that must be considered when modernizing frontend applications. One aim of migrating from a legacy frontend application to a more modern approach is simplifying releases and management.

However, implementing Microfrontends is incredibly complex as you have to manage independent development workflows, CI/CD pipelines and share the components. Therefore, most companies fear adopting Microfrontends. But, Bit is the go-to industry software standard for designing, building, and managing Microfrontends. Bit offers a more simplified and abstract approach to implementing Microfrontends as it hides all the unnecessary complexity from the user. Furthermore, it considers collaboration, access restriction, automated building, testing, and even releasing on static hosts such as Netlify. They have even designed their entire landing page using Microfrontends in Bit to demonstrate how it works.

6. Give Ownership To Teams

This factor goes hand-in-hand with adopting Microfrontends for modernizing frontend applications. When you split your application into a set of features and let independent teams design, build and maintain it, this process improves release efficiency. A part of adopting Microfrontends is to put more trust in your independent development teams. You give your independent development teams more control over their features. This situation helps improve accessibility and security.

With Bit, you can create multiple scopes on Bit Cloud where a corresponding development team can maintain each scope to build and manage their business feature. The most significant advantages of adopting such an approach are that:

  1. Development teams can determine who gets to contribute to the feature.
  2. Reusable components exported to the scopes can be implemented in the modernized application and updated independently.

7. Bring DevOps Into The Play

An essential process in modernizing frontends is the implementation of DevOps within frontend development. When modernizing frontend applications, it is vital to ensure that each component works as expected. Therefore, every time a change occurs, it is crucial to run regression and unit tests to ensure that the frontend application behaves as expected.

As you modernize your frontend, you will likely develop a more complex application structure that cannot tolerate manual tasks for integration and deployment. Hence, it would be best if you considered creating a binding integration of DevOps onto your Microfrontend development approach. In addition, it encourages frequent check-ins that help integrate and test the frontend application frequently and even deploy it to static hosts for your end customers to consume.

Bit provides independent build and test pipelines for every component you design and develop. Bit not only maintains a state of all components and only builds the components that have undergone a state change but also provides means of deployment on static hosts such as Netlify to help deploy your application after the CI process has been completed.

Considering the above seven practices will help you find the right path to modernizing your existing legacy frontend application.

Concluding Thoughts

It’s important to modernize frontend applications to ensure that your company can keep up with the customer’s ever-changing demands.

The principles proposed in this article will help put you on the right track and provide a firm understanding of how to start modernizing your application.

Therefore, I hope that you have found this article helpful.

Thank you for reading.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK