Blog about Java, Spring, Spring Boot, Microservices, Hibernate, Go, Kotlin, Certification, Interview, React, Angular, Vue, Full-Stack, etc.
Micro Frontends
Get link
Facebook
X
Pinterest
Email
Other Apps
Hello everyone, I hope you all are doing well!
"Our end users don’t care whether your app is a monolith or micro-frontends—they just want an app that loads expeditious and solves their quandaries. " ✌ Knowledgefactory.net[Sibin]
Today we are going to discuss Micro-frontend architecture, Maybe most of the latest digital products are adopted microservice architecture on their back, companies are blissful and developers are relishing their works, from all the angles technical experts are verbally expressing microservice architecture is fine.
But, the Front end part is still monolithic. It's the right time to think about Micro Frontend architecture
What is Micro-frontend architecture?
Micro-frontend architecture is a design approach in which a front-end app is decomposed into individual, micro-apps working loosely together. The micro-frontend concept is vaguely inspired by, and designated after, microservices.
A simple micro-front end architecture
Some of the benefits of the micro-frontend pattern:
Independent development teams can collaborate on a front-end app more easily.
Micro frontend codebases can be smaller, more manageable
Micro frontends promote reusability across process and case management
Micro frontends help you rapidly develop different views of your processes relevant to each person’s role
Micro frontends are sections of our UI, often consisting of 'n' number of components, that use frameworks like React, Vue, and Angular to render their components. Each micro frontend can be managed by a different team and may be implemented utilizing its own framework. It is practical and suggested to utilize just one framework for all your micro frontend, albeit you may integrate additional frameworks when migrating or when experimenting.
Each micro frontend has its own code repository, its own package.json file, and its own build implement configuration. As a result, each micro frontend has an independent build process and an independent deploy / CI. This generally betokens that each repo has expeditious build times.
Are micro-frontends the right cull for you?
There’s an abundance of substantial reasons to adopt a micro-frontends architecture, but they do integrate an abundance of involution to your front-end ecosystem. Afore you go ahead and modify your app to utilize micro-frontends, ascertain that you take a moment to evaluate if the involution is worth the payoffs that micro-frontends give you. Here are two reasons why you might adopt a micro-frontends architecture.
You have a huge app with a ton of complexity
You have multiple teams contributing to our app, and each has its own deployment cycles.
Our end users don’t care whether your app is a monolith or micro-frontends—they just want an app that loads expeditious and solves their quandaries. Granted, something like micro-frontends might avail us meet that goal in a more scalable way, but at the end of the day, the utilizer should feel like they are utilizing a single application.
The Bit is a scalable and collaborative way to build and reuse components. It's everything you need from local development to cross-project integrations.
If you take a look at the bit.dev homepage you will notice that it is composed of independent components that are built by different teams, in different codebases, and are all integrated together to create a cohesive product.
single-spa is a framework for bringing together multiple JavaScript micro frontends in a frontend application. Architecting your frontend using single-spa enables many benefits, such as: Use multiple frameworks on the same page without page refreshing (React, AngularJS, Angular, Ember, or whatever you're using)
SystemJS is a module loader that can import modules at run time in any of the popular formats used today (CommonJS, UMD, AMD, ES6). It is built on top of the ES6 module loader polyfill and is smart enough to detect the format being used and handle it appropriately.
We should use Webpack to generate a bundle for production or development, let's say Webpack helps you to generate a folder called dist and a file main.js within this folder. This is the result of all of your JavaScript code that you normally have in a folder called src
The more we add code into our src folder the heavier is this main.js file that Webpack generates. Remember that this is the file you take to our production environment and clients download in their browsers, if this file is heavy that means it will take longer for the users to load your page.
That means we care about the size of our bundle but we also want to keep adding new features to our projects
With Module Federation we can import remote Webpack builds to our application. Currently, we should import these chunks but they would have to come from your same project. Now, we have these chunks (Webpack builds) from a different origin, which means, a different project!
Example 1: Java 8 program to print odd numbers from a List import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; /*Java 8 Program to find Odd Numbers from a List*/ public class DriverClass { public static void main( String [] args) { List < Integer > numbers = Arrays. asList( 1 , 4 , 8 , 40 , 11 , 22 , 33 , 99 ); List < Integer > oddNumbers = numbers.stream(). filter(o -> o % 2 != 0 ). collect(Collectors.toList()); System.out.println(oddNumbers); } } 1. Initialize List using Arrays.asList() method. Java's built-in Arrays.asList() method converts an array into a list. This method takes an array as an argument and returns a List object. 2. Java List interface provides stream() method which returns a sequential Stream with list of Integer as its source. 3. The Java stream filter(...
In this section, we will show you how to convert a List of objects to another List of objects in Java using the Java streams map(). The ‘map’ method maps each element to its corresponding result. Java Stream API The Java Stream API provides a functional programming approach over the object oriented capabilities of Java. It is used for processing collections of objects. The Stream in Java can be defined as a sequence of elements from a source List, Set or Array. Most of the stream operations return a Stream. This avails engender a chain of stream operations(stream pipe-lining). The streams withal support the aggregate or terminal operations on the elements. for example, finding the sum or maximum element or finding the average etc...Stream operations can either be executed sequentially or parallel. when performed parallelly, it is called a parallel stream. Stream map() Method The Java 8 Stream map() is an intermediate operation. It converts Stream<obj1> to Str...
In this section, we will learn how to create user registration and login using Spring boot, Spring security, Thymeleaf, JPA, and H2DB. The GitHub repository link is provided at the end of this tutorial. You can download the source code. Technologies used: Spring Boot 2.5.5 Spring Data JPA Spring Security Thymeleaf Maven 3+ Java 17 H2 Database User Interface User Registration Authentication Failed Authentication success Sign out Final Project Structure: Complete pom.xml: <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion >4.0.0</ modelVersion > < parent > < groupId >org.springframework.boot</ groupId > < artifactId >spring-boot-starter-pare...
Hello everyone, Hope you are doing well. Here, we provide a Library Management System mini-project for beginners, it's free for download. Maybe you can build more on top of this project and create your own product, that's all about you. The source code download link is provided at the end of this post. 1. Benefit of this project You could cover the following technologies and features by learning and debugging this mini project. Java 17 Java Stream Java Lamda Expressions Java Records Functional programming Object-oriented programming var Keyword in Java Generics in Java Java Switch Spring boot 2.6.4 Spring Security Thymeleaf template engine OpenCSV Spring Data JPA Server Side Pagination H2 Database Bootstrap HTML CSS and more... 2. Objective Of Spring Boot On Library Management System The main objective of this project is to manage the details of the books, author, category, and publisher. Only Admin/Librarian will manage all these activities. Also, they can export the data in ...
In this tutorial, we’ll create a user registration & login example using ReactJS, Spring Boot, Spring Security, and JWT authentication. You could download the source code from our Github repository, the download link is provided at the end of this tutorial. Technologies used Backend Technologies: Java 17 Spring Boot 2.7.0 Spring Security Spring Data JPA JWT H2 Database Frontend Technologies: React 17.0.1 Axios 0.27.2 Redux 4.0.5 Bootstrap 4.5.2 ReactJS - SpringBoot - JWT - Flow Backend Project Directory: Frontend Project Directory: Following is the screenshot of our application - User Registration: User Signin: Profile View: Access Resource: We will build two projects: 1. Backend: spring-boot-security-jwt 2. Frontend: react-redux-jwt Project 1: spring-boot-security-jwt Pom.xml <?xml version = "1.0" encoding = "UTF-8" ?> <project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"...
The term ORM refers to object-relational mapping, which uses objects to adapt programming languages to database systems while allowing them to function with SQL and object-oriented programming ideas. Any kind of database management system that can accomplish object mapping to the table in the virtual system is suitable for the implementation of ORM. Java has a wide variety of ORM tools, some of which are mentioned below: 1. Hibernate Hibernate is a lightweight, open-source, non-invasive Java ORM (Object-Relational Mapping) framework that allows developers to create objects that function independently of database software and create persistence logic in any Java or JavaEE application. It offers an abstraction layer, so developers don't have to bother about implementations; Hibernate handles these tasks internally, such as connecting to databases and creating queries to carry out CRUD operations, among other things. Persistence logic development is done with it. Persistence logic r...
Blowfish is an encryption method developed by Bruce Schneier in 1993 as an alternative to the DES encryption method. It is significantly faster than DES and provides good encryption speed, although no effective cryptanalysis technique has been found to date. It is one of the first secure block ciphers that is not protected by any patents and is therefore freely available for anyone to use. This is a symmetric block cipher algorithm. Block size: 64 bits Key size: variable size from 32 to 448 bits number of subsections: 18 [P-array] number of rounds: 16 number of substitution blocks: 4 [each with 512 records of 32 bits each] develop Example 1: Encryption and decryption using Blowfish import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Base64; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSiz...
Hello everyone, Today we will learn how to stream MP4 video using Spring Boot and Spring Web Flux. The Source code download link is provided at the end of this post. New, Quarkus Practice User Interface Project Structure: G radle(build.gradle) plugins { id 'org.springframework.boot' version '2.5.4' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' } group = 'com.knf.demo' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-webflux' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'io.projectreactor:reactor-test' } test { useJUnitPlatform() } Service (VideoStreamingService.java) package com.knf.demo.service ; import org.springframework.beans.factory.annotation. Autowired ; import org.springframework...
In this section, we will learn how to create a simple spring boot application to perform different file operations such as upload, download, list, and delete files from the Google Cloud Storage. 1. A little bit of Background Google Cloud Storage Cloud Storage is a managed service for storing unstructured data. Store any amount of data and retrieve it as often as you like. More Info - click here! Spring Boot Spring Boot makes it easy to create stand-alone, production-grade Spring-based Applications that you can "just run". More Info - click here! 2. Create a GCP Project First, Sign into the Google console at https://console.cloud.google.com . You can create a new project by first selecting the project dropdown in the top left and selecting " New Project ". Next, specify your GCP Project name and Project ID . Then Click on the " CREATE " button. Copy " Project ID " and keep it for future purposes. 3. Create a Google Cloud Storage bucke...