# Creating application/library connection diagram (overlapping tikz elements)

I'm using an existing tikz example to create a flow chart of sorts, showing how applications and libraries communicate with each other in a software project. For example, the following image depicts two applications (ie: peers) communicating directly with each other:

What I would like to do with tikz is to create a new type of element which consists of a square element with another square inside of it. I would use this to depict something similar to the above, but it implies that "Process A" requires the use of "Library B_API" to talk to "Process B".

How would I accomplish this with tikz?

Thank you.

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes,arrows,calc}

\tikzstyle{application} = [rectangle, fill=blue!30, text centered, text width=3cm, minimum width=4cm, minimum height=4cm]
\tikzstyle{library} = [rectangle, fill=green!50, text centered, minimum width=3cm, minimum height=2cm, text width=2cm]

\begin{document}
\begin{tikzpicture}[node distance = 2cm, auto]

\node[application, label={[yshift=-14mm]Process A}] (AppA) at (0,0) {};
\node[application] (AppB) at (5,0) {Process B};
\node[library] (LibB) at (0,-.5) {Library B\_API};

\draw[<->,>=latex] (LibB.east) -- ($(LibB.east)+(1,0)$) -- ($(AppB.west)-(.5,0)$) -- (AppB.west);

\end{tikzpicture}
\end{document}


• You might consider using \tikzset in favor of \tikzstyle, see Should \tikzset or \tikzstyle be used to define TikZ styles? – Claudio Fiandrino Aug 12 '16 at 6:47
• Also, your arrow is not going straight up. You can simply write \draw[<->,>=latex] (LibB.east) -| ($(AppA)!.5!(AppB)$) -- (AppB.west);, this way the L shape will be exactly in the middle of the two blue rectangles. – Alenanno Aug 12 '16 at 11:36

It has been a nice exercise: an empty node with an inner labelled label.

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[external/.style={fill=blue!40, minimum size=3cm},
internal/.style={fill=green!30, text width=1.5cm,
minimum height=1.5cm, minimum width=2cm, align=center}]

\node[external, label={[internal, label=above:Process A, name=api,
yshift=.5cm, anchor=south]270:{Library\\ B\_API}}] (A) {};
\node[external, right= of A] (B) {Process B};
\draw[<->] (api.east)--++(0:1cm)|- (B);
\end{tikzpicture}
\end{document}