Skip to content

Project structure

A DyUI project can be a single file. dyui new my-bot creates this:

my-bot/
├── app.py your App, handlers and components
├── README.md
├── requirements.txt dyui (plus the SDK extra for the template)
├── .gitignore keeps .env and .dyui/ out of git
└── .env.example model templates only: copy it to .env and add your key

dyui run loads .env from the app’s folder, without overriding variables that are already set. See API keys & environment.

dyui run loads the target file and looks for a variable named app, application or bot. To pick another one, name it explicitly:

Terminal window
dyui run app.py # app.py → app
dyui run bots/support.py:bot # a file and an attribute
dyui run mypackage.main:app # an importable module

app is a standard ASGI application, so uvicorn app:app serves it too.

DyUI keeps runtime data in ./.dyui/, relative to the working directory. Change the location with App(data_dir=...).

Path Contents
.dyui/dyui.db SQLite database: conversations, messages, upload metadata
.dyui/uploads/ Uploaded files
.dyui/secret Key that signs the password cookie when password= is set and DYUI_SECRET isn’t

Coding-agent setup (dyui mcp install, dyui agent) writes its files outside .dyui/, in that agent’s own config folder; see Build with AI.

Keep .dyui/ and .env in your .gitignore (the templates’ .gitignore already lists both). In production, put .dyui/ on a persistent volume; see Production server.

DyUI has no required layout. Larger apps usually split into modules, with the App created once and imported elsewhere:

app.py app = dyui.App(...); imports the modules below
components.py @app.component classes
actions.py @app.on_action handlers
cards/ HTML templates for dyui.html_template(...)

Decorators register on the app instance, so the modules only need to be imported once.

DyUI Docs assistant

Answers come from the DyUI docs. gpt-oss-120b via Groq. Press Escape or the close button to return to the page.