\section{Architecture}
\begin{figure}[h]\label{fig:architecture-diagram}
\centering
\includegraphics[width=.8\linewidth]{architecture}
\caption{Overview of the structure of the AI Health Coach application}
\end{figure}
\subsection{Docker Container}
All of the components of the program are housed within Docker containers, and they all communicate with one another across the internal Docker network.
Benefits of Docker:
\begin{itemize}
\item \textbf{Development:} Any developer can launch the program, which enables simple local development independent of a server.
\item \textbf{Isolation:} The configuration of each container is unique, and there are no dependencies on other containers, which makes management and updates easier.
\item \textbf{Scalability:} The Blazor server's instances can be increased at will and with no effort.
\item \textbf{Consistency:} Consistency across the units is guaranteed because both Blazor servers are built on the same image and share the same codebase.
\item \textbf{Portability:} The application is hardware independent because it can operate on any platform that supports Docker.
\end{itemize}
\subsection{Traefik Reverse Proxy}
The Traefik reverse proxy and load balancer controls the traffic between the client and the services. All service instances in this operation share the load, and traffic is diverted if one fails.
Why Traefik:
\begin{itemize}
\item \textbf{Integration with Docker:} Since Traefik interacts directly with the Docker API, it is able to detect when a service has been terminated.
\item \textbf{Load Balancing and Sticky Sessions:} Supports persistent sessions, which is crucial for managing websockets and Blazor server applications, in addition to load balancing.
\item \textbf{Scalability:} Traefik's dynamic configuration supports scaling of Docker containers. It can be configured with more containers without having to restart it.
\item \textbf{Automatic SSL/TLS configuration:} Traefik can work with ACME servers. The automatic request and integration of certificates is very advantageous in the production environment.
\end{itemize}
\subsection{Blazor Website}
In order to create web apps in C\#, Microsoft provides the Blazor framework. This means both the web application itself and the server-side logic can be written in the same language.
Why Blazor:
\begin{itemize}
\item \textbf{C\# as a language:} We don't need to learn any new languages for this project because we are comfortable with C\#. Furthermore, IDEs like Visual Studio and Jetbrains Rider offer good Blazor integration and development assistance.
\item \textbf{.NET ecosystem:} It is possible to access the .NET libraries, tools, and features. For example Entity Framework is utilized for the connection between the application and database. Additional application development is made simpler by other frameworks like Identity for authentication.
\item \textbf{No JavaScript:} Blazor enables the creation of interactive user interfaces without JavaScript, much like React or Angular.
\item \textbf{Reusable components:} Blazor allows for the division of the UI into separate, reusable components. As a result, individual UI building blocks can be developed and tested independently.
\item \textbf{Blazor Models:} Blazor offers two different hosting models: Blazor Server and Blazor WebAssembly. Blazor Server runs code on the server and updates the UI with help of a SignalR connection. This is advantageous in our case, as failover can be ensured more easily. With Blazor WebAssembly, all code is executed directly in the browser. If an instance would shut down, all code has to be downloaded again from another server.

\end{itemize}
\subsection{Postgres Database}
Postgres is an open-source database and offers high reliability and data integrity.
Why Postgres:
\begin{itemize}
\item \textbf{Open-Source:} This database can be freely incorporated into our program.
\item \textbf{ACID Compliance:} Due to its compliance with ACID (Atomicity, Consistency, Isolation, Durability), Postgres offers data reliability and consistency even in the case of mistakes. These characteristics are crucial since application crashes and faults (in the sense of a service shutdown) are to be expected.
\item \textbf{.NET Integration:} Postgres supports Entity Framework for database access, which makes it very simple to update the application's content.
\end{itemize}
MySQL or Microsoft SQL would have been possible alternatives, but we chose Postgres because it is open-source and already familiar to us.