@liteguard/liteguard
v0.6.20260405
Published
Liteguard SDK. Feature guards, observability, and security response in a single import. Resolves to the Node.js or browser runtime automatically.
Maintainers
Readme
@liteguard/liteguard
- Website: liteguard.io
- Project Page: https://github.com/liteguard/liteguard
- Issues: https://github.com/liteguard/liteguard/issues/new
Umbrella package for the Liteguard JavaScript SDK.
Installation
npm install @liteguard/liteguardQuick Start
import { LiteguardClient } from "@liteguard/liteguard";
const client = new LiteguardClient("pct-...", {
environment: "env-production",
});
await client.start();
const scope = client.createScope({ userId: "user-123", plan: "pro" });
if (scope.isOpen("payments.checkout")) {
// ...
}
await client.shutdown();Packages
| Package | Use when |
|---|---|
| @liteguard/liteguard | You want automatic runtime resolution |
| @liteguard/liteguard-node | Node.js servers, workers, CLIs |
| @liteguard/liteguard-browser | Browser applications |
| @liteguard/liteguard-react | React components and hooks |
Primary API
This package exposes the same explicit-client API as the runtime-specific packages:
new LiteguardClient(projectClientToken, options)creates a client.await client.start()fetches the initial bundle and starts refresh and flush workers.client.createScope()scope.isOpen()scope.evaluate()returns aGuardDecisionwith the full evaluation result.scope.executeIfOpen()/scope.executeIfOpenAsync()scope.startExecution()creates an execution correlation handle.scope.withProperties()/scope.withProtectedContext()scope.getProperties()returns the current property bag for transport.client.flush()client.shutdown()
License
Apache 2.0 see LICENSE.
