zMesh / Quickstart
Quickstart
Install @zmesh/client, point it at your project, and ship your first read in under five minutes.
1. Install the SDK
Works in any modern JS runtime — browser, Node 18+, React Native.
bash
pnpm add @zmesh/client
# or: npm i @zmesh/client / yarn add @zmesh/client2. Grab your connection details
From the console, open your project → SDK & API. You'll get an API URL and an app ID.
url— the zMesh API base URL.appId— issued per project. For browsers/mobile, create a Client app (no secret).
Don't have a project yet? Open zMesh to create one.
3. Initialize the client
ts
import { createClient } from "@zmesh/client";
export const zmesh = createClient({
url: "<api-url>",
appId: "<your-app-id>",
});Sessions auto-persist to localStorage in the browser and stay in-memory in Node / SSR.
4. First end-to-end read (Next.js App Router)
tsx
"use client";
import { useEffect, useState } from "react";
import { zmesh } from "@/lib/zmesh";
export default function ProfilePage() {
const [email, setEmail] = useState<string | null>(null);
useEffect(() => {
zmesh.auth.getUser().then((u) => setEmail(u?.email ?? null));
const sub = zmesh.auth.onAuthStateChange((event, session) => {
setEmail(session?.user.email ?? null);
});
return () => sub.unsubscribe();
}, []);
return <div>Hello {email ?? "guest"}</div>;
}