Serverless for Frontends

Rate this content
Bookmark

In this talk micro frontend expert Florian Rappl will introduce the pattern of creating a Siteless UI. This is a frontend composed of different pieces that can be developed independently and are deployed without having or managing any server. Florian will show you how to get started in that space, what decisions to take, and what pitfalls you should avoid.

8 min
25 Mar, 2022

AI Generated Video Summary

Welcome to my session on Serverless for Front-ends. Serverless functions eliminate the need for a runtime and handle orchestration for you. Microfrontends require a runtime and orchestration, but side-less UIs provide a runtime-free solution. In the demo, a new team adds functionality to an application and publishes it easily. Building and deploying applications is quick and easy with micro apps and PowerCLI, offering true loose coupling and instant availability without a runtime.

1. Introduction to Serverless for Front-ends

Short description:

Welcome to my session, Serverless for Front-ends. I'm a solution architect at SmartPyat, mainly dealing with distributed web applications and microservices. Microservices require an embedded runtime, orchestration, and deployment. In contrast, serverless functions eliminate the need for a runtime and handle orchestration for you. Microfrontends in the front-end also require a runtime and orchestration, but side-less UIs provide a runtime-free solution.

Hello, everyone. Welcome to my session, Serverless for Front-ends. My name is Florian Rapper. I'm a solution architect at SmartPyat. We are mainly doing distributed web applications, which means we are also dealing a lot with microservices.

Now, as you know, microservices come with an embedded runtime. So you need to have that in order to make it run, right? You are responsible for actually the whole stack. You also need to have a location where you deploy them, whether that is a virtual machine or a real machine or just inside, for instance, a Kubernetes cluster. But you need to allocate that, and you potentially also need to manage that. And most importantly, they require some orchestration. So when you just create a new microservice, you need to make the space, you need to make the other microservices aware of that.

Now, in contrast, there's this pattern of serverless functions where there is no runtime, right? Everything is already there at a fixed point of provisioning. That's also where you publish at the end. This is a point that you don't need to maintain. That's just there. But you need to be aware of it, of course. In the end, that point also takes care about the orchestration for you. So whenever you publish something there, it already gets wired up with the other serverless functions that you have.

Now, compare that with the front-end. In short, what we want is to have a pattern that reduces the scope to focus almost exclusively on the domain functionality, right? In the front-end, there is the pattern of microfrontends, very similar to the microservices. They also need to have a runtime. Of course, if you run microfrontends in a server-side orchestration mode, then it's pretty obvious. But also if you combine them in the front-end, you would need a runtime. Think of iframes, for instance, or other mechanisms. You also need to have a way on how to deploy them. That could be as easily as a CDN somewhere. But then you again require some orchestration. How do you make the whole application aware of this new microfrontend?

Now, this is where side-less UIs come in. They require no runtime. They can just be published to such a fixed point as we've seen with serverless.

2. Demo of Adding Functionality

Short description:

And they also orchestrate just automatically. Let's look at the demo to see how that looks. A new team is onboarded to create a functionality. They add a Surprise Me button in the menu bar with a page that shows a random selection of movies. They bring everything together in the setup function and run the application. Now you can add all the existing functionality via the browser extension. The next stage is to publish it.

And they also orchestrate just automatically. Right? So whenever you deploy something new, it just gets automatically provisioned and it's just part of your application.

But let's look at the demo to see how that looks. So here we have a little Netflix clone. It's fully interactive. Of course, it's not the full Netflix. But you can see you can browse it. You can have your favorites there, and it's all working.

Let's pretend that a new team has to be onboarded that creates a functionality. It could start in a command line, as you can see here. It just makes an npm initialized command. Then it just needs to say where is the application source? In this case, we're using our demo application. They've chosen a bundler, ESBuilt. And they want to have it all in a new directory, going in there, going in VS Code. This team starts now happily coding. They want to add a Surprise Me button in the menu bar, with a page that just shows a random selection of movies. They add all the code in React. There is pretty much no magic here. Then they bring everything together in the setup function. In there, they just wire up all the components that they've written with parts of the application. They also make use of a common functionality called the movie tile here. Or they want to see the application, they just run it. This works fully locally, so it can also be done on a plane when you're offline. As you can see, the application shell is there, but it's empty. Well, that's because there is just one of these applets here that are called pilots.

Now you can add, of course, all the existing functionality, which is done via this browser extension. And ta-da, the thing just works. The selection is there, also the application is now fully populated. You've got the browse page and our surprise me button already works. Now, the next stage for this team is, of course, to publish it.

3. Building and Deploying Applications

Short description:

You can build and pack the application, upload it via the web interface, and see the new functionality go live in just a few minutes. The application is composed of micro apps that bring their own components, allowing for consistent stitching together of the application. Teams use PowerCLI to develop, debug, build, and ship new functionality. End users access the application through a URL, and the development process offers true loose coupling and instant availability without the need for a runtime.

And like with a serverless function, what you want to do is you can either do it in your CICD pipeline, which is great for automation, or now here for deductive purposes, you can just use that portal. So you build the application and then at the end, you just pack it, you get a tar ball that should be very familiar for everyone who dealt with AWS Lambda, for instance. Now here we have it. And then we just upload it here via the web interface. So we select it, it gets uploaded, and voila, we got a new functionality here, refresh the page and suddenly it's live. So the full end to end pipeline done here in just a couple of minutes. Very fast.

Now let's recap what you would see in this application is that it's composed of a lot of these micro apps, and each app brings its own kind of components. So that way you consistently stitch together an application, for instance, a browse menu button and the browse page come from the same micro frontend. Even the more important ones like this movie title that we've seen that really carries let's say a snapshot of the movie plus of course the ability to watch it comes from micro frontend. In the end, it's just developed by teams that use the PowerCLI, which is a command line tooling. They can use this to scaffold a new piece of functionality, to debug it, build it and of course to ship it at the end.

The end users then access this application all by just having a URL going against that serverless functionality called the feed service in this instance. Now, let's compare for conclusion, what we gained here with societal UIs against serverless. Likewise, we're doing development in a standard IDE. So no surprises here, everything just works as you know, already from serverless functions. You debug then with an emulator. You get your full application working offline. You can combine it together with applications that are live out there. You have therefore true loose coupling. There's no hard wiring here. So if something's just missing, the application still works. You need to provide that self-definition or manifest. We've seen the setup function where you actually stitched together the various parts and you deployed it all without a run time, essentially giving you instant availability. So no need to take care of any of that.

That's it from my side. We are out of time. I would like to thank you, I wish you all a great conference. If you want to check out the demo, learn more, then check out pyrit.io and have a great day.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

React Advanced Conference 2021React Advanced Conference 2021
19 min
Automating All the Code & Testing Things with GitHub Actions
Code tasks like linting and testing are critical pieces of a developer’s workflow that help keep us sane like preventing syntax or style issues and hardening our core business logic. We’ll talk about how we can use GitHub Actions to automate these tasks and help keep our projects running smoothly.
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Fine-tuning DevOps for People over Perfection
Demand for DevOps has increased in recent years as more organizations adopt cloud native technologies. Complexity has also increased and a "zero to hero" mentality leaves many people chasing perfection and FOMO. This session focusses instead on why maybe we shouldn't adopt a technology practice and how sometimes teams can achieve the same results prioritizing people over ops automation & controls. Let's look at amounts of and fine-tuning everything as code, pull requests, DevSecOps, Monitoring and more to prioritize developer well-being over optimization perfection. It can be a valid decision to deploy less and sleep better. And finally we'll examine how manual practice and discipline can be the key to superb products and experiences.
DevOps.js Conf 2022DevOps.js Conf 2022
27 min
Why is CI so Damn Slow?
We've all asked ourselves this while waiting an eternity for our CI job to finish. Slow CI not only wrecks developer productivity breaking our focus, it costs money in cloud computing fees, and wastes enormous amounts of electricity. Let’s take a dive into why this is the case and how we can solve it with better, faster tools.
DevOps.js Conf 2022DevOps.js Conf 2022
31 min
The Zen of Yarn
In the past years Yarn took a spot as one of the most common tools used to develop JavaScript projects, in no small part thanks to an opinionated set of guiding principles. But what are they? How do they apply to Yarn in practice? And just as important: how do they benefit you and your projects?
In this talk we won't dive into benchmarks or feature sets: instead, you'll learn how we approach Yarn’s development, how we explore new paths, how we keep our codebase healthy, and generally why we think Yarn will remain firmly set in our ecosystem for the years to come.

Workshops on related topic

DevOps.js Conf 2024DevOps.js Conf 2024
163 min
AI on Demand: Serverless AI
Featured WorkshopFree
In this workshop, we discuss the merits of serverless architecture and how it can be applied to the AI space. We'll explore options around building serverless RAG applications for a more lambda-esque approach to AI. Next, we'll get hands on and build a sample CRUD app that allows you to store information and query it using an LLM with Workers AI, Vectorize, D1, and Cloudflare Workers.
DevOps.js Conf 2022DevOps.js Conf 2022
152 min
MERN Stack Application Deployment in Kubernetes
Workshop
Deploying and managing JavaScript applications in Kubernetes can get tricky. Especially when a database also has to be part of the deployment. MongoDB Atlas has made developers' lives much easier, however, how do you take a SaaS product and integrate it with your existing Kubernetes cluster? This is where the MongoDB Atlas Operator comes into play. In this workshop, the attendees will learn about how to create a MERN (MongoDB, Express, React, Node.js) application locally, and how to deploy everything into a Kubernetes cluster with the Atlas Operator.
DevOps.js Conf 2022DevOps.js Conf 2022
13 min
Azure Static Web Apps (SWA) with Azure DevOps
WorkshopFree
Azure Static Web Apps were launched earlier in 2021, and out of the box, they could integrate your existing repository and deploy your Static Web App from Azure DevOps. This workshop demonstrates how to publish an Azure Static Web App with Azure DevOps.
React Summit 2023React Summit 2023
88 min
Deploying React Native Apps in the Cloud
WorkshopFree
Deploying React Native apps manually on a local machine can be complex. The differences between Android and iOS require developers to use specific tools and processes for each platform, including hardware requirements for iOS. Manual deployments also make it difficult to manage signing credentials, environment configurations, track releases, and to collaborate as a team.
Appflow is the cloud mobile DevOps platform built by Ionic. Using a service like Appflow to build React Native apps not only provides access to powerful computing resources, it can simplify the deployment process by providing a centralized environment for managing and distributing your app to multiple platforms. This can save time and resources, enable collaboration, as well as improve the overall reliability and scalability of an app.
In this workshop, you’ll deploy a React Native application for delivery to Android and iOS test devices using Appflow. You’ll also learn the steps for publishing to Google Play and Apple App Stores. No previous experience with deploying native applications is required, and you’ll come away with a deeper understanding of the mobile deployment process and best practices for how to use a cloud mobile DevOps platform to ship quickly at scale.