Skip to main content
LlamaIndex.TS is designed to work seamlessly across all major JavaScript runtimes. This is achieved through runtime-specific entry points and the @llamaindex/env abstraction layer.

Supported Runtimes

Node.js

Full-featured support with filesystem access

Deno

Native ESM with secure permissions

Bun

Fast runtime with Node.js compatibility

Cloudflare Workers

Edge runtime with Workers API

Vercel Edge

Vercel Edge Runtime for serverless

Browser

Limited support for client-side use cases

Runtime-Specific Entry Points

The llamaindex package provides different entry points that are automatically selected based on your runtime:
package.json conditional exports
The correct entry point is automatically selected by your bundler or runtime based on export conditions.

Entry Point Mapping

Environment Abstraction Layer

The @llamaindex/env package provides a unified API across all runtimes:
@llamaindex/env exports
@llamaindex/env handles all runtime differences internally, so you can write runtime-agnostic code.

Runtime-Specific Examples

Node.js

Node.js provides the complete LlamaIndex.TS feature set:
Node.js with filesystem

Cloudflare Workers

src/index.ts
Cloudflare Workers has no filesystem access. Use in-memory data or external storage services.

Vercel Edge Runtime

app/api/chat/route.ts

Deno

Deno with import maps

Bun

Bun runtime

Runtime Capabilities

⚠️ = Limited support or requires specific configuration

Environment Variables

Node.js / Deno / Bun

.env
Load with dotenv

Cloudflare Workers

Use setEnvs helper

Vercel Edge Runtime

Edge Runtime env

Runtime Limitations

Limitations:
  • No file system access (use KV, R2, or D1 for storage)
  • No native Node.js modules
  • 1MB script size limit (use dynamic imports)
  • CPU time limits per request
Workarounds:
  • Use vectorStores with external services (Pinecone, Qdrant)
  • Dynamic imports to reduce initial bundle size
  • Stream responses for long-running operations
Limitations:
  • No file system access
  • Limited Node.js API compatibility
  • 1MB middleware size limit
  • Cold start considerations
Best Practices:
  • Use withLlamaIndex Next.js plugin
  • Leverage Vercel KV or external vector stores
  • Keep dependencies minimal
Limitations:
  • No file system access
  • CORS restrictions for API calls
  • Bundle size concerns
  • No native crypto APIs in older browsers
Use Cases:
  • Client-side chat interfaces
  • Browser-based document processing with FileReader API
  • WebAssembly embeddings (limited)

AsyncLocalStorage

LlamaIndex.TS uses AsyncLocalStorage for context-aware Settings:
Settings context isolation
AsyncLocalStorage is polyfilled for runtimes that don’t have native support.

Best Practices

Use Dynamic Imports

In edge runtimes, use dynamic imports to reduce bundle size:

Test Multiple Runtimes

Validate your code works across target runtimes in CI/CD

Handle Missing APIs

Check for API availability before using runtime-specific features

Optimize Bundle Size

Use sub-module imports and tree-shaking for edge deployments

Next Steps

Settings Configuration

Learn how to configure global settings for your runtime

Data Flow

Understand how data flows through the framework