MCPcopy Index your code
hub / github.com/JonasKruckenberg/tauri-plugin-graphql

github.com/JonasKruckenberg/tauri-plugin-graphql @tauri-plugin-graphql-v2.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release tauri-plugin-graphql-v2.1.0 ↗ · + Follow
28 symbols 52 edges 13 files 1 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Tauri Plugin graphql

Crates.io Documentation MIT licensed

A plugin for Tauri that enables type-safe IPC through GraphQL.

Install

Rust

[dependencies]
tauri-plugin-graphql = "2.0.0"

JavaScript

The only client-side adapter currently is tauri-plugin-graphql-urql, a custom exchange for [urql]. If you need adapters for other GraphQL clients, open a PR!

Package Version (click for changelogs)
[tauri-plugin-graphql-urql] urql adapter version

Usage

You need to register the plugin giving it a [async_graphql::Schema]. This schema will be used to fulfill requests.

use async_graphql::{Schema, Object, EmptySubscription, EmptyMutation, Result as GraphQLResult, SimpleObject};

#[derive(SimpleObject, Debug, Clone)]
struct ListItem {
    id: i32,
    text: String
}

impl ListItem {
    pub fn new(text: String) -> Self {
        Self {
            id: rand::random::<i32>(),
            text
        }
    }
}

struct Query;

#[Object]
impl Query {
    async fn list(&self) -> GraphQLResult<Vec<ListItem>> {
        let item = vec![
            ListItem::new("foo".to_string()),
            ListItem::new("bar".to_string())
        ];

        Ok(item)
    }
}

fn main() {
    let schema = Schema::new(
        Query,
        EmptyMutation,
        EmptySubscription,
    );

    tauri::Builder::default()
        .plugin(tauri_plugin_graphql::init(schema))
        .run(tauri::generate_context!())
        .expect("failed to run app");
}

Contributing

If you want to help out, there are a few areas that need improvement:

  • Client Adapters - Currently, only a urql adapter exists; having adapters for more client libraries would be very nice.

PRs are welcome!

License

MIT © Jonas Kruckenberg

Core symbols most depended-on inside this repo

Shape

Function 14
Class 8
Method 6

Languages

TypeScript61%
Rust39%

Modules by API surface

packages/graphiql/src/main.tsx9 symbols
examples/preact-app/src-tauri/src/main.rs6 symbols
src/lib.rs4 symbols
packages/urql/index.ts4 symbols
examples/preact-app/src/app.tsx4 symbols
examples/preact-app/src-tauri/build.rs1 symbols

For agents

$ claude mcp add tauri-plugin-graphql \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page