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 keydyui run loads .env from the app’s folder, without overriding variables that are already set. See API keys & environment.
Where the app object lives
Section titled “Where the app object lives”dyui run loads the target file and looks for a variable named app, application or bot. To pick another one, name it explicitly:
dyui run app.py # app.py → appdyui run bots/support.py:bot # a file and an attributedyui run mypackage.main:app # an importable moduleapp is a standard ASGI application, so uvicorn app:app serves it too.
Data directory
Section titled “Data directory”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.
Growing beyond one file
Section titled “Growing beyond one file”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 belowcomponents.py @app.component classesactions.py @app.on_action handlerscards/ HTML templates for dyui.html_template(...)Decorators register on the app instance, so the modules only need to be imported once.