Deno
Installation
Deno uses npm specifiers to import packages directly:deno.json
Runtime Detection
The SDK automatically uses the Deno-optimized build via conditional exports:Basic Usage
main.ts
Environment Variables
Deno usesDeno.env to access environment variables:
.env file with the --env flag:
.env
Permissions
Deno requires explicit permissions. The WorkOS SDK needs:--allow-net: For making HTTP requests to WorkOS API--allow-env: For reading environment variables
Deno Deploy
The SDK works seamlessly with Deno Deploy:main.ts
Fresh Framework
Using WorkOS in a Fresh application:routes/api/users.ts
Testing with Deno
main_test.ts
Bun
Installation
Bun has a fast npm-compatible package manager:Runtime Detection
The SDK automatically uses the Bun-optimized build:Basic Usage
Environment Variables
Bun automatically loads.env files:
.env
Bun.env:
Bun HTTP Server
server.ts
Elysia Framework
app.ts
Hono Framework
app.ts
Testing with Bun
Bun has a built-in test runner:workos.test.ts
Performance Benefits
Bun is significantly faster than Node.js for many operations:Faster Package Installation
Faster Package Installation
Bun’s package manager is 10-100x faster than npm:
Faster Startup Time
Faster Startup Time
Bun starts TypeScript files directly without transpilation:
Faster HTTP Requests
Faster HTTP Requests
Bun’s native
fetch implementation is optimized for performance.Runtime Comparison
Node.js
- Most mature ecosystem
- Largest package compatibility
- Industry standard
- Slower startup and execution
Deno
- Secure by default (permissions)
- Native TypeScript support
- Built-in tooling
- Web Standards API
Bun
- Fastest performance
- Built-in TypeScript
- npm compatibility
- Fast package manager
Ecosystem Testing
The WorkOS SDK includes automated runtime compatibility tests:Troubleshooting
Deno: Permission Denied
Deno: Permission Denied
Ensure you grant the necessary permissions:
Deno: Module Not Found
Deno: Module Not Found
Use the
npm: specifier for npm packages:Bun: TypeScript Errors
Bun: TypeScript Errors
Bun supports TypeScript natively. Ensure your
tsconfig.json is compatible:tsconfig.json
Bun: Module Resolution
Bun: Module Resolution
Bun uses its own module resolution algorithm. If you encounter issues, try:
Next Steps
Node.js Runtime
Learn about Node.js-specific features
Edge Workers
Deploy to Cloudflare Workers or Vercel Edge
User Management
Manage users and authentication
Webhooks
Handle WorkOS webhook events