Skip to main content

Installation

2 min

Install the Sylphx Platform SDK in your project using your preferred package manager.

Package Installation

Install the Sylphx Platform SDK using your preferred package manager:

npm install @sylphx/sdk

Requirements

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

PropertyTypeDescription
@sylphx/sdkUniversalAll pure BaaS functions — auth, analytics, KV, AI, billing, etc. No peer dependencies.
@sylphx/sdk/reactClientReact hooks, components (SignIn, UserButton), SylphxProvider. Peer: react, react-dom.
@sylphx/sdk/serverServerJWT verification, webhook validation, getAppConfig, createServerClient. Peer: jose.
@sylphx/sdk/nextjsNext.jsMiddleware, auth(), currentUser(), session cookies. Peer: next.
@sylphx/sdk/web-analyticsBrowserLightweight drop-in analytics script. Zero config, auto-tracks pageviews.

Peer Dependencies

Some features require additional peer dependencies:

PropertyTypeDescription
React Hooksreact >= 18.0Required for useUser, useAuth, and other hooks
Next.js Integrationnext >= 13.4Required for middleware and server functions