Installation
- Meet dust-framework
- Creating an application
- Running in production
- Deploying to DUST Cloud
- Troubleshooting the first run
- Next steps
Meet dust-framework
[!WARNING] dust-framework is currently in beta. Releases before 1.0 may include breaking changes to APIs and configuration.
dust-framework is a full-stack web application framework. It includes the routing, middleware, sessions, database tools, queues, and testing helpers that every web application needs, so you can spend your time on what your application does.
dust-framework is built on Axum and Tokio, which give it a solid, fully asynchronous foundation: a handful of threads can serve thousands of concurrent requests, and a request waiting on the database or another service never holds up the rest. On that foundation, dust-framework adds a variety of full-stack features for building ambitious applications, from authentication and validation to queues, mail, notifications, and broadcasting.
You do not need Node.js to start. A new application ships io/ui, a dependency-free frontend of CSS tokens, components, and native JavaScript, vendored under public/vendor/io-ui. The browser loads one stylesheet and one ES module; there is no asset build step and nothing to install with npm. The frontend guide explains how to change the layout, update io/ui, and add your own CSS.
Creating an application
Before you create your first dust-framework application, install Rust and Git on your machine.
dust-framework needs Rust 1.97 or later. If you don't have Rust yet, install it with rustup, Rust's official installer:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shOn Windows, download the installer from rustup.rs instead. If you already have Rust, run rustup update to get the latest stable release. You can check what you have with:
rustc --versioncargo --versionMost machines already have Git. If yours doesn't, download it from the Git website.
Installing the dust-framework CLI
The dust-framework CLI creates new applications and runs your application's commands. On macOS and Linux, install it with this command:
curl -fsSL https://dustapp.dev/install.sh | shOn Windows, run this command in PowerShell instead:
powershell -ExecutionPolicy Bypass -c "irm https://dustapp.dev/install.ps1 | iex"The installer downloads the framework source, builds the dust command, and puts it in ~/.cargo/bin (or $CARGO_HOME/bin when CARGO_HOME is set). If that directory is already on your PATH, as it is for a standard rustup install, the command works in your current shell. Otherwise, open a new terminal.
Confirm which binary your shell finds before you create anything:
dust --versionThe output starts with dust and the CLI's version. If another program answers, inspect every dust binary on your PATH with which -a dust on macOS and Linux, or Get-Command dust -All in PowerShell on Windows, and put the one from ~/.cargo/bin first.
The CLI is built from the same source as the framework, so dust update keeps both in step. If you build the framework from a checkout, install the CLI from that checkout with:
cargo install --path crates/cliCreating your application
Create your application with dust new. The command takes the directory to create, writes a complete application into it, and prints the next steps:
dust new example-appcd example-appdust new refuses to write into a directory that already holds files, so pick a new path or an empty one. The application is always a Rust application, and its library is always named app, whatever you call the directory, so your imports start with app::. To rename the project, change the name in the [package] section of Cargo.toml; keep the [lib] name = "app" line.
The command also generates your application's encryption key and writes it as APP_KEY in .env. This key encrypts your cookies and sessions, so keep it secret. To change it later, follow the key rotation guide.
Your .env file holds the settings that change between your machine and your servers, such as database URLs and API keys. Since it holds your secrets, don't commit it to source control; .env.example holds the same keys with placeholder values and is safe to commit. The configuration guide covers .env, environment precedence, and the configuration files in src/config/.
[!NOTE] The generated
.envusesAPP_ENV=localandAPP_DEBUG=true, which is what you want while developing. The deployment guide lists the values to change before real users arrive.
Databases and migrations
Your application stores its users, sessions, queued jobs, and media in a database, so set one up before you start the application. A new application uses SQLite and stores the file under storage/app, so it runs without a separate database server. Its .env looks like this:
DB_CONNECTION=sqlite
DATABASE_URL=sqlite://storage/app/database.sqlite?mode=rwcThe ?mode=rwc option tells SQLite to create the file the first time your application connects. Then run your migrations from your application's directory to create the users, sessions, jobs, cache, notifications, and other framework tables:
dust migratedust migrate compiles your application, then runs every migration that hasn't run yet. The first run creates the SQLite file and its tables.
You may use PostgreSQL or MySQL instead. In Cargo.toml, replace the database-sqlite feature on dust-framework with database-postgres or database-mysql, then point .env at your database:
DB_CONNECTION=postgres
DATABASE_URL=postgres://postgres@127.0.0.1/dustDB_CONNECTION=mysql
DATABASE_URL=mysql://root@127.0.0.1/dustYour application's migrations work on every supported database. The database guide covers connection settings, extra connections, and pooling in detail.
Running the application
Start the development server from your application's directory:
dust devdust dev runs the application's serve command under Cargo. Once it starts, visit http://127.0.0.1:8000 in your browser to see its welcome page. The generated application also answers /health with 200 OK and /hello/{name} with a greeting, so you have something to open while you build your own routes.
Stop the server with Ctrl+C. If the port is taken, set another one for the run:
SERVER_PORT=8001 dust devYour application has console commands of its own, such as route:list, which lists your routes. Run them through dust from your application's directory or any directory inside it. The CLI compiles your application first, and only shows the compiler's output when the build fails:
dust route:listTo build without starting the server, run dust build. It runs Cargo and copies the application and dust-cron binaries into the application's bin/ folder, where dust install and the daemon expect them:
dust builddust build --releaseTo see every command your application has, run dust list. To read one command's arguments and options, run dust help <command>.
On a fresh server, dust install runs the pending migrations, adds the core schedule:run cron, and starts the cron daemon in one step:
dust installPass --force to run migrations without the production confirmation prompt, or --no-cron to skip the scheduler and daemon. dust restart restarts the cron daemon and the relay server; dust status reports the application, the database and how many migrations ran, the queue and cache, the cron daemon and its next run, the relay server, and the installed io/ui version:
dust statusThe full command map, including the build, install, and restart flags, is in the commands guide.
Running in production
Build the application and its frontend, then run the binary:
dust build --release./bin/example-appThe io/ui assets are already in public/vendor/io-ui, so there is no separate asset build. dust build --release copies the release binaries into bin/, where your process manager can start them without reaching into target/.
When you're ready to put your application on a server, the deployment guide walks you through the files that go on the server, the environment, the process manager, migrations, queue workers, and the scheduler.
[!WARNING] Before you deploy, check that
APP_ENVisproductionandAPP_DEBUGisfalse. With debug mode on, server errors render a page with the error, its causes, the route, and the request, for anyone to see.
Health checks
Load balancers and uptime monitors often need a way to tell whether your application is running. A new application registers a /health route in src/routes/web.rs, which returns 200 OK once the application has started:
// src/routes/web.rspub fn routes(route: &mut Router) { route.get("/health", handlers::home::health);}You may also register the framework's own health check at any path with routing.health(...) in src/app.rs. It answers before middleware runs, so a probe is never blocked by a session lookup or a maintenance page:
// src/app.rs.with_routing(|routing, _| { routing .web(routes::web::routes) .api(routes::api::routes) .health("/up");})Point your load balancer or monitoring service at whichever path you keep. The routing guide covers what the framework health route checks and why a route may not shadow it.
Deploying to DUST Cloud
When you're ready to put your dust-framework Rust application in front of real users, DUST Cloud is the best place to run it. DUST Cloud is a fully managed deployment platform from the team behind dust-framework. It deploys your application each time you push to Git and includes:
- Autoscaling that follows your traffic, and scale-to-zero when your application is idle, so you only pay for what you use
- Preview environments for every pull request
- Managed MySQL and Postgres databases, and Valkey caches
- Managed queues whose workers scale with the jobs waiting
- Object storage for your application's files
- Managed WebSocket servers
To deploy your application, get started with DUST Cloud.
Troubleshooting the first run
These are the problems a fresh installation runs into most often.
| Symptom | What to check |
|---|---|
dust: command not found |
~/.cargo/bin is on your PATH; open a new terminal after installing. |
dust: run this inside an application |
Run the command from the application's directory, or any directory inside it. |
| The build fails on a feature name | The feature you removed from Cargo.toml is still referenced in code; restore it or remove the code that uses it. |
Address already in use |
Another process owns port 8000. Set SERVER_PORT for one run. |
unable to open database file |
The storage/app directory is missing or not writable, or DATABASE_URL points somewhere the process can't write. |
| A page renders without styles | public/vendor/io-ui is missing or not served under the base path; run dust ui:update or copy the assets again. |
| Tests can't connect | The test database in .env.testing or src/testing.rs doesn't exist, or its user can't create databases. See refreshing the database. |
If the compiler prints a long error while dust dev starts, run the application directly to see it without the CLI's quiet wrapper:
cargo run -- serveNext steps
Now that your application is running, you may be wondering what to learn next. Start with these guides to see how a dust-framework application fits together:
Once you're comfortable with the basics, you're ready to start building. These guides walk you through the pieces most applications use first, from defining routes and validating input to storing data and testing your work: