Requirements

Before installing the Wacht TypeScript SDK, ensure you have:
  • Node.js 18+ - The SDK requires a recent version of Node.js
  • pnpm 8+ - Recommended package manager
  • Valid Wacht API Key - Required for authentication

Adding the Dependency

Add the main SDK package and the relevant middleware package to your project:
pnpm add wacht-ts
# For Node.js (Express-style) applications
pnpm add wacht-middleware-node
# For Hono applications
pnpm add wacht-middleware-hono

Environment Variables

The SDK can be configured using environment variables:
WACHT_API_KEY
string
required
Your Wacht API key for authentication. This will be sent as a Bearer token.
WACHT_FRONTEND_HOST
string
required
The base URL of your Wacht frontend (e.g., https://your-app.wacht.io)
WACHT_PUBLIC_SIGNING_KEY
string
Optional PEM-encoded public key for JWT verification. If not provided, the SDK will fetch it automatically from the /.well-known/jwk endpoint.

Setting Environment Variables

WACHT_API_KEY=your-api-key-here
WACHT_FRONTEND_HOST=https://your-app.wacht.io

Version Compatibility

PackageVersionNode.js VersionTypeScript Version
wacht-ts0.2.x18+5.x
wacht-middleware-node0.1.x18+5.x
wacht-middleware-hono0.1.x18+5.x

Verifying Installation

After adding the dependencies, verify the installation:
pnpm install
pnpm recursive run build

Next Steps

Once installed, proceed to:

Troubleshooting

Common Issues