A simple Rust CLI tool and web server to check GPU stock and prices from nowinstock.net.
- Fetch current stock status and price for specific Nvidia GPU models.
- Filter listings (e.g., show only in-stock items).
- Sort listings by various columns (name, status, price, last available).
- Output results in different formats (Table, JSON, YAML, TOML).
- Find the single cheapest available listing across all tracked GPU models.
- Run as a persistent web server to view listings in a browser.
- Install Rust: If you don't have Rust installed, follow the instructions at rustup.rs.
- Clone the repository:
git clone <repository-url> cd gpu_pricecheck
- Build the project:
The executable will be located at
cargo build --release
./target/release/gpu_pricecheck.
Run the tool from the command line for a one-off check:
# Using cargo run during development
cargo run -- [OPTIONS] [GPU]
# Using the compiled binary (e.g., after `cargo build --release`)
./target/release/gpu_pricecheck [OPTIONS] [GPU]Or, run it as a web server:
# Run web server on default port 8080
cargo run -- --web
# Run web server on a specific port and allow external access
cargo run -- --web --listen 0.0.0.0:9000
# Using the compiled binary
./target/release/gpu_pricecheck --web --listen 8081[GPU]: GPU model to check stock for. Default is5080. Ignored if--cheapest-eachor--webis used. Possible values:5090,5080,5070ti,5070.
CLI Options (ignored when --web is used, except for --help and --version):
-s, --sort-by <SORT_BY>: Column to sort by. Default isprice. Possible values:name,status,price,last,link.-d, --desc: Sort in descending order. Default is ascending.--all: Show all listings, including "Out of Stock" and "Not Tracking".-n, --limit <LIMIT>: Limit the number of results shown.-f, --format <FORMAT>: Output format. Default istable. Possible values:table,json,yaml,toml.--cheapest-each: Find and display the single cheapest available listing for each GPU model (5090, 5080, etc.). Ignores the[GPU]argument.
Web Server Options:
-w, --web: Run as a web server instead of a one-off CLI command.--listen <ADDRESS:PORT>: The socket address (IP and port) for the web server to listen on. Default is127.0.0.1:8080. Examples:8080,0.0.0.0:9000.
General Options:
-h, --help: Display help information.-V, --version: Display version information.
CLI Examples:
- Check stock for the RTX 5090 and sort by price in descending order:
cargo run -- 5090 -s price -d
- Show all listings for the RTX 5080, including unavailable ones, in JSON format:
cargo run -- 5080 --all --format json
- Limit results to the top 5 cheapest listings for the 5070 Ti:
cargo run -- 5070ti -n 5
- Find the cheapest available listing for each GPU model and output as YAML:
cargo run -- --cheapest-each --format yaml
Web Server Examples:
- Start the web server on the default address
127.0.0.1:8080:cargo run -- --web # Access in browser: http://127.0.0.1:8080 - Start the web server on port 9000, accessible from other machines on the network:
cargo run -- --web --listen 0.0.0.0:9000 # Access locally: http://127.0.0.1:9000 # Access from other machines: http://<your-machine-ip>:9000
- Formatting: Uses
rustfmt(standard Rust formatting).cargo fmt
- Linting: Uses
clippy(standard Rust linter).cargo clippy --all-targets --all-features -- -D warnings
This project uses the following Rust crates:
reqwest: For HTTP requests.scraper: For parsing HTML.comfy-table: For displaying tabular data (CLI).anyhow: For error handling.clap: For command-line argument parsing.regex: For parsing price strings.lazy_static: For static regex initialization.serde,serde_json,serde_yaml,toml: For serialization (JSON, YAML, TOML output).tokio: Asynchronous runtime.axum: Web framework.askama,askama_axum: HTML templating engine.tower-http: HTTP utility types and services (e.g., for static files).chrono: For displaying timestamps in the web UI. (Implicit dependency via askama example, good to list)
This project is licensed under the MIT License - see the LICENSE file for details (if one exists).