Skip to main content

Give examples of typical layers in a web application

In a typical web application, the architecture is split into several layers, each playing its own role - from the user interface to the database.

Here is the structure and examples:


1. Presentation Layer

Purpose: interaction with the user. What it does: displays data and accepts input. Examples:

  • HTML, CSS, JavaScript
  • Frameworks: React, Vue, Angular
  • Controllers and routers (for example, in Express.js, Django Views, ASP.NET Controllers)
  • Forms, buttons, pages, an API interface

2. Business Logic Layer

Purpose: implementing the rules and logic of the application. What it does: decides what exactly happens when the user acts. Examples:

  • Service classes, managers, handlers (Service, Manager, UseCase)
  • Modules that perform calculations, checks, validations
  • Frameworks: Spring Services, Django Models/Services, NestJS Services
  • Example functions: calculating a price, applying a discount, checking authorization

3. Data Access Layer

Purpose: access to the database. What it does: saves, retrieves, and updates data. Examples:

  • SQL queries, ORM models (Django ORM, SQLAlchemy, Hibernate)
  • Repositories and DAOs (Data Access Objects)
  • Connections to PostgreSQL, MySQL, MongoDB, and others

4. Infrastructure Layer

Purpose: keeps supporting systems running. What it does: manages external resources, logs, files, networks. Examples:

  • Configuration, API clients, queues (RabbitMQ, Kafka)
  • Notification services, caching (Redis), logging
  • Authentication and authorization (JWT, OAuth)

5. (Sometimes) API or Integrations Layer

Purpose: the link between the internal logic and external systems. Examples:

  • REST / GraphQL / gRPC controllers
  • API adapters for third-party services (payments, email, geolocation)

Summary: The typical structure of a web application looks like this:

javascript
[Presentation Layer][Business Logic][Data Layer] ↑ ↓ [API / Integrations] [Infrastructure]

This separation makes the system understandable, modular, and easy to maintain.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.