Skip to content

orhun/rustlab2024-ratatui-workshop

Repository files navigation

banner

Ratatui Workshop 👨‍🍳🐀

This workshop is prepared for "Cooking up TUIs with Ratatui" session at RustLab 2024.

You can also follow this guide individually and complete the workshop. See Getting Started.

What will you build?

A terminal chat application that supports sending messages, files, and images.

demo

Goals

  • Get familiar with the fundamentals of Ratatui.
  • Learn how to incorporate widgets and structure your application.
  • Understand the best practices of building TUI applications in Rust.
  • Have fun!

Chapters

  1. Introduction
  2. Initializing the project
  3. Initializing the TUI
  4. Server connection
  5. Message list
  6. Text input (w/ tui-textarea)
  7. Room list (w/ tui-tree-widget)
  8. Help popup
  9. File explorer (w/ ratatui-explorer)
  10. Image preview (w/ ratatui-image)
  11. Markdown preview (w/ tui-markdown)
  12. Terminal effects (w/ tachyonfx)
  13. Logging (w/ tui-logger)
  14. Testing (w/ insta)
  15. End

Getting Started

Prerequisites

  1. Rust (make sure you have the latest stable version installed).

  2. A code editor with rust-analyzer plugin (or anything at your preference).

  3. A performant terminal with image rendering support (is good to have). We recommend wezterm.

Setup

Simply start by cloning this repository:

git clone https://github.com/orhun/rustlab2024-ratatui-workshop

Your job is to implement a terminal client for a chat application using Ratatui!

Click here to start the workshop! ➡️

Start reading through the chapters and sometimes you will be asked to implement some parts of the application. Don't worry, the solutions are also provided! :)

Let us know if you got stuck somewhere or if you think something is wrong!

Presenting

You can also present this workshop at your local Rust meetup or conference!

There are minimal slides included in the presentation.md file. You can use presenterm to start the presentation:

presenterm -c config.yml presentation.md

Don't forget to tweet at us!

References

The client/server architecture is inspired by @pretzelhammer's chat server project.

License

Copyright © 2024, Orhun Parmaksız

Licensed under The MIT License

🦀 ノ( º _ º ノ) - respect crables!