Package Installation
Install the Sylphx Platform SDK using your preferred package manager:
npm install @sylphx/sdkRequirements
Node.js 18+
Server runtime environment
React 18+
For React hooks and components
Next.js 13.4+
For middleware and server features
TypeScript
Full type definitions included
Type Safety
All SDK methods are fully typed. Your IDE will provide autocomplete and type checking out of the box.
Framework Entry Points
The SDK provides framework-specific entry points for optimal tree-shaking:
Next.js App Router
// Server Components + middleware
import { auth, currentUser, createSylphxMiddleware } from '@sylphx/sdk/nextjs'
// Client components
import { useUser, SignIn, UserButton, SylphxProvider } from '@sylphx/sdk/react'
// Server utilities (JWT verification, webhooks)
import { verifyAccessToken, verifyWebhook, getAppConfig } from '@sylphx/sdk/server'React (Vite, Remix, etc.)
import { SylphxProvider, useUser, useAuth, SignIn } from '@sylphx/sdk/react'Node.js / Server
import { createConfig, signIn, track } from '@sylphx/sdk'
import { createServerClient, verifyWebhook } from '@sylphx/sdk/server'Web Analytics (lightweight, no SDK required)
// Drop-in script tag or ES module — zero config, auto-tracks pageviews
import { init, track } from '@sylphx/sdk/web-analytics'
init({ publicKey: 'pk_prod_...' })
track('button_clicked', { label: 'Get Started' })Entry Points Reference
| Property | Type | Description |
|---|---|---|
@sylphx/sdk | Universal | All pure BaaS functions — auth, analytics, KV, AI, billing, etc. No peer dependencies. |
@sylphx/sdk/react | Client | React hooks, components (SignIn, UserButton), SylphxProvider. Peer: react, react-dom. |
@sylphx/sdk/server | Server | JWT verification, webhook validation, getAppConfig, createServerClient. Peer: jose. |
@sylphx/sdk/nextjs | Next.js | Middleware, auth(), currentUser(), session cookies. Peer: next. |
@sylphx/sdk/web-analytics | Browser | Lightweight drop-in analytics script. Zero config, auto-tracks pageviews. |
Peer Dependencies
Some features require additional peer dependencies:
| Property | Type | Description |
|---|---|---|
React Hooks | react >= 18.0 | Required for useUser, useAuth, and other hooks |
Next.js Integration | next >= 13.4 | Required for middleware and server functions |