DEV Community

Cover image for Build Inventory Software [Rust / Cursive]
Bek Brace
Bek Brace

Posted on

Build Inventory Software [Rust / Cursive]

Hey everyone,

I'm thrilled to announce the release of my Rust Inventory Management System! 🎉

I am using Rust Version 1.77.1 and Cursive Version 0.21.1


For those of you who don’t know me, I’m Amir, a software developer and content creator with a passion for programming, especially in systems languages like Rust. Over the past few weeks, I’ve been working on a simple yet powerful inventory management application that uses Rust and the Cursive library to create a smooth text-based user experience.

Rust is an incredible language known for its speed, safety, and memory management—making it perfect for building robust applications. By integrating the Cursive crate, we can create a beautiful text user interface (TUI) right in the terminal, which is essential for managing our inventory effectively.

Key Features:

  • Add Products: Easily add products with essential details like type, quantity, price per unit, sales tax, and total price.
  • View Inventory: Get a comprehensive list of all inventory items along with calculated sales tax and total prices.
  • Delete by ID: Quickly remove any product from your inventory.
  • Persistent Storage: All your data is saved in inventory.json, ensuring your products are retained between sessions.

Inventory Management System

Technologies Used:

  • Rust: For application logic and data handling.
  • Cursive: To build a user-friendly text-based UI.
  • Serde: For seamless JSON serialization and deserialization (pronounced "sir-dee").
  • Arc and Mutex: Ensuring safe, thread-safe shared ownership.

Getting Started:

Here’s how to set it up:

Clone the Repository and run the app:

   git clone https://github.com/BekBrace/inv-tui-rust
   cd inv-tui-rust
   cargo run
Enter fullscreen mode Exit fullscreen mode

Usage Guide

The app provides a straightforward interface for inventory management. Here’s how to use it:

  1. Add Product: Enter the product details and watch sales tax and total price calculate automatically.
  2. Show All: View all inventory items along with their details.
  3. Delete by ID: Simply enter the ID of the product you want to remove.
  4. Quit: Exit the application gracefully.

Code Structure

  • Product Struct: Defines the product attributes like type, quantity, price per unit, sales tax, and total price.
  • File Operations: Manages JSON serialization/deserialization for saving/loading data from inventory.json.
  • Cursive UI: Handles all user interactions for efficient product management.

I can’t wait for you to try it out! If you will, please let me know your thoughts. Your feedback helps me improve upon those apps I create and adds collective value to everyone.

Thank you 😊

Best,

Amir

Top comments (0)