DocumentationCalling from Frontend

Calling from Frontend

Integrate FusePlane into your React, Vue, or mobile app.

Using the Client SDK

The easiest way to call your execution endpoints is using the official client SDK.

Terminal
1npm install @fuseplane/client

Implementation

src/App.tsx
1import { fuseplane } from '@fuseplane/client';
2
3// Initialize with your project ID (public)
4const fp = fuseplane({ projectId: "fp_proj_123" });
5
6async function handleClick() {
7 try {
8 // Call the 'hello' endpoint we created
9 const { data } = await fp.execute('hello');
10 console.log(data.message); // "Hello from FusePlane!"
11 } catch (error) {
12 console.error("Execution failed:", error);
13 }
14}

Using Fetch

You can also use standard `fetch` if you prefer no dependencies.

JavaScript
1const response = await fetch('https://api.fuseplane.com/v1/execute/hello', {
2 method: 'POST',
3 headers: {
4 'Authorization': 'Bearer <public_key>',
5 'Content-Type': 'application/json'
6 }
7});
8
9const data = await response.json();