# Architecture

{% hint style="danger" %}
**This documentation is for the CARTO Self-Hosted Legacy Version**. Use only if you've installed this specific version. Explore our latest documentation for updated features.
{% endhint %}

Depending on your chosen cloud provider and type of deployment, there can be different possible architectural setups to deploy CARTO Self-Hosted as illustrated below.

{% tabs %}
{% tab title="Google Cloud" %}
**Single Virtual Machine Deployment**

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-4b4816c34e09784403262420edf2867d50199fb1%2FSelf-Hosted%20GCP%20Single%20VM%20architecture%20diagram.png?alt=media" alt=""><figcaption></figcaption></figure>

**Orchestrated container deployment**

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-d9ae4f3c58ca5d7fc1170659b856db2ac2afb99d%2FSelf-Hosted%20GCP%20k8s%20architecture%20diagram.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Amazon Web Services" %}
**Single Virtual Machine Deployment**

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-0e27c983f19e953f0d21cc629417ee481367d6d8%2FSelf-Hosted%20AWS%20Single%20VM%20architecture%20diagram%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

**Orchestrated container deployment**

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-c090d4b6132f7b6bc015e8ba9d872b25764651ba%2FSelf-Hosted%20AWS%20k8s%20architecture%20diagram.png.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Microsoft Azure" %}
**Single Virtual Machine Deployment**

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-548e207a3d7e6d17460c5a002d10fb981a3c7a12%2FSelf-Hosted%20Azure%20Single%20VM%20architecture%20diagram.png?alt=media" alt=""><figcaption></figcaption></figure>

**Orchestrated container deployment**

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-64dc01cbc1db66bde17394c058dbfb148d9d8060%2FSelf-Hosted%20Azure%20k8s%20architecture%20diagram.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Components

The following diagram describes the different components of the CARTO Self-hosted. This set of components maps both with a container or external service in the deployment.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-33d7af739272c6c4ca731c5a38f947810fac6cd0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### router-http

It's the principal entry point of the application. It's an [nginx reverse proxy](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) to route the HTTPs traffic to the right components.

**metadata-database**

PostgreSQL database to manage the metadata of the CARTO platform.

Subscribers and APIs use this database to perform their operations.

More info at the [external database ](https://docs.carto.com/key-concepts/deployment-requirements#external-database)section in [deployment requirements](https://docs.carto.com/carto-self-hosted/key-concepts/deployment-requirements).

**message-broker**

Message broker to exchange messages between the different pieces of the platform using the producer-consumer paradigm.

APIs or scheduler processes often produce messages to be consumed by the subscriber. For example, [Imports API](https://api-docs.carto.com/#d8fea1d4-2f80-4270-a684-75fd83b10426) produces a message to import a file, and the import-worker consumes the message and performs the import operation.

It's not a container included in the Self-Hosted, it uses [Google Cloud Pub/Sub](https://cloud.google.com/pubsub).

#### redis

In-memory [redis](https://redis.com/) cache for the APIs and subscribers.

CARTO Self-Hosted can work without this cache, the platform will just fall back the queries against the metadata database.

You can use an external service of your cloud provider as explained in more detail [here](https://docs.carto.com/carto-self-hosted/guides/guides/configure-an-external-in-memory-cache).

#### **workspace-www**

The Web Application of the workspace. It's a modularized React application. Applications in the CARTO platform such as [Builder](https://docs.carto.com/carto-user-manual/maps) or [Workflows](https://docs.carto.com/carto-user-manual/workflows) are inside this container.

It's the root path (<https://carto.mycompany.com>) of the Self-Hosted, a basic nginx container with static files like HTML, CSS, and JS.

#### **accounts-www**

The Web Application manages the login and signup process. It's a modularized React application.

It's at <mark style="color:orange;">/acc/</mark> path (<https://carto.mycompany.com/acc>) of the Self-Hosted, a basic nginx container with static files like HTML, CSS, and JS.

It requires a connection with the CARTO accounts API to perform different operations: create accounts, create users, invite users, etc.

#### http-cache

An HTTP cache that works as a CDN for the [maps-api](#maps-api) and some endpoints of [workspace-api](#workspace-api). It uses [Varnish](https://varnish-cache.org/) HTTP Cache.

#### workspace-api

API to support the Web Application of the workspace (workspace-www).

#### maps-api

[Maps](https://docs.carto.com/carto-for-developers/key-concepts/apis#maps) and [SQL](https://docs.carto.com/carto-for-developers/key-concepts/apis#sql) high-performance API. It's the component with higher traffic as it's deeply used by other components.

It doesn't perform batch operations. Batch operations of SQL API are executed by sql-worker.

You should create multiple instances of this container to scale at your needs.

#### import-api

[Import API](https://api-docs.carto.com/#d8fea1d4-2f80-4270-a684-75fd83b10426). This component doesn't perform actual import operation, it just creates jobs for [import-worker.](#import-worker)

#### lds-api

[Location Data Services (LDS](https://docs.carto.com/carto-for-developers/key-concepts/apis#location-data-services-lds)) API.

#### workspace-subscriber

Consumer of the messages related to workspace at the Message Broker. It reads the messages published on that bus and performs the required actions.

#### import-worker

Consumer of the messages related to [imports](https://docs.carto.com/carto-for-developers/key-concepts/apis#imports) at the Message Broker. It uploads geospatial files into the customer Data Warehouse.

It requires 8GB of RAM to process up to 1GB of geospatial files.

#### sql-worker

Consumer of the messages related to [SQL](https://docs.carto.com/carto-for-developers/key-concepts/apis#sql) at the Message Broker.

This worker is mainly used to execute SQL in batch for customers using PostgreSQL or Redshift. BigQuery and Snowflake data warehouse won't use this component as it uses the batch APIs (jobs) provided by the data warehouse.

#### cdn-invalidator-sub

Consumer of the messages related to invalidation at the Message Broker. It invalidates content at [http-cache](#http-cache).
