| Crates.io | parse-rs |
| lib.rs | parse-rs |
| version | 0.2.0 |
| created_at | 2025-05-26 21:02:16.907528+00 |
| updated_at | 2025-05-30 15:23:06.810978+00 |
| description | A modern and asynchronous Rust SDK for interacting with Parse Server backends |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1690270 |
| size | 530,515 |
A modern asynchronous Rust SDK for interacting with Parse Server backends. Effortlessly integrate your Rust applications with the powerful features of Parse.
parse-rs aims to provide a comprehensive, easy-to-use, and type-safe interface for the Parse Server REST API. Whether you're building a new application or integrating with an existing Parse backend, this SDK is designed to streamline your development process.
This SDK is built with async/await for non-blocking operations and leverages popular Rust libraries like reqwest for HTTP communication and serde for JSON serialization/deserialization.
async/await for efficient, non-blocking I/O.ParseObjects.(For a detailed list of implemented and planned features, please see PARSE-RS.md).
docker-compose.yml is provided in this repository. See Running Tests for setup.Add parse-rs as a dependency to your Cargo.toml file:
[dependencies]
parse-rs = "0.1.0" # Replace with the latest version from crates.io
# Ensure you have tokio for the async runtime
tokio = { version = "1", features = ["full"] }
Then run cargo build.
(Note: This SDK is not yet published to crates.io. This is a placeholder for when it is.)
Here's a basic example of how to initialize the client and create a new object:
use parse_rs::{Parse, ParseObject, ParseError, Value};
use serde_json::json;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), ParseError> {
// Initialize the Parse client
// Ensure PARSE_SERVER_URL, PARSE_APP_ID, and PARSE_MASTER_KEY (or other keys) are set in your environment
// or provide them directly.
let server_url = std::env::var("PARSE_SERVER_URL").unwrap_or_else(|_| "http://localhost:1338/parse".to_string());
let app_id = std::env::var("PARSE_APP_ID").unwrap_or_else(|_| "myAppId".to_string());
let master_key = std::env::var("PARSE_MASTER_KEY").unwrap_or_else(|_| "myMasterKey".to_string());
let mut client = Parse::new(
&server_url,
&app_id,
None, // javascript_key
None, // rest_api_key
Some(&master_key),
).await?;
// Create a new ParseObject
let mut game_score_data = HashMap::new();
game_score_data.insert("score".to_string(), Value::Number(1337.into()));
game_score_data.insert("playerName".to_string(), Value::String("Sean Plott".to_string()));
game_score_data.insert("cheatMode".to_string(), Value::Boolean(false));
let mut new_score = ParseObject::new("GameScore", game_score_data);
let created_object: ParseObject = client.create(&mut new_score).await?;
println!("Successfully created GameScore with objectId: {}", created_object.get_object_id().unwrap());
// Retrieve the object
let retrieved_score: ParseObject = client.get("GameScore", created_object.get_object_id().unwrap()).await?;
println!("Retrieved score for {}: {:?}",
retrieved_score.get_string("playerName").unwrap_or_default(),
retrieved_score.get_number("score")
);
Ok(())
}
This SDK includes a suite of integration tests that run against a live Parse Server instance.
Set up Parse Server:
A docker-compose.yml file is provided to easily spin up a Parse Server and MongoDB instance.
# From the root of the repository
docker compose up -d
This will start Parse Server on http://localhost:1338/parse.
Set Environment Variables:
The tests require certain environment variables to be set. You can create a .env file in the root of the project or set them in your shell:
PARSE_SERVER_URL=http://localhost:1338/parse
PARSE_APP_ID=myAppId
PARSE_MASTER_KEY=myMasterKey
PARSE_JAVASCRIPT_KEY=myJavascriptKey
PARSE_REST_API_KEY=myRestApiKey
# Add any other keys if your server configuration requires them
The entrypoint.sh script in the parse-server-example directory configures the server with these default credentials.
Run Tests:
cargo test
Tear Down Parse Server (Optional):
docker compose down
parse-rs aims to cover a significant portion of the Parse Server REST API.
Currently Implemented:
For a detailed, up-to-date checklist of implemented features and future plans, please refer to the PARSE-RS.md document.
Contributions are welcome! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please feel free to open an issue or submit a pull request.
Before contributing, please:
This project is licensed under the MIT License - see the LICENSE file for details.