# Architecture overview

UI Bakery self-hosted version is a set of services, some of which are optional. The same core principles apply whether you deploy it using Docker Compose or Kubernetes.

Below is a diagram illustrating *UI Bakery containers* and the *relationships* between them. Arrows indicate the direction of requests between containers/services.

<figure><img src="/files/ENJiVgdiR8kaIPA262ce" alt=""><figcaption><p>UI Bakery overview</p></figcaption></figure>

All UI Bakery containers are stateless. Certain containers are optional and can be safely removed if their functionality is not required. Check out what these containers stand for:

* **bakery-gateway** acts as an NGINX-based gateway and reverse proxy. Routes incoming client requests to the appropriate internal services.
* **bakery-front** is an NGINX server hosting static files (HTML/CSS/JS) for the main UI Bakery interface.
* **workbench-front** is another NGINX server dedicated to hosting static files for the “workbench” front-end. The workbench is rendered within an iframe inside the main UI, providing a secure sandboxed environment for end-user apps.
* **bakery-back** is a Java-based API service serving as the main backend. Handles authentication, authorization, user management, storage of application models, and other central logic. May initiate outbound connections if SSO or other external integrations are enabled.
* **datasource** is a Node.js service responsible for executing queries against connected data sources.
* **db** is a MySQL database that stores internal UI Bakery entities such as users, apps, and permissions. [Recommended](/on-premise/install-and-update/recommendations/running-a-standalone-database-instance.md) to replace with a managed, external MySQL database in production. Can be removed if you are using an external database solution.
* **automation** is a Node.js service that executes [UI Bakery automations](/extras/automations.md). Invoked by bakery-back, it can perform datasource queries as part of these automations. Can be removed if automations are not used.
* **python-runtime** is a Node.js-based environment for running [Backend Python code](/reference/working-with-actions/python-backend-code.md) actions within UI Bakery. Can be removed if Python-based actions are not required.
* **bakery-db** is a PostgreSQL database that can be connected as a data source within UI Bakery. Used for the [UI Bakery Database](/extras/ui-bakery-postgres.md) feature. Can be removed if database is not used.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/on-premise/install-and-update/recommendations/architecture-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
