Dissecting Composable Architecture: How to Use APIs to Make Your Business More Resilient

https://images.ctfassets.net/wowgx05xsdrr/3EWEMpYHbNYp77noG0hRl8/a4752224c9fbb4c8b52ffb3e75ca1e6a/3566CD-Headers-Thumbnails-Article-3_2023-08-08-201607_jynx.jpg

New Era of Ecommerce: Headless Commerce Whitepaper

by

In response to rapid digital transformation, especially during the pandemic, many organizations have changed the way they do business and structure their teams. In efforts to stay agile and adapt quickly to application change and new technologies, some organizations have chosen to decentralize their activities and become more composable.

To be composable means to be capable of breaking into various modules which combine to form a whole. Therefore, to be a composable enterprise means to create an organization out of interchangeable building blocks, according to Gartner. 

These composable businesses function by breaking up into smaller, autonomous teams, monitoring each team’s activities and keeping activities that are working while getting rid of those that are not. By aligning processes, employees and structures to support digital transformation, these organizations are able to build resilience in the face of disruption and quickly adapt to change.

In fact, Gartner predicts that organizations that have adopted a composable infrastructure will outpace the competition by 80% when faced with digital transformation. 

One of the building blocks of a composable enterprise is the composable architecture, which is a new method for aligning the enterprise to a cloud-driven world.  But before diving into composable architecture, it may be helpful to define an important term: APIs.

What are APIs?

API stands for Application Programming Interface, and it’s essentially a middleman between two separate applications. APIs allow applications to communicate and transfer information to each other.

A simple way to think about an API is imagining a waiter at a restaurant. When you, the customer, order food, you don’t speak directly to the chef. Instead, you place your order with a waiter, who then takes your order to the kitchen and gives it to the chef, and when your food is ready, the waiter brings it back to your table. In this analogy, you and the chef would both be applications, and the waiter is the API.

Here are some common examples of APIs: 

  • Weather data, such as the Apple Weather app or a simple Google search of “weather in (your city’s name).”

  • Travel booking sites.

  • Pay with PayPal.

  • Google Maps.

There are three primary stages to the API lifecycle: 

  1. Create: Build and deploy the API.

  2. Control: Apply security policies and manage the API.

  3. Consume: Discover, publish and integrate with the API.

Now that you have a basic understanding of APIs and their function, we can jump into how this applies to the composable architecture.

What is The Composable Architecture?

In short, the composable architecture (aka TCA) is an open-source library that explains how to build applications in a clear and consistent manner — one which will reap more benefits than a vanilla SwiftUi application. 

The goal of composable architecture is to  break down larger, complex business systems into smaller, more manageable components. It integrates APIs across all business processes and activities and then combines those APIs to create digital solutions. By breaking down traditional organizational silos and instead allowing developers to access all APIs, the composable architecture enables flexibility and agility in the face of digital disruption. 

The architecture was designed by two software engineers, Brandon Williams and Stephen Celis, who host Point-Free, a video series all about functional programming and the Swift programming language. According to GitHub, it can be used in SwiftUI, UIKit as well as on any Apple platform, such as iOS or macOS.

To help illustrate the concept of composable architecture, here’s a helpful example using one of our BigCommerce merchants.

Burrow, a custom furniture and sectional sofa brand, established itself as a composable business from the start. 

They wanted to stray from traditionally bulky, hard-to-move furniture brands and instead take a modular approach to furniture by creating pieces that could be broken into parts for easy shipping and customization. 

Every Burrow sofa and furniture piece is divided into sections that can be added, removed or moved around to change the orientation and size. So, rather than building your living room around a bulky, heavy piece of furniture, you can adapt Burrow’s furniture to meet your home’s needs. 

This same flexibility, modularity and efficiency that Burrow’s furniture offers is mirrored in the concept of the composable architecture.

Main Concepts of Composable Architecture

The composable architecture library is a toolbox for building applications of different sizes, purposes and complexities. Focusing on the following five concepts, TCA provides practical solutions for common problems you might run into when building your own application.

1. State management.

Every application contains a sort of state, so TCA allows you to manage state using simple value types and make the state observable across the app so that mutations can be seen on all screens.

2. Composition.

TCA also addresses the issue of how to break down large, complex features into smaller pieces that can live on their own but also be easily combined to form the whole app. 

By modularizing the app and allowing each feature to function in isolation with few dependencies between each other, you can restructure the app without having to fix every feature all at once.

3. Side effects.

TCA defines how to handle and test side effects, which help you understand how to let your features communicate with the outside world in a testable and composable way.

4. Testing.

To ensure the strength of your application, TCA allows you to unit test each part of the architecture, including features composed of multiple parts, and write end-to-end tests to identify how side effects affect the application. 

To test in the composable architecture, you’ll need to create a TestStore for your feature and write a test via the Assert method. You’ll make an assertion for each step of the entire user flow, which will help ensure that each state changes as expected.

5. Ergonomics.

Lastly, TCA provides a framework that addresses how to achieve all of the above components using a simple API.

Composable Architecture and API Management Systems

An essential element of building a composable architecture are APIs, as they make app integration efficient, cohesive and agile. As our cloud-native world continues its digital transformation, the need for connectivity will only increase, and APIs will help deliver it in no time. 

So, as you’re building out your application, it’s crucial to have the right API management platform for the following reasons.

1. Established cohesion.

The beauty of the composable architecture is that you can share workloads between data centers and teams in a quick and efficient manner. 

However, the challenge here is how to share API documentation between teams and manage data centers as independent private clouds — but this is where API management saves the day.  By using an API management platform, such as Mulesoft, Apigee or Azure, you’ll be able to manage all APIs for your ecommerce platform on one unified platform, where you can cohesively share information and documentation between teams.

2. Stronger security.

Dividing data centers and private clouds into components unfortunately runs a higher risk of security threats. With more endpoints to vulnerabilities in your application, especially through APIs, you’ll need to be particularly mindful about API security best practices.

Luckily, API management platforms can help secure systems by tracking API usage and integrating the latest security protocols, such as OAuth, JWT and OpenID. These security measures let you control access to your applications, implement user authentication to verify IDs and detect security threats immediately.

3. Increased efficiency.

Composable architecture is all about breaking down larger systems into smaller ones in order to create efficiency and agility. To do this, your IT, processes and staff need to work together cohesively. And one of the best ways to achieve this is through API management. 

With the help of an API management platform, you can more efficiently manage and control your apps, teams and data centers — all on one unified interface — to scale your business and increase profits.

4. Managing the ecosystem.

By nature, the digital-first economy is highly complex, and it’s a constant battle to manage all of its moving parts. 

APIs are the glue that holds these parts together, increasing online interactions and improving communication between applications. And with the help of an API management platform, you’ll be able to manage this entire ecosystem using one unified platform.

Building Blocks of Composable Architecture

Once the library is set up, it’s time to start building your application.

When using the composable architecture, there are five core elements that come together to model your application. Here we’ve defined each of these components and how they function to build your domain.

1. State.

When you start to model your domain, you’ll first need to define the state your feature needs to do its job. 

The state of your application is usually a Struct type, as it contains a collection of properties and data your feature needs to perform its logic. TCA then takes all properties related to a corresponding feature and groups them into a single type. 

2. Action.

This type is typically an enumeration, because it represents all the potential actions that can occur in your application, such as when a user taps a button or enters text into a field.

3. Environment.

Like actions, the environment is nearly always a Struct type, as it contains all dependencies the application needs, such as API clients, analytics clients and more.

4. Reducer.

The reducer is a function that packages together the state, action and environment and implements the business logic for the application. It then uses the given action to evolve the app’s current state to the next state.

5. Store.

Finally, the store is the runtime that actually powers your app. With the store, your UI observes state changes and user actions over time so that it can run reducers and effects.

4 Reasons to Use Composable Architecture

In a cloud-native environment where agility is key, businesses are looking to achieve this same result using a traditional IT infrastructure. 

For many organizations, composable architecture has been the answer, as it allows private data centers to function like private cloud services, creating greater connectivity, resiliency and efficiency in the face of digital change. 

Below we’ve highlighted four of the top reasons you should implement the composable architecture in your business.

1. It’s smarter than other infrastructures.

Although there are several infrastructures your organization could choose from, one thing that makes TCA stand out is that it uses intelligent software and can discover available resources. 

For instance, using automation, a composable system can detect issues in hardware assets and provide potential solutions.

Additionally, a composable infrastructure offers software-defined templates, which allow the user to change and update the whole application without having to update each feature. This helps save time and allows the application to run continuously.

2. It’s easier to scale.

Considering composable architecture is broken into a pool of several parts, which can be as small or large as you want, the infrastructure is much easier to scale.

Scaling means being able to serve more customers as demand grows, while also being able to scale down if your organization needs to save money or allocate resources to higher-priority APIs.

3. It can operate from anywhere.

As the composable architecture is not tied to any particular computing technology, you have the freedom to run the infrastructure on any technology most suitable for your business, whether it be a virtual machine or a cloud-native platform. 

Not only that, but TCA can also run and store anything, allowing users and organizations to innovate freely and confidently.

Being able to operate TCA anywhere has three key advantages:

  1. It provides faster service delivery.

  2. It lets IT professionals offer continuous delivery so that developers can change and update applications without delay.

  3. It allows organizations to be more agile and resilient.

4. It includes compute resources and software.

In order to build a composable infrastructure, an architecture must contain these three technologies:

  1. Fluid pools of infrastructure resources.

  2. Intelligent software.

  3. One unified API.

Using these three technologies, the computing, storage and fabric resources can be aggregated and disaggregated depending on the application’s needs, allowing for more flexibility than converged or hyperconverged systems.

Building a Composable Enterprise Architecture Using APIs

If you’re ready to start building a composable enterprise architecture, these are some key elements to consider:

Infrastructure as an Application

Make sure you’re viewing each component of your IT infrastructure as an independent application, which act as building blocks that are managed as code and can be allocated to meet your application’s specific needs.

Infrastructure Automation

Rather than managing your architecture as a whole, you can split up the infrastructure into separate components that can be automated.

A Multicloud Strategy

Using composable architecture, IT can share workloads across data centers and private clouds using a multicloud approach. 

However, dividing data centers and sharing API documentation across teams requires tighter security and DevOps processes, which is why finding the right API management platform is so important.

Portfolio Rationalization

To stay up-to-date with the latest API functionality without going overboard on IT spend, companies can leverage composable architecture to quickly assess APIs.

First, you’ll need to identify any overlaps in your API portfolio and then remove the ones that don’t align with your business needs.

The Final Word

While the composable architecture is still a relatively new concept, it has huge potential to help businesses achieve agility and resilience, especially amid our world’s digital transformation. 

As we saw with the COVID-19 pandemic, disruptions are inevitable — and this is especially true for digital businesses, in which technologies are constantly updating and consumer behaviors are forever changing. 

By taking a modular approach and breaking down systems into smaller, more manageable components, you’ll be able to focus on the best solutions for each part of your ecommerce business and quickly scale your IT footprint.

Browse additional resources