# The Util Directory

Some Util directories, such as Address, Cart, Currency, Menu, Price, Product, facilitate working with certain kinds of data. Others define commonly-needed functionality:

| `util` directory    | Purpose                                                                                                                                                               |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Auth                | Responsible for user authentication                                                                                                                                   |
| BrowserDatabase     | Convenience methods for accessing the browser's local storage with a simpler API                                                                                      |
| CSS                 | CSS manipulation. E.g. an utility for setting a CSS variable. This is useful if you want to be able to dynamically edit theme colors from the admin panel.            |
| Extensions          | Implements a part of the plugin mechanism                                                                                                                             |
| FormPortalCollector | Works with form data                                                                                                                                                  |
| History             | Exports a history object using the [`history`](https://www.npmjs.com/package/history) library.                                                                        |
| Media               | Utility for working with media URLs                                                                                                                                   |
| Mobile              | Function that helps determine the browser device, and wether it is a mobile device.                                                                                   |
| Polyfill            | Defines [polyfills](https://en.wikipedia.org/wiki/Polyfill_\(programming\)). Currently includes the [smoothscroll polyfill](https://iamdustan.github.io/smoothscroll) |
| Promise             | Implements a cancelable promise                                                                                                                                       |
| Query               | Defines tools to work with GraphQL queries                                                                                                                            |
| Request             | Defines tools to work with Requests                                                                                                                                   |
| Url                 | Tools to work with URLs and parse them.                                                                                                                               |

Finally, there is the `Braintree` directory, which can handle interaction with the Braintree payment method.

{% hint style="success" %}
When [overriding the theme](/developing-with-scandi/override-mechanism.md) or creating plugins, you are allowed to [override Util files](/developing-with-scandi/override-mechanism/extending-javascript.md) to add functionality, or to create your own Util files.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scandipwa.com/structure/building-blocks-summary/the-util-directory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
