The Rusty Store Inventory Management System is a command-line application built with Rust for managing a retail store's inventory, sales, and purchases.
- Inventory Management: Add, edit, delete products with attributes like name, description, price, and quantity.
- Sales Management: Record sales transactions and calculate profits.
- Purchase Management: Record purchase transactions and calculate costs.
- Reporting: Generate reports for inventory, sales, and purchase history.
- Modular Architecture: Organized into separate modules for reusability.
- Authentication: Basic authentication system for store managers.
- Persistence: Data stored in JSON file backups.
- Rust installed (version 1.70+ recommended).
-
Clone the repository:
git clone https://github.com/yourusername/rusty-store.git cd rusty-store
-
Install dependencies:
cargo build
The application uses SQLite as the primary data storage.
create a file under db folder with the name rusty_store.db
or if you save the file as a different name, update the connection string in main.rs
:
let auth_manager = AuthManager::new("sqlite:db/rusty_store.db").await;
To start the application:
cargo run
-
Add a Product:
> Add Product Name: Laptop Description: High-performance laptop Price: 1200.50 Quantity: 10 Product added successfully.
-
Record a Sale:
> Record Sale Product: Laptop Quantity: 2 Sale recorded successfully. Total: $2401.00
-
Generate a Report:
> Generate Report Inventory Report: ----------------- Product: Laptop Description: High-performance laptop Price: $1200.50 Quantity: 8 Sales Report: ------------- Product: Laptop Quantity Sold: 2 Total Sales: $2401.00
-
Backup Inventory: Inventory Data is automatically backed up to
inventory.json
when the program shuts down. Transaction Data is automatically backed up totransactions.json
when the program shuts down. -
Restore Inventory: The system will automatically load inventory data from
inventory.json
on start. The system will automatically load transactions data fromtransactions.json
on start.
src/
├── auth.rs // Handles authentication logic
├── inventory.rs // Manages product inventory
├── transactions.rs // Handles sales and purchase transactions
├── reporting.rs // Generates reports
├── lib.rs // Orchestrates modules and exposes APIs
├── main.rs // Entry point of the application
├── util.rs // Utility functions to format output and get user input
db/
├── rusty_store.db // Handles Storage for authenticated users (You are to create this file manually)
├── inventory.json // JSON file for backup storage of products in inventory
├── transactions.json // JSON file for backup storage of transactions made
Run tests to ensure the system is functioning correctly:
cargo test
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
. - Commit changes:
git commit -m 'Add feature'
. - Push the branch:
git push origin feature-name
. - Open a pull request.
This project is licensed under the MIT License. See LICENSE
for details.
Thanks to the Rust community and Risein Foundation for their amazing resources on rust.