# How app custom domains work

Below is a snippet of how to set a custom domain for your app:

```
# /// script
# requires-python = ">=3.12"
# dependencies = [
#    "flyte>=2.0.0",
# ]
# ///

"""A basic streamlit app that uses a custom domain."""

import flyte
import flyte.app

# {{docs-fragment custom-domain}}
image = flyte.Image.from_debian_base(python_version=(3, 12)).with_pip_packages("streamlit==1.41.1")

# The `App` declaration.
# Uses the `ImageSpec` declared above.
# In this case we do not need to supply any app code
# as we are using the built-in Streamlit `hello` app.
app_env = flyte.app.AppEnvironment(
    name="streamlit-hello-custom-domain",
    image=image,
    args=["streamlit", "hello", "--server.port", "8080"],
    resources=flyte.Resources(cpu="1", memory="1Gi"),
    domain=flyte.app.Domain(subdomain="custom-subdomain"),
)

if __name__ == "__main__":
    flyte.init_from_config()
    d = flyte.deploy(app_env)
    print(d[0])
# {{/docs-fragment custom-domain}}
```

*Source: https://github.com/unionai/unionai-examples/blob/main/v2/user-guide/serve-and-deploy-apps/create_custom_domain.py*

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/user-guide/serve-and-deploy-apps/how-app-custom-domain-works.md
**HTML**: https://www.union.ai/docs/v2/flyte/user-guide/serve-and-deploy-apps/how-app-custom-domain-works/
