diff --git a/tex/text.tex b/tex/text.tex index c572341..a4f07bc 100644 --- a/tex/text.tex +++ b/tex/text.tex @@ -792,6 +792,26 @@ official formatting standards. \n{1}{Application architecture} +The source code is split into Go \emph{packages} appropriately along a couple +of domains: logging, core application, web routers, configuration and settings, +etc. In Go, a package is delimited by folder structure -- each folder is a +package. + +Generally speaking, the program aggregates decision points into central places, +such as \texttt{run.go}, which imports child packages that facilitate each of +loading the configuration, connecting to the database and running migrations, +consolidating flag, environment variable and configuration-based values into +canonical \emph{settings}, setting up routes and handling graceful shutdown. + +The program uses dependency injection to share a single logger instance, +similar applies to the database client. These are passed around as a pointer, +so the underlying data stays the same. As a rule of thumb, every larger +\texttt{struct} that needs to be passed around is passed around as a pointer. + +Authentication logic is relatively simple and the author would like to isolate +it into a custom \emph{middleware} but that is a future work. + + \n{1}{Implementation} \n{2}{Configuration}