DEV Community

Cover image for Building composable applications: Playing with building blocks
Momcilo
Momcilo

Posted on

Building composable applications: Playing with building blocks

Building composable applications represents the idea of making software in a modular way. In other words, it means breaking a complex application down into smaller, independent parts.

Good news? - You can achieve composable architecture in several ways.

How? - Keep reading.

Examples of composable applications

Composability extends throughout the entire application stack, enabling the assembly and combination of packaged business capabilities (PBCs). PBCs represent a modular approach intentionally designed to be scalable, allowing organizations to select and deploy only the capabilities that are relevant to their business model.

Examples of PBCs include Customer relationship management (CRM) systems, Enterprise resource planning (ERP) solutions, Human Resources management (HRM) software, and Content management system (CMS) platforms.

Building composable applications can include:

Whatever building strategy you choose, there are common elements that enable composable building.

The essential elements for composable infrastructure are the following:

Microservices

These are small, independent applications designed to perform a specific task or set of tasks. They are typically built using flexible technologies that can be easily combined and deployed in different configurations which all together make up the MACH architecture.

Plugins

Plugins are there to enrich the functionalities of an existing application. Installing and removing them is seamless, increasing application versatility.

APIs

APIs consist of protocols and tools to facilitate communication and data exchange among various applications.

Containers

Using containers makes it possible to create reusable technology by allowing developers to build and deploy individual components in a way that makes them easy to combine with others.

Building composable applications strategies

Building composable applications is a powerful approach to software development that emphasizes creating modular, reusable components that can be combined and orchestrated to build complex systems. Besides microservices, there are several strategies:

Service-oriented architecture (SOA)

SOA is similar to microservices but focuses on larger, coarser-grained services. These services are typically more closely aligned with PBSs and are often implemented using enterprise service buses (ESBs) or messaging systems for communication.

Component-driven development

In this approach, applications are built by assembling pre-built software components. These components expose well-defined interfaces and can be reused across different applications.

API-First design

With API-first design, developers define and design APIs before writing any code. This ensures that services are decoupled and can be easily composed to build applications.

Best tools for building app development - with use cases

Building composable applications requires a combination of tools that facilitate modular development, integration, and deployment. With these tools, you can use building blocks to build Frankenstein (literally) if you want. Here's a list of some of the best tools sorted by different usage in the development process:

Containerization and orchestration tool: Docker

Image description

In a composable architecture, Docker containers ensure that each component of the application runs independently in its own environment, enabling easy deployment across various platforms while maximizing resource utilization.

Key Features: Containerization, portability, isolation, efficiency.

Use Case Example: Use Docker to containerize microservices in a cloud-native application architecture. For instance, each microservice, such as user authentication or order processing, can be packaged into separate Docker containers for easy deployment and scaling.

Microservices development: Node.js

Image description

Node.js's architecture allows you to handle multiple requests concurrently without blocking the execution of other operations. This asynchronous nature is well-suited to microservices, where services often need to handle numerous concurrent requests efficiently.

Key Features: Lightweight, non-blocking I/O, event-driven architecture, npm ecosystem.

Use Case Example: Node.js is ideal for building lightweight and highly scalable microservices. For instance, a real-time chat application can be developed using Node.js to handle concurrent connections efficiently

Frontend frameworks: Next.js

Image description

Next.js simplifies the creation of composable applications by seamlessly integrating with React, offering features like server-side rendering, file-based routing, and API routes for efficient development.

Key Features: React framework for server-side rendering (SSR) and static site generation (SSG), built-in routing, API routes, hybrid rendering.

Use Case Example: Next.js can be used to build composable web applications with server-rendered pages. For instance, an e-commerce platform can leverage Next.js for its frontend, combining server-rendered product pages with client-side interactions for features like shopping cart management and user authentication.

Learn more: Building NextJS e-commerce: Best Shopify alternative in 2024

Component-based development: Bit

Image description

By isolating and versioning components, Bit promotes modularity and composability in software development, allowing developers to build applications by assembling pre-built components.

Key Features: Component-driven development, code sharing and reuse, versioning, collaboration..

Use Case Example: For example, a UI component library can be developed using Bit, allowing frontend developers to share and reuse components like buttons, forms, and navigation menus across multiple applications. By versioning and isolating components, Bit ensures consistency and facilitates collaboration among developers working on different parts of the system.

Serverless Computing: AWS Lambda

Image description

AWS Lambda simplifies composable applications by offering serverless execution, seamless integration with AWS services, automatic scaling, and cost efficiency without the need to manage servers.

Key Features: Serverless computing, event-driven execution, automatic scaling, pay-per-use pricing.

Use Case Example: AWS Lambda can be used to process asynchronous events, such as image resizing upon file upload to an S3 bucket. It allows developers to focus on writing business logic without worrying about server management.

Content management: BCMS

Image description

BCMS headless CMS, provides a flexible and scalable content management system that enables developers to manage content separately from the presentation layer, facilitating efficient content authoring, localization, and delivery across various channels and devices.

Key Features: Headless CMS, content modeling, API-first, webhooks.

Use Case Example: Managing content for multi-channel publishing that includes a website, mobile app, and social media channels. The content needs to be consistent across all channels and easily adaptable to different formats and platforms. With BCMS you can define structured content models to represent various types of content, such as blog posts, product descriptions, and promotional banners.

Learn more: BCMS Widgets - Reusable structured content - everything you need to know

DevOps and CI/CD: GitLab

Image description

In composable application, you can integrate CI/CD pipelines directly within GitLab for automated testing and deployment.

Key Features: Continuous integration, continuous delivery, pipeline as code, extensive plugin ecosystem.

Use Case Example: GitLab can automate the build, test, and deployment process of a web application. Developers can define pipelines that automatically trigger code changes, run tests, and deploy the application to staging or production environments.

Monitoring: Grafana

Image description

As a part of your composable architecture, Grafana serves as al tool for monitoring, visualizing, and analyzing metrics and logs, enabling insights into the performance and health of your composable applications.

Key Features: Monitoring and alerting, time-series database, multi-dimensional data model.

Use Case Example: Grafan can be used to monitor the performance and health of composable apps. It can collect metrics such as CPU and memory usage, network traffic, application response times, error rates, and etc.

You are ready for composable application development

That's all folks. With this composable tech stack, you are ready to build composable applications. The only thing left to do is to choose your composable business architecture and you are ready to play with building blocks. One thing is for sure if you want to go composable you need to go headless (see the best practices). So one worry less, because BCMS can handle all your content from one source to anywhere it needs to be delivered.

Top comments (0)