
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@parcae/sdk
Advanced tools
Client SDK for Parcae backends. Pluggable transport layer (Socket.IO or SSE), React provider, and hooks for realtime data fetching.
npm install @parcae/sdk @parcae/model
import { createClient } from "@parcae/sdk";
// Socket.IO (default) — bidirectional, realtime subscriptions
const client = createClient({ url: "http://localhost:3000" });
// SSE — HTTP + Server-Sent Events, simpler infrastructure
const client = createClient({ url: "http://localhost:3000", transport: "sse" });
// Custom transport
const client = createClient({ url: "http://localhost:3000", transport: myTransport });
interface ClientConfig {
url: string;
key?: string | null | (() => Promise<string | null>);
version?: string; // default: "v1"
transport?: "socket" | "sse" | Transport; // default: "socket"
}
createClient() returns a ParcaeClient with the following API:
interface ParcaeClient {
// HTTP methods (delegated to transport)
get(path, data?): Promise<any>;
post(path, data?): Promise<any>;
put(path, data?): Promise<any>;
patch(path, data?): Promise<any>;
delete(path, data?): Promise<any>;
// Realtime
subscribe(event, handler): () => void;
unsubscribe(event, handler?): void;
send(event, ...args): void;
// Connection
readonly isConnected: boolean;
readonly isLoading: boolean;
loading: Promise<void>;
on(event, handler): void;
off(event, handler?): void;
disconnect(): void;
reconnect(): Promise<void>;
// Auth
setKey(key): Promise<void>;
readonly authVersion: number;
}
The client also calls Model.use(new FrontendAdapter(transport)) automatically, so Model.where(), Model.findById(), and other static methods work immediately after creating a client.
Default transport. Socket.IO over WebSocket.
"call" event with request IDs"authenticate" eventHTTP + Server-Sent Events. Better for read-heavy workloads or environments where WebSocket is not available.
fetch() for request/responseEventSource per subscription channel at /__events/{event}/__controlAuthorization headerWrap your app in ParcaeProvider to make the client available to hooks.
import { ParcaeProvider } from "@parcae/sdk/react";
// With a pre-created client
const client = createClient({ url: "http://localhost:3000" });
<ParcaeProvider client={client}>
<App />
</ParcaeProvider>
// Or with inline config
<ParcaeProvider
url="http://localhost:3000"
apiKey={token}
userId={user.id}
transport="socket"
onReady={(client) => console.log("connected")}
onError={(err) => console.error(err)}
>
<App />
</ParcaeProvider>
Re-authenticates automatically when userId changes. Forwards transport errors via onError.
Reactive data fetching with realtime subscriptions. Returns typed model instances that update in place when the server pushes changes.
import { useQuery } from "@parcae/sdk/react";
function PostList() {
const { items, loading, error, refetch } = useQuery(
Post.where({ published: true }).orderBy("createdAt", "desc")
);
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return items.map((post) => (
<article key={post.id}>
<h2>{post.title}</h2>
<Suspense fallback="...">
<span>{post.user.name}</span>
</Suspense>
</article>
));
}
How it works:
chain.find() to fetch initial datasubscribe:query to the server with the serialized query stepsadd, remove, update) are pushed and applied client-sideuseSyncExternalStore for tear-safe renderingCaching:
modelType:authVersion:stepsPass null or undefined to skip the query:
const { items } = useQuery(userId ? Post.where({ user: userId }) : null);
Pre-bound HTTP methods from the client.
import { useApi } from "@parcae/sdk/react";
function UploadButton() {
const { post } = useApi();
const upload = async (file) => {
const result = await post("/v1/media/upload", { file });
};
}
Raw client instance access.
import { useSDK } from "@parcae/sdk/react";
const client = useSDK();
client.send("some:event", data);
Connection state snapshot for the transport.
import { useConnectionStatus } from "@parcae/sdk/react";
function StatusBadge() {
const { isConnected, isLoading } = useConnectionStatus();
if (isLoading) return <span>Connecting...</span>;
return <span>{isConnected ? "Online" : "Offline"}</span>;
}
Persistent key-value user settings. GETs on mount, PUTs on update.
import { useSetting } from "@parcae/sdk/react";
function ThemeToggle() {
const [theme, setTheme, { isLoading }] = useSetting("theme", "light");
return (
<button onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
{theme}
</button>
);
}
// Main
import { createClient, SocketTransport, SSETransport } from "@parcae/sdk";
import type {
ClientConfig,
ParcaeClient,
SocketTransportConfig,
SSETransportConfig,
Transport,
} from "@parcae/sdk";
// Re-exports from @parcae/model
import { Model, FrontendAdapter } from "@parcae/sdk";
// React
import {
ParcaeProvider,
ParcaeContext,
useParcae,
useQuery,
useApi,
useSDK,
useConnectionStatus,
useSetting,
} from "@parcae/sdk/react";
import type { ParcaeProviderProps } from "@parcae/sdk/react";
MIT
FAQs
Parcae SDK — client transport and React hooks for Parcae backends
The npm package @parcae/sdk receives a total of 10 weekly downloads. As such, @parcae/sdk popularity was classified as not popular.
We found that @parcae/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.