> For the complete documentation index, see [llms.txt](https://shubhams-organization-18.gitbook.io/shubhams-organization-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shubhams-organization-18.gitbook.io/shubhams-organization-docs/projects/editor.md).

# 3 Tier Deployment

K8s deployment of Web App

This project demonstrates the **deployment of a scalable and modular three-tier web application** using **Docker, Kubernetes, and CI/CD automation**. The architecture follows a **structured separation of concerns**, ensuring that the frontend, backend, and database layers are independently scalable and maintainable.

### **Prerequisites** <a href="#prerequisites" id="prerequisites"></a>

* Linux and basic commands.
* General knowledge of the cloud, containerization and the AWS foundations EC2, ECR. (No issues if you are new to it, you will learn in the way. You got this Champ!)

### **What is 3-tier Architecture ?** <a href="#prerequisites" id="prerequisites"></a>

A **three-tier architecture** divides an application into three independent layers, improving **scalability, security, and maintainability**.

1. **Presentation Layer (Frontend)**
   * Handles user interface and interactions.
   * Built with technologies like **React.js, Angular, or Vue.js**.
2. **Application Layer (Backend)**
   * Manages business logic and API requests.
   * Developed using **Node.js, Django, Flask, or Spring Boot**.
3. **Data Layer (Database)**
   * Stores and retrieves application data.
   * Uses databases like **MySQL, PostgreSQL, or MongoDB**.

Each layer runs **independently**, allowing for **modular development, better security, and easier scaling** in cloud-native environments. 🚀

<figure><img src="https://2292608409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqPHDtgCn0s5sARwKKdKq%2Fuploads%2FMFWxOwneLX59zkYuRIrl%2F3-Tier-App-Deployment.drawio(3).png?alt=media&amp;token=36cd9f07-51cf-48df-93a6-d0cdb0b6f233" alt=""><figcaption></figcaption></figure>

### Deployment  Architecture

The diagram above represents the **three-tier deployment architecture** for a web application using **Docker, Kubernetes, and AWS ECR**. The **frontend**, built with React.js, is containerized and deployed as a Kubernetes pod, making it highly scalable and accessible via an Ingress Controller. The **backend**, developed in Node.js, handles API requests and business logic, running in its own Kubernetes pod while securely communicating with the database. The **database layer** utilizes MongoDB, deployed as a stateful Kubernetes service for persistent data storage. Docker images for each tier are stored in **AWS ECR**, ensuring a seamless CI/CD pipeline. The **Ingress Controller** routes external traffic to the application through a **Load Balancer**, ensuring reliability, scalability, and security for end users.
