๐ฆ Parse SDK for Rust (parse-rs)
A modern asynchronous Rust SDK for interacting with Parse Server backends. Effortlessly integrate your Rust applications with the powerful features of Parse.
๐ Overview
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.
๐ Table of Contents
โจ Features
- Asynchronous API: Built with
async/await
for efficient, non-blocking I/O. - User Authentication: Sign up, log in, log out, session management.
- Object Management: Full CRUD (Create, Read, Update, Delete) operations for
ParseObject
s. - Powerful Queries: Construct complex queries with constraints, sorting, pagination, relational queries, and aggregate functions.
- Session Management: Handle user sessions, including retrieval and revocation.
- File Handling: Upload and delete files associated with Parse objects.
- Cloud Code: Execute Cloud Code functions.
- Configuration Management: Retrieve server configuration.
- Type Safety: Leverages Rust's type system to minimize runtime errors.
- Structured Error Handling: Clear and descriptive error types.
(For a detailed list of implemented and planned features, please see PARSE-RS.md).
๐ ๏ธ Prerequisites
- Rust: Version 1.65 or later
- Parse Server: A running instance of Parse Server. You can set one up locally using Docker or use a managed Parse hosting provider.
- For local development and running integration tests, a
docker-compose.yml
is provided in this repository. See Running Tests for setup.
- For local development and running integration tests, a
- Parse Server Credentials: You'll need your Application ID, and optionally your REST API Key, JavaScript Key, or Master Key depending on the operations you intend to perform.
๐ Installation
Add parse-rs
as a dependency to your Cargo.toml
file:
[]
= "0.1.0" # Replace with the latest version from crates.io
# Ensure you have tokio for the async runtime
= { = "1", = ["full"] }
Then run cargo build
.
(Note: This SDK is not yet published to crates.io. This is a placeholder for when it is.)
โก Quick Start
Here's a basic example of how to initialize the client and create a new object:
use ;
use json;
use HashMap;
async
๐งช Running Tests
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
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 theparse-server-example
directory configures the server with these default credentials. -
Run Tests:
-
Tear Down Parse Server (Optional):
๐ฏ API Coverage
parse-rs
aims to cover a significant portion of the Parse Server REST API.
Currently Implemented:
- User Authentication (Signup, Login, Logout, Get Current User, Session Token Validation)
- Object Management (Create, Retrieve, Update, Delete)
- Querying (Basic constraints, relational queries, pagination, ordering, aggregate)
- Session Management (Get Current Session, Get All Sessions, Revoke Session)
- File Upload & Deletion
- Cloud Code Function Execution
- Configuration Retrieval
For a detailed, up-to-date checklist of implemented features and future plans, please refer to the PARSE-RS.md document.
๐ค Contributing
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:
- Read the PARSE-RS.md document to understand the project's goals and current status.
- Open an issue to discuss any significant changes or new features.
- Ensure your code adheres to the existing style and passes all tests.
- Add tests for any new functionality.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.