Skip to content


At the moment, we have everything in just one file. However, this can be impractical if we want to expand our app further.

Let’s start by creating a number of different files to represent the various concepts we covered in the previous section:

Terminal window
$ tree .
├── Cargo.toml
└── src

If you want to explore the code on your own, you can check out the completed source code here:

Let’s go ahead and declare these files as modules in src/

/// Application.
pub mod app;
/// Terminal events handler.
pub mod event;
/// Widget renderer.
pub mod ui;
/// Terminal user interface.
pub mod tui;
/// Application updater.
pub mod update;

We are going to use anyhow in this section of the tutorial.

Terminal window
cargo add anyhow

Now we are ready to start refactoring our app.