# Controller File

**What**\
&#x20;Controller file is actually a [Code Behind File](https://muradkarakas.gitbook.io/sodium_documentation/language-reference/program-structure/code-behind-file) with a special name "controller.sqlx". Controller file will be automatically loaded just after the user session creation but before the first [Form File](https://muradkarakas.gitbook.io/sodium_documentation/language-reference/program-structure/form-file) 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](https://muradkarakas.gitbook.io/sodium_documentation/language-reference/built-in-triggers/user_session_end-trigger))
