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:Environment Variables
The SDK can be configured using environment variables:Your Wacht API key for authentication. This will be sent as a Bearer token.
The base URL of your Wacht frontend (e.g.,
https://your-app.wacht.io)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
Version Compatibility
| Package | Version | Node.js Version | TypeScript Version |
|---|---|---|---|
wacht-ts | 0.2.x | 18+ | 5.x |
wacht-middleware-node | 0.1.x | 18+ | 5.x |
wacht-middleware-hono | 0.1.x | 18+ | 5.x |
Verifying Installation
After adding the dependencies, verify the installation:Next Steps
Once installed, proceed to:- Quick Start - Get up and running quickly
- Configuration - Detailed configuration options
Troubleshooting
Common Issues
Error: WACHT_API_KEY must be set
Error: WACHT_API_KEY must be set
Ensure you’ve set the
WACHT_API_KEY environment variable before running your application:Cannot find module 'wacht-ts' or related middleware packages
Cannot find module 'wacht-ts' or related middleware packages
