@zmesh/client
v0.2.1
Published
Official zMesh client SDK — Auth + Storage + Edge Functions for any frontend.
Maintainers
Readme
@zmesh/client
Official zMesh client SDK for browsers and Node 18+. Drop-in Auth + Storage for any frontend.
pnpm add @zmesh/clientUsage
import { createClient } from "@zmesh/client";
const zmesh = createClient({
url: "https://api.zmesh.in",
appId: "app_xxxxxxxxxxxx",
});
// Auth
const { user } = await zmesh.auth.signInWithPassword({
email: "[email protected]",
password: "hunter2",
});
// Storage
await zmesh.storage.from("avatars").upload("alice.png", file);
const { url } = await zmesh.storage.from("avatars").createSignedUrl("alice.png");
const files = await zmesh.storage.from("avatars").list({ prefix: "alice/" });API
createClient(options)
| option | required | description |
| --- | --- | --- |
| url | yes | Base URL of your zMesh control plane. |
| appId | yes | Public App ID from the zMesh console. |
| fetch | no | Custom fetch (defaults to globalThis.fetch). |
| storage | no | Session persistence adapter (defaults to localStorage). |
zmesh.auth
signUp({ email, password, display_name? })signInWithPassword({ email, password })signInWithMagicLink({ email, redirect_uri? })refresh()signOut()getUser()/getSession()onAuthStateChange((event, session) => ...)
zmesh.storage
listBuckets()from(bucket)→upload(name, body, opts?)download(name, opts?)→BlobcreateSignedUrl(name, opts?)list({ prefix?, limit? })remove(name)
Bucket access is governed by per-bucket policies (public,
authenticated, owner_only) plus an optional path_prefix_template
(e.g. {user_id}/) that scopes each user to their own folder.
License
MIT
