Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

@replanejs/sdk Examples

Examples demonstrating how to use @replanejs/sdk across different JavaScript runtimes.

Runtime Examples

Runtime Directory Description
Node.js node/ Server-side Node.js with TypeScript
Bun bun/ Native TypeScript execution with Bun
Deno deno/ Secure runtime with Deno
Browser browser/ Client-side browser app with Vite

Framework SDKs

For React, Next.js, and Svelte applications, use the dedicated framework SDKs which provide hooks, context providers, and SSR support:

Framework Package Examples GitHub README
React @replanejs/react packages/react/examples/ README
Next.js @replanejs/next packages/next/examples/ README
Svelte @replanejs/svelte packages/svelte/examples/ README

Quick Start

Each example includes its own README with specific instructions. Generally:

Node.js

cd node
npm install
REPLANE_SDK_KEY=your-key REPLANE_BASE_URL=https://replane.example.com npm start

Bun

cd bun
bun install
REPLANE_SDK_KEY=your-key REPLANE_BASE_URL=https://replane.example.com bun start

Deno

cd deno
REPLANE_SDK_KEY=your-key REPLANE_BASE_URL=https://replane.example.com deno task start

Browser

cd browser
npm install
# Create .env file with VITE_REPLANE_SDK_KEY and VITE_REPLANE_BASE_URL
npm run dev

Features Demonstrated

All examples show:

  • Creating a type-safe Replane client
  • Getting config values with TypeScript inference
  • Using context for user-specific config evaluation
  • Subscribing to real-time config updates via SSE
  • Graceful shutdown/cleanup handling
  • Default values for offline/error scenarios