DEV Community

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

Posted on

2

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

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Image of Docusign

šŸ› ļø Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more