In this article, I show how to write structured code using components called services, authorizers, validators and repositories. To illustrate each of these components, I consider a small piece of code used by this website to create forum threads.