<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: NullServe</title>
    <description>The latest articles on DEV Community by NullServe (@nullserve).</description>
    <link>https://dev.to/nullserve</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F1634%2F9258b8f8-8db5-4c6c-b09c-c1759fda6262.png</url>
      <title>DEV Community: NullServe</title>
      <link>https://dev.to/nullserve</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nullserve"/>
    <language>en</language>
    <item>
      <title>Building Serverless Front-Ends</title>
      <dc:creator>David J. Felix 🔮</dc:creator>
      <pubDate>Fri, 14 Feb 2020 14:56:44 +0000</pubDate>
      <link>https://dev.to/nullserve/thinking-building-serverlessly-part-2-front-end-28ki</link>
      <guid>https://dev.to/nullserve/thinking-building-serverlessly-part-2-front-end-28ki</guid>
      <description>&lt;h1&gt;
  
  
  Foreword
&lt;/h1&gt;

&lt;p&gt;In my &lt;a href="https://dev.to/nullserve/thinking-building-serverlessly-part-1-introduction-3mnl"&gt;last post&lt;/a&gt;, I introduced the concepts behind serverless engineering and enumerated some of the technologies used by each “tier” of a three tier application (front-end/back-end/data). The purpose of that post was primarily to illustrate the boundaries of each tier with respect to a serverless design. In this post, I will discuss the front-end tier and how to apply serverless practices to this layer.&lt;br&gt;
To quickly refresh some of the main points, the last post made note that front-end is frequently the easiest to develop serverlessly and many may already be practicing strategies shared by a serverless design. Utilizing the technology discussed in the earlier post, this article will set forth practices and strategies for developers to build with. The primary technologies discussed were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single Page App (SPA) Frameworks&lt;/li&gt;
&lt;li&gt;Static Site Generators&lt;/li&gt;
&lt;li&gt;Content Delivery Networks (CDNs)&lt;/li&gt;
&lt;li&gt;Generalized Object Storage as a Service&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Build
&lt;/h1&gt;

&lt;p&gt;In order to build an application you have to &lt;strong&gt;build&lt;/strong&gt; the application. This is more than just what framework or language is used, but how the build environment is automated and managed. The practice of codifying and automating builds is called “Continuous Integration” (CI); This is commonly used in conjunction with “Continuous Deployment” (CD), which will be discussed later,  as “CI/CD”. The benefits of CI/CD in reducing build time, recovery time, build stability and repeatability have been espoused by nearly every corner of software development. To serverless front-end design, CI provides a reliable building and testing point at the most important event in front-end software lifecycle -- code change.&lt;/p&gt;

&lt;p&gt;Most front-end developers are already building with serverless-friendly technology. The critical aspect of the build and design process of a serverless front-end application follows one simple rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Build and deploy as static assets, ie html, css, js and image files. Avoid using templates which are designed to be evaluated&lt;/em&gt; &lt;strong&gt;at request time&lt;/strong&gt;&lt;em&gt;, opt instead to have that presented client-side using a framework and favor build-time template evaluation.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While it’s possible to simply write your application directly in this format, there are a number of frameworks which simplify this process and enable developers to easily target their builds to these assets. If the application is going to be mostly static or based entirely on text or flat, encoded content, it might be good to evaluate static site generators like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.gatsbyjs.org/docs/"&gt;Gatsby&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gohugo.io/documentation/"&gt;Hugo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jekyllrb.com/docs/"&gt;Jekyll&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Static site generators can be used to maintain a consistent style and prevent repetition for sites where the content is mostly text or easily repeatable (like a blog or store) and where content doesn’t necessarily change instantly. If some of the content is dynamic, it may still be possible to integrate it with a static site generator, depending on the choice, but with enough dynamic content, it may be time to evaluate a Single Page App (SPA) framework like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://angular.io/docs"&gt;Angular&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/getting-started.html"&gt;React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://svelte.dev/tutorial/basics"&gt;Svelte&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vuejs.org/v2/guide/index.html"&gt;Vue&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many more SPA frameworks and variants on the ones listed which may increase or decrease the complexity of the application, but the idea is the same -- as long as they are not Server-Side Rendered (SSR) frameworks which require a backend server and they target the static build assets listed above, they are a good fit for a serverless front-end. SSR which is "pre-rendered" or targets static assets is fine. While SSR is an important topic for performance, it will be discussed later in the back-end blog post. It is also worth noting that popular web frameworks like Ruby on Rails, Django, Phoenix aren’t listed here, despite their popularity, because they tie their template rendering to a request, not to a build. It is still possible to build a front-end serverless-friendly but doing so would require abandoning the templating engine provided by these frameworks.&lt;/p&gt;

&lt;h1&gt;
  
  
  Deploy / Redeploy
&lt;/h1&gt;

&lt;p&gt;Once the application is built and the static files are ready for deployment, the Continuous Deployment (CD) practices become the next priority. In serverless designs, CD is important not only to developer convenience and for redeploy repeatability, but also because production servers, themselves, are a service that the developer utilizes. Working with these services should be like writing an API client-side interaction. The primary services, mentioned previously, which are invoked during a deployment are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generalized Object Store as a Service&lt;/li&gt;
&lt;li&gt;Content Delivery Networks (CDNs)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some examples of Generalized Object Stores as a Service are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html"&gt;AWS Simple Storage Service (S3)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.backblaze.com/b2/docs/"&gt;Backblaze B2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.digitalocean.com/docs/spaces/"&gt;Digital Ocean Spaces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/storage/"&gt;Google Cloud Storage (GCS)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet"&gt;Microsoft Azure Blob Storage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.rackspace.com/docs/cloud-files/v1/getting-started/"&gt;Rackspace Cloud Files&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And examples of CDNs that could be used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.akamai.com/en-us/"&gt;Akamai&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;AWS CloudFront&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;CloudFlare (&lt;a href="https://developers.cloudflare.com/workers/sites/"&gt;Workers Sites&lt;/a&gt; or &lt;a href="https://support.cloudflare.com/hc/en-us/categories/200275218"&gt;CDN&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.digitalocean.com/docs/spaces/how-to/enable-cdn/"&gt;Digital Ocean Spaces CDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.fastly.com/en/guides/start-here"&gt;Fastly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/cdn/docs/"&gt;Google Cloud CDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/cdn/"&gt;Microsoft Azure CDN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The deciding factors between &lt;em&gt;which&lt;/em&gt; service to use for a given artifact breaks down to a few relatively simple rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;If the file being served needs to be served from a custom domain name with a custom TLS/SSL certificate use a CDN.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;If the file is large media or accessed by individual users and not all or most users, use a generalized object store.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s recommended from a cost and simplicity standpoint to prefer generalized object stores when they don’t fall into these explicit categories. Fortunately, traditional CDNs operate well over object stores to form a cache and more-modern CDNs integrate their own object store, so transitioning objects between these two is relatively easy.&lt;/p&gt;

&lt;p&gt;Developers should build their CD pipeline so that the builds generated in CI are eventually uploaded to an object store or CDN via its API, then CDN cache is invalidated to complete the deployment. Teams can optionally retain old deployments for easier rollbacks, but with a fast CI/CD pipeline that may not be required. There are a number of tools/services which can help your team with building and simplifying this pipeline -- this author started &lt;a href="https://nullserve.com"&gt;NullServe&lt;/a&gt; to do just that.&lt;/p&gt;

&lt;h1&gt;
  
  
  Justification
&lt;/h1&gt;

&lt;p&gt;While building serverless-ready applications might be a fun exercise in constrained design, it’s also important to many to justify &lt;em&gt;why&lt;/em&gt; a change ought to happen and why not the old way. What this article and &lt;a href="https://nullserve.com"&gt;NullServe&lt;/a&gt; are here to show you is that this &lt;em&gt;is&lt;/em&gt; the old way, before we brought in backend server bloat that slowed our websites down and made them more complicated. This “old thing” is just re-energized and empowered with a strong ecosystem of APIs and frameworks to support developers who are focused on user-first metrics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time to first paint / speed index
&lt;/h2&gt;

&lt;p&gt;Beyond simply reducing bundle size and improving routing / network latency within your infrastructure, the final line of improvement is cache hits and customer proximity. CDNs dramatically improve last mile latency and aid teams in caching resources for customers. Using static site frameworks and SPAs can help to reduce network calls and hopefully reduce bundle size in some cases where the tooling is available. With this design, the app is already built for scale of any size, big or small, so there are no servers to manage to ensure your users get a fast and positive experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time to interactive / Time to first contentful paint
&lt;/h2&gt;

&lt;p&gt;The caching provided by the CDN can also help significantly when it comes to interactivity and contentful paint. While interactivity is largely dependent on framework performance, its ability to fetch data and populate the page is not. Javascript that’s already downloaded is always faster than the same javascript but being downloaded. Fetching data from APIs is one download shorter; in addition, since the services are very loosely coupled with the front-end, the data they send back can be much sparser and focused exclusively on values and not appearance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Progressive Web App (PWA)
&lt;/h2&gt;

&lt;p&gt;By segregating the visual concerns from the data and service concerns, it’s much easier for a development team to pursue service workers for a PWA experience for low bandwidth or offline customers. Since the deploy is only targeting front-end assets and they’re served from an edge-CDN, performance has already been accounted for by previous effort.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this post I've declared a rough design for setting up a front-end web application serverlessly and detailed what technology would be used for each aspect. In later posts of this series, I'll outline API and Data considerations. &lt;/p&gt;

&lt;h1&gt;
  
  
  About the Author
&lt;/h1&gt;

&lt;p&gt;I am a Computer/Software Engineer focused primarily on Cloud-First Software Architecture. I have been working professionally with serverless applications for 3 years as a DevOps/Architect and 10 years overall in a DevOps role. I previously worked on a large web application, designing the architecture of APIs, React apps, and databases for a serverless stack. I recently left my previous role to start a company focused on serverless applications -- &lt;a href="https://nullserve.com"&gt;NullServe&lt;/a&gt;. NullServe aims to provide the tooling and platform necessary for product-teams to build out their ideas quickly and coherently using technology that scales up (and down) based on their needs. NullServe leverages existing cloud platforms to provide the performance and stability customers expect, but it simplifies serverless infrastructure and setup process so that developers can focus on building, not configuring. NullServe is Serverless DevOps as a Service.&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>architecture</category>
      <category>javascript</category>
      <category>devops</category>
    </item>
    <item>
      <title>Introduction to Building Serverlessly</title>
      <dc:creator>David J. Felix 🔮</dc:creator>
      <pubDate>Mon, 16 Dec 2019 17:23:28 +0000</pubDate>
      <link>https://dev.to/nullserve/thinking-building-serverlessly-part-1-introduction-3mnl</link>
      <guid>https://dev.to/nullserve/thinking-building-serverlessly-part-1-introduction-3mnl</guid>
      <description>&lt;h1&gt;
  
  
  Foreword
&lt;/h1&gt;

&lt;p&gt;In a hyperactive technology ecosystem, it’s easy to hear the latest buzzwords and form a knee-jerk opinion one way or another about their viability or relevance to your daily software practices and "serverless" is no exception. Establishing nuance and understanding what a single word could mean is often a luxury reserved only to things that break the initial knee-jerk reaction and linger long enough that you clicked this post.&lt;/p&gt;

&lt;p&gt;This post is the first in a series about serverless engineering and application design. In this post, I'll introduce terminology and try to enumerate the technologies involved with each part of the serverless landscape, while also setting a template for building based on it. In later posts, I'll expand on how the technology should be used, what practices make for a good serverless application, and what pitfalls are frequently encountered while engineering serverlessly.&lt;/p&gt;

&lt;h1&gt;
  
  
  What Does Serverless Mean?
&lt;/h1&gt;

&lt;p&gt;To get this one out of the way early -- serverless doesn't &lt;em&gt;literally&lt;/em&gt; mean "no servers". It's astonishing how quickly commenters will jump past an article into the comments to repeat something like this. The comments may be true, but that doesn't make them a good argument against the idea just like "cloud is just somebody else's computer" didn't; their protest has no weight nor actual criticism. Serverless is the generalization of several different ideas. It combines Functions as a Service (FaaS), Database as a Service (DBaaS), Backend as a Service(BaaS), and, in case you're not spotting the pattern, pretty much anything "as a Service". &lt;/p&gt;

&lt;p&gt;"Serverless" is a term that summarizes "X as a Service" where &lt;em&gt;X&lt;/em&gt; is everything used to build an application. Rather than enumerating all of the "X as a Service" that a project uses, "Serverless" signifies using any number of these tools as your application needs them. "Serverless" is just a word, but arguing about the meaning of the word doesn't make the practices it represents more or less viable. It's those practices that are often distant from people's minds when trying to visualize an application serverlessly or appreciate what it means to build this way and what value this architecture provides.&lt;/p&gt;

&lt;p&gt;The ecosystem around serverless right now is vibrant but still nascent. There are a number of strong technologies out there to work with, but since serverless is much more an ideology and design pattern than a pure technology, there's no comprehensive, intimidating graph of all of the technology available like &lt;a href="https://landscape.cncf.io/"&gt;there is for Cloud-Native&lt;/a&gt;, even despite the fact that the Cloud Native Computing Foundation (CNCF) &lt;a href="https://landscape.cncf.io/format=serverless"&gt;has one specifically for serverless&lt;/a&gt;. A number of important practices and technologies &lt;strong&gt;will likely never&lt;/strong&gt; be found on the graph above, despite being critical to the success of many engineers, simply because they are services and designs, not software or frameworks. However, a number of the technologies that help engineers be "cloud native" can continue to help them build reliable, serverless applications, if used correctly.  &lt;/p&gt;

&lt;h1&gt;
  
  
  What Does Building a Serverless Application Look Like?
&lt;/h1&gt;

&lt;p&gt;For the sake of simplicity, this series splits the application into a classic three partitions, "front-end", "back-end" and "data", each of which will be expanded on  in their own posts. When developing engineering patterns, it’s important to attempt to generalize a solution for a wide range of projects. Some projects may find themselves overflowing a template and believe that's an indication that they can't build serverlessly -- this isn't accurate. If an application overflows the design, divide it meaningfully so that the portion that overflows the templated partitions below becomes a client of one of the partitions.&lt;/p&gt;

&lt;p&gt;While it's important to partition an application this way to separate concerns, it should also be noted that engineering teams do not necessarily need to be formed aligning to these partitions. The split serves to denote where development effort should be focused and how individual concerns should be architected. Lastly, the partitions also denote levels of maturity and are listed by ease of adoption from easiest to hardest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Front-End (Website, UI / UX)
&lt;/h2&gt;

&lt;p&gt;Building an application serverlessly is easiest on the front-end. While it may be counter-intuitive, it's  common that a company which is only beginning to make a move from private datacenter to cloud already has a website(s) or front-end(s) that are serverless friendly or already leveraging serverless practices/technology -- skipping cloud or making their first foray into cloud via serverless. Of those, the primary technologies and practices that front-end engineers can leverage to embrace serverless are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single Page App (SPA) Frameworks&lt;/li&gt;
&lt;li&gt;Static Site Generators&lt;/li&gt;
&lt;li&gt;Content Delivery Networks (CDNs)&lt;/li&gt;
&lt;li&gt;Generalized Object Storage as a Service&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It should be noted that Server Side Rendering (SSR) is explicitly &lt;strong&gt;not&lt;/strong&gt; on this list and will be discussed in the later section as a service/API. If Search Engine Optimization (SEO) is a concern, work towards the setup above and then follow SSR guides in the API section to improve SEO.&lt;/p&gt;

&lt;h2&gt;
  
  
  Back-End (Business Services / APIs)
&lt;/h2&gt;

&lt;p&gt;Meticulous readers may have noticed that the CNCF serverless landscape was purely focused on compute. It's a fair assessment to say that the term "serverless" likely came about due to a foray of newcomers in the compute as a service, functions as a service, and containers as a service arenas. However, it's important to note that simply &lt;strong&gt;using&lt;/strong&gt; these services and practices may make your application appear serverless, but because only the stack is serverless and not the code itself, it can potentially introduce a deluge of headaches and accidental problems. This is why it’s important to when designing APIs and business services on the back end to be mindful of serverless practices. Back-end tends to be an area that is still being explored by teams and can often be fraught with mistaken optimization and implicit constraint.&lt;/p&gt;

&lt;p&gt;The key technologies that back-end engineers will use when building serverlessly are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functions as a Service / Workers / Lambdas&lt;/li&gt;
&lt;li&gt;Generalized Object Storage as a Service&lt;/li&gt;
&lt;li&gt;Containers as a Service&lt;/li&gt;
&lt;li&gt;In-Flux Storage as a Service&lt;/li&gt;
&lt;li&gt;Other People's APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Databases / Persistent Storage / In-Flux Storage
&lt;/h2&gt;

&lt;p&gt;This seems to be the hardest thing for people, not just serverlessly, but in general. A number of problems encountered in back-end are actually database problems. Databases are trickier because there's not simply data in some store, but also metadata about that data's structure, data in-flux, and an abundance of configuration in modern applications. Serverless is no different, but it can often add some difficulty for those who don't already have good data management practices because of how spread out and duplicated the data can be. While there are a number of different products out there, the primary groups can be broken down by the service they provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In-Flux Storage as a Service

&lt;ul&gt;
&lt;li&gt;Queues&lt;/li&gt;
&lt;li&gt;Notifications / Events&lt;/li&gt;
&lt;li&gt;Data streams&lt;/li&gt;
&lt;li&gt;State Machines&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Relational Databases as a Service&lt;/li&gt;
&lt;li&gt;NoSQL Database as a Service

&lt;ul&gt;
&lt;li&gt;Configuration stores&lt;/li&gt;
&lt;li&gt;Secrets stores&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Stateful Connection Pools / Load balancers as a Service&lt;/li&gt;
&lt;li&gt;Generalized Object Storage as a Service

&lt;ul&gt;
&lt;li&gt;ETL (Extract, Transform, Load)&lt;/li&gt;
&lt;li&gt;Business Analytics&lt;/li&gt;
&lt;li&gt;Data Lakes, Streams, Oceans, Pools, etc.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this post I've given you a high level view of what technologies are part of a serverless application ecosystem and how you might mentally divide an application to begin developing serverlessly. Follow me for the next posts in the series where I'll dive into each component and paint a picture of how to build your application and which technologies to leverage.&lt;/p&gt;

&lt;h1&gt;
  
  
  About the Author
&lt;/h1&gt;

&lt;p&gt;I am a Computer/Software Engineer focused primarily on Cloud-First Software Architecture. I have been working professionally with serverless applications for 3 years as a DevOps/Architect and 10 years overall in a  DevOps role. I previously worked on a large web application, designing the architecture of APIs, React apps, and databases for a serverless stack. I recently left my previous role to start a company focused on serverless applications -- &lt;a href="//www.nullserve.com"&gt;NullServe&lt;/a&gt;. NullServe aims to provide the tooling and platform necessary for product-teams to build out their ideas quickly and coherently using technology that scales up (and down) based on their needs. NullServe leverages existing cloud platforms to provide the performance and stability customers expect, but it simplifies serverless infrastructure and setup process so that developers can focus on building, not configuring. NullServe is Serverless DevOps as a Service.&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>architecture</category>
      <category>webdev</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
