3-Layer Architecture In Detail
3-layer Architecture in detail
Akbar S. Ahmed | Mar 5, 2015

A micro-services friendly architecture

The 3-tier architecture has survived for a long time. However, modern applications require increased scalability and availability. To support ever increasing demands for scale and availability new architectures have emerged. One of the emergent architectures is the 3-layer architecture.

3-layer architecture is a micro-services friendly n-tier architecture where tiers are grouped into layers. The layered groups of tiers are vitally important as they delineate both software functionality and engineering departments.

A quick recap of 3-tier architecture

In a 3-tier application functionality is divided into 3-tiers:

  1. Client
  2. Server
  3. Data

Importantly, the Client tier maps to a department with three teams of front-end developers :

  • JavaScript/HTML/CSS for web apps
  • Java for Android apps
  • Objective C/Swift for iOS apps

In 3-tier architecture, front-end developers do not run any server-side code.

Data flows in sequence from Client to Server to Database, and back again.

There are some major weaknesses with 3-tier architecture. UI development moves slowly as client-side developers have to stop and ask the server-side developers to build the required APIs and data access queries. Server-side developers are distracted from important platform work while they update server-side code to support client-side development.

Importantly, 3-tier architecture lends itself to the creation of monolithic server-side applications.

The 3 layers of 3-layer architecture

There are 3 layers in a 3-layer architecture. Each layer defines a department.

  1. UI/UX
  2. Platform Services
  3. Data Services

Further, each layer has multiple tiers. For example, the UI/UX layer has the client tier and a REST API tier.

What’s different about 3-layer architecture?

Before diving into the details, let’s begin by highlighting some major differences between 3-tier and 3-layer architecture. In a 3-layer architecture:

  1. The UI/UX team writes server-side code. Specifically, the UI/UX team owns and controls it’s own API server.
  2. Platform Services is no longer a gateway between the front-end and backend.
  3. Platform Services is freed to focus on important system infrastructure that is used by both the UI/UX and Data Services teams.
  4. Data Services runs its own APIs and is no longer dependent on the server-side team to act as a proxy between clients and databases.
  5. Data Services is free to choose the best database for any given task as they now provide a standardized REST API to other engineering departments. In other words, Data Services abstracts away the different storage engines via REST APIs.
  6. All tiers use REST APIs to communicate with each other.

Data flows

Take a look at the data flow arrows in the diagram at the top of this post. In a 3-tier architecture data flows from Client to Server to Database and back again. However, in a 3-layer architecture data flows in multiple directions:

  • UI/UX API server to Platform Services APIs
  • UI/UX API server to Data Services
  • Platform Services APIs to Data Services

Why have multiple data flows? For direct data access, the UI/UX API can directly query the Data Services API without going through an intermediary. For complex algorithms the UI/UX API can access a Platform Services API which is home to algorithms. Internally, the Platform Services API may query data from the Data Services API.

Infrastructure developed by Platform Services

Beyond APIs, the Platform Services team also develops libraries and APIs that are used by the UI/UX team and the Data Services team.

Platform Services develops and manages the overall platform that helps accelerate development for UI/UX and Data Services. A few of the utilities and libraries that Platform Services develops are:

  • Authentication
  • Authorization
  • Logging
  • Metrics
  • Service discovery
  • Frameworks and tooling
  • CI/CD infrastructure

Platform Services is often the magic behind rapid development of new applications. This magic is thanks to the myriad of production ready components that new projects can leverage to reduce the amount of new development work.

3-layer teams and responsibilities

The UI/UX department is often divided into the following teams:

  • Web (controls UI/UX REST APIs)
  • iOS
  • Android

Platform Services can be broken into service specific teams as required. For example, a company that requires advanced algorithms can create a specialized team to develop services that expose a simplified interface to advanced algorithms and business logic.

Data Services can be broken into specialized teams that focus on one or more storage technologies. For example, a team could focus on relational databases while another focuses on Hadoop related technologies.

Full stack (a side note)

A “full stack” developer should be put into the context of which layer. A full stack UI/UX developer can write both client-side and server-side code. A full stack Data Services developer can write advanced queries and a REST API.

We have not yet seen an engineer who can work at production quality in all three clients (web, iOS, Android), on UI/UX APIs, on Platform Services APIs, and across the myriad of databases in use in Data Services (relational, document, wide column, etc). So, “full stack” does not really span the full stack.

Conclusion

3-layer architecture is an emergent architecture that provides a number of strong benefits. 3-layer architecture, or a variation, is seeing increased adoption across web properties in Silicon Valley.

3-layer architecture allows for increasingly rapid development as both UI/UX and Data Services engineers can leverage common infrastructure created by Platform Services. This architecture also decouples the various teams which enables each team to focus on its core strengths.

The use of REST APIs as a standard across layers is a perfect foundation for micro-services. Further, the use of REST APIs allows Data Services to provide a simplified interface for a myriad of storage technologies.

Overall, 3-layer architecture provides a strong technical approach as well as a means for organizing engineering teams.




Subscribe to our newsletter

Contact Information

ABOUT EXPONENTIAL.IO

We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.

LOCATION

All courses are made with love in
Palo Alto, CA.

Subscribe to our newsletter