> For the complete documentation index, see [llms.txt](https://muradkarakas.gitbook.io/sodium_documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://muradkarakas.gitbook.io/sodium_documentation/language-reference/program-structure/controller-file.md).

# Controller File

**What**\
&#x20;Controller file is actually a [Code Behind File](/sodium_documentation/language-reference/program-structure/code-behind-file.md) with a special name "controller.sqlx". Controller file will be automatically loaded just after the user session creation but before the first [Form File](/sodium_documentation/language-reference/program-structure/form-file.md) request is processed. All Sodium projects must have one controller file in the same folder even if it is empty.

**Why**\
&#x20;Controller file term is used to provide developers with a standard application design. With a well-known controller file, developers can find implementation of the business logic. Controller files consist of global variables/functions which are available from the beginning of the Sodium application to the end of the user session.

In another word, Controller file is used for;

* Business rule implementation.
* Shared functions and/or variables.
* Session-wide triggers (Ex: ["user\_session\_end" trigger](/sodium_documentation/language-reference/built-in-triggers/user_session_end-trigger.md))
