No history yet

Introduction to Web Application Architectures

Blueprints for Software

Before building a house, you need a blueprint. It shows how many rooms there are, where the plumbing goes, and how everything fits together. Software architecture is the blueprint for a web application. It defines the major components, how they're arranged, and how they communicate to get work done.

Just as different houses require different blueprints, different web applications need different architectures. Over time, three main styles have emerged, each suited for different kinds of projects.

The All-in-One Monolith

The original approach to building web applications is the monolithic architecture. Think of it like a large department store. Everything is under one roof and part of a single, massive building. The user interface, the business logic that handles pricing and inventory, and the database access are all bundled together into one large program.

In a monolithic application, all the code is in a single codebase. To make a change, even a small one, you often have to update and redeploy the entire application. This was the standard for years because it's simple to get started with. For new projects, prototypes, or small applications, a monolith can be the fastest way to build.

This all-in-one structure is the historical foundation of web development and is still a practical choice for many applications today, especially at the beginning of a project's life.

Organizing the Code with MVC

As monolithic applications grew larger, their codebases became tangled and difficult to manage. A change in the user interface could accidentally break something in the database logic. To solve this, developers created organizational patterns. The most popular is Model-View-Controller (MVC).

MVC isn't a different architecture from a monolith; it's a way to structure the code inside a monolith. It separates the application into three interconnected parts:

  • Model: Manages the data and business rules. It’s the brain of the application.
  • View: The user interface. It’s what the user sees and interacts with, like a web page.
  • Controller: Takes user input (like a button click) and tells the Model and View what to do. It acts as the traffic cop between the other two components.
Lesson image

The main purpose of MVC is separation of concerns. By keeping the data logic separate from the presentation logic, developers can work on different parts of the application without stepping on each other's toes. This makes the code cleaner, easier to test, and simpler to update.

A City of Microservices

The latest evolution in web architecture moves away from the single, large application. Instead of one big department store, a microservices architecture is like a city of small, specialized shops. Each shop is its own independent service with a single, clear purpose.

In a large e-commerce platform, you might have one service for managing user accounts, another for the product catalog, a third for handling the shopping cart, and a fourth for processing payments. Each service is a small, standalone application. They have their own codebases and often their own databases.

These services communicate with each other over a network, typically using APIs. This approach is popular for large, complex systems like Netflix or Amazon because it allows different teams to develop, deploy, and scale their services independently. A team can update the payment service without affecting the product catalog at all.

Quiz Questions 1/4

Which analogy best describes a monolithic architecture?

Quiz Questions 2/4

What is the primary purpose of the Model-View-Controller (MVC) pattern?

Each architectural style offers a different blueprint for building applications. The choice depends on the project's size, complexity, and the team building it.