@lacspace/sdk
High-level TypeScript SDK for Lacspace — api, auth, analytics and e-commerce in one client.
npm i @lacspace/sdkUsage
import { LacspaceSDK } from "@lacspace/sdk";
const lac = new LacspaceSDK({ baseURL: "https://api.lacspace.com/api" });
// 1 · Authenticate — the token is stored and reused everywhere
const { user } = await lac.auth.login({ email: "you@shop.com", password: "••••••••" });
// 2 · E-commerce helpers
const products = await lac.ecommerce.getProducts();
await lac.ecommerce.addToCart({ productId: products[0]!.id, quantity: 1 });
const { orderId } = await lac.ecommerce.checkout("cart_123");
// 3 · Track what happened
await lac.analytics.track("checkout_completed", { orderId });Exports 12
LacspaceAnalyticsLacspaceApiLacspaceApiErrorLacspaceAuthLacspaceSDKcreateAnalyticscreateApicreateAuthcreateClientisApiErrorlocalStorageTokenStoragememoryTokenStorageKeywords
More in Core
Event tracking for Lacspace platforms — batching and an offline queue.
@lacspace/analytics-litePrivacy-first, cookieless web analytics — page views and custom events sent to your own endpoint. No cookies, no localStorage IDs, no cross-site tracking, no consent banner. Respects Do-Not-Track, auto-tracks SPA navigation, uses sendBeacon. Zero-dependency, isomorphic.
@lacspace/apiLightweight, zero-dependency, isomorphic TypeScript HTTP client for Lacspace APIs.
@lacspace/authAuthentication flows (login, register, token, refresh) for Lacspace APIs.
@lacspace/nextNext.js App Router integration for the Lacspace SDK — authenticated server client from cookies, Route Handler & Server Action wrappers, cookie helpers and a middleware auth guard.
@lacspace/reactReact hooks and provider for the Lacspace SDK — useAuth, useQuery, useLacspace.