@lacspace/next
Next.js App Router integration for the Lacspace SDK — authenticated server client from cookies, Route Handler/Server Action wrappers, CSRF + middleware auth guard, plus edge-safe pure helpers for cookies, Cache-Control, route matching, open-redirect-safe redirects and bearer tokens.
npm i @lacspace/nextUsage
import { createServerClient } from "@lacspace/next";
export default async function DashboardPage() {
const lac = await createServerClient({ baseURL: "https://api.lacspace.com/api" });
const products = await lac.ecommerce.getProducts(); // token applied from the cookie
return <ProductGrid products={products} />;
}Exports 12
authGuardclearAuthCookiecreateServerClientgetAuthTokengetCsrfTokenrouteHandlerserverActionClientsetAuthCookiesetCsrfCookieverifyCsrfwithAuthwithCsrfKeywords
More in Core
Event tracking for Lacspace platforms — a spec-style track/identify/page/group/alias client with batching, an offline retry queue, consent + Do-Not-Track gating, and pluggable middleware. Every transport, clock and timer is injectable, so it never touches the network by default.
@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. Now with a batching LiteClient, a sendBeacon-first transport, UTM parsing, DNT/consent helpers and a CSPRNG id. Zero-dependency, isomorphic.
@lacspace/apiLightweight, zero-dependency, isomorphic TypeScript HTTP client for Lacspace APIs — retries with backoff, interceptors, timeouts/abort, page- & cursor-pagination, plus dependency-free query-string, URL/path, header-merge, form-body and typed-error helpers.
@lacspace/authAuthentication flows (login, register, token, refresh) for Lacspace APIs — now with PKCE/OIDC helpers, JWT expiry math, scope/role checks and proactive token refresh.
@lacspace/reactReact hooks and provider for the Lacspace SDK — useAuth, useQuery, useMutation, useAuthStatus and useLacspace, all sharing one authenticated client, over a pure DOM-free core (async state machine, retry/backoff, polling) you can unit-test anywhere.
@lacspace/sdkHigh-level TypeScript SDK for Lacspace — api, auth, analytics and e-commerce sharing one connection and token. Now with named environment presets, a config merger, correlation/idempotency ids, health probes, typed error normalization and transport-agnostic pagination.