| Crates.io | crate-checker |
| lib.rs | crate-checker |
| version | 0.1.0 |
| created_at | 2025-09-29 20:42:59.770164+00 |
| updated_at | 2025-09-29 20:42:59.770164+00 |
| description | Rust crate information retrieval tool with CLI and API server |
| homepage | https://github.com/sandlbn/crate-checker |
| repository | https://github.com/sandlbn/crate-checker |
| max_upload_size | |
| id | 1860165 |
| size | 222,708 |
A Rust crate information retrieval tool that provides both a powerful CLI and HTTP API for querying crates.io.
cargo install crate-checker
git clone https://github.com/sandlbn/crate-checker.git
cd crate-checker
cargo install --path .
Check if a crate exists:
crate-checker check serde
Get detailed information about a crate:
crate-checker info tokio --deps --stats
Search for crates:
crate-checker search "http client" --limit 10
Check multiple crates at once:
crate-checker check-multiple serde tokio reqwest clap
Process a batch from a JSON file:
crate-checker batch --file crates.json
Start the HTTP API server:
crate-checker server --port 8080
use crate_checker::{CrateClient, Result};
#[tokio::main]
async fn main() -> Result<()> {
let client = CrateClient::new();
// Check if a crate exists
let exists = client.crate_exists("serde").await?;
println!("Serde exists: {}", exists);
// Get crate information
let info = client.get_crate_info("tokio").await?;
println!("Tokio version: {}", info.newest_version);
// Search for crates
let results = client.search_crates("async", Some(5)).await?;
for crate_info in results {
println!("Found: {} v{}", crate_info.name, crate_info.newest_version);
}
Ok(())
}
-f, --format <FORMAT> - Output format: table (default), json, yaml, csv, compact--verbose - Enable verbose output-q, --quiet - Only show errors--config <FILE> - Path to configuration file--timeout <DURATION> - Request timeout (e.g., 30s, 2m, 1h)--api-url <URL> - Custom crates.io API URLcheck - Check if a crate existscrate-checker check <CRATE_NAME> [--version <VERSION>]
check-multiple - Check multiple cratescrate-checker check-multiple <CRATE_NAMES...> [OPTIONS]
Options:
-s, --summary-only - Show only summary--fail-on-missing - Exit with error if any crate doesn't existinfo - Get detailed crate informationcrate-checker info <CRATE_NAME> [OPTIONS]
Options:
-d, --deps - Include dependency information-s, --stats - Include download statisticsversions - List all versionscrate-checker versions <CRATE_NAME> [OPTIONS]
Options:
--no-yanked - Hide yanked versions-l, --limit <N> - Limit number of versionssearch - Search for cratescrate-checker search <QUERY> [OPTIONS]
Options:
-l, --limit <N> - Maximum results (default: 10)-e, --exact - Show only exact matchesdeps - Show dependenciescrate-checker deps <CRATE_NAME> [OPTIONS]
Options:
-v, --version <VERSION> - Specific version (default: latest)--runtime-only - Show only runtime dependenciesstats - Show download statisticscrate-checker stats <CRATE_NAME> [OPTIONS]
Options:
-v, --versions - Show version-specific statsbatch - Process multiple cratescrate-checker batch [OPTIONS]
Options:
--json <JSON> - JSON string with batch input--file <FILE> - JSON file with batch input-p, --parallel - Process in parallelserver - Start HTTP API servercrate-checker server [OPTIONS]
Options:
-p, --port <PORT> - Port to bind (default: 3000)--host <HOST> - Host to bind (default: 0.0.0.0)--cors - Enable CORS-c, --config <FILE> - Server configuration fileconfig - Generate configuration filecrate-checker config [--output <FILE>]
examples - Show batch input examplescrate-checker examples
{
"serde": "1.0.0",
"tokio": "latest",
"reqwest": "0.11.0"
}
{
"crates": ["serde", "tokio", "reqwest", "clap"]
}
{
"operations": [
{
"crate": "serde",
"version": "1.0.0",
"operation": "check_version"
},
{
"crates": ["tokio", "reqwest"],
"operation": "batch_check"
}
]
}
When running as a server, the following endpoints are available:
GET / - API documentationGET /health - Health checkGET /metrics - Server metricsGET /api/crates/{name} - Get crate informationGET /api/crates/{name}/{version} - Check specific versionGET /api/crates/{name}/{version}/deps - Get dependenciesGET /api/crates/{name}/stats - Get download statisticsGET /api/search?q={query}&limit={n} - Search cratesPOST /api/batch - Batch processingCreate a crate-checker.toml file:
[server]
port = 8080
host = "0.0.0.0"
workers = 4
enable_cors = true
[cache]
enabled = true
ttl_seconds = 300
max_entries = 1000
[logging]
level = "info"
format = "pretty"
[crates_io]
api_url = "https://crates.io/api/v1"
timeout_seconds = 30
Generate a sample configuration:
crate-checker config --output config.toml
All configuration options can be overridden using environment variables:
export CRATE_CHECKER__SERVER__PORT=8080
export CRATE_CHECKER__LOGGING__LEVEL=debug
export CRATE_CHECKER__CACHE__ENABLED=true
use crate_checker::{CrateClient, Result};
use std::collections::HashMap;
async fn monitor_crate_updates(crates: Vec<&str>) -> Result<HashMap<String, String>> {
let client = CrateClient::new();
let mut versions = HashMap::new();
for crate_name in crates {
let version = client.get_latest_version(crate_name).await?;
versions.insert(crate_name.to_string(), version);
}
Ok(versions)
}
# .github/workflows/check-deps.yml
name: Check Dependencies
on:
schedule:
- cron: '0 0 * * MON'
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo install crate-checker
- run: crate-checker check-multiple $(grep -E "^\w+ = " Cargo.toml | cut -d' ' -f1)
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under
Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0)
If you encounter any issues or have questions, please file an issue on GitHub.
Made with ❤️ by the Rust community