Skip to content

Repository files navigation

Runtime Edge
⚡️ Runtime Edge - Modern Runtime Infrastructure for the Web Platform ⚡️

Build Status NPM Version License: MIT Documentation Contributors


DocumentationCLIIssuesWebsite


🚀 Overview

Runtime Edge is a high-performance, standards-compliant runtime environment for modern web applications. Built by KhulnaSoft, it provides a complete implementation of Web APIs that run seamlessly across edge networks, serverless platforms, and traditional server environments.

The runtime enables developers to write once and deploy anywhere, with full compatibility for:

  • Web Standards APIs (Fetch, Streams, Web Crypto, URL, etc.)
  • Edge Computing (Cloudflare Workers, Vercel Edge Functions, Deno Deploy)
  • Server Environments (Node.js, Bun, traditional servers)
  • Testing & Development (Jest, Vitest, local development)

🧩 Core Features

Component Description
⚙️ Web Standards API Complete implementation of Fetch, Streams, Web Crypto, and more
🌍 Edge-Native Optimized for edge computing with minimal cold starts
🔧 Modular Primitives Composable building blocks for custom runtime environments
🧠 VM Context Secure execution environment for untrusted code
🍪 Cookie Management Standards-compliant cookie handling for web applications
🔍 Request/Response Full-featured HTTP handling with Web API compatibility
📝 String Formatting printf-style formatting utilities for logging and debugging
🧪 Testing Tools Jest environment and matchers for comprehensive testing

🧰 Quick Start

# Install the Runtime Edge CLI globally
npm install -g runtime-edge

# Or add to your project
npm install runtime-edge

# Development
runtime-edge dev                    # Start development server
runtime-edge build                  # Build for production

# Testing
runtime-edge test                   # Run tests in Runtime Edge

Basic Usage:

import { EdgeRuntime } from 'runtime-edge'

// Create runtime instance
const runtime = new EdgeRuntime()

// Execute Edge Functions
const result = await runtime.evaluate(`
  // Web APIs available: fetch, Request, Response, URL, etc.
  const response = await fetch('https://api.example.com/data')
  return await response.json()
`)

console.log(result)

With Custom Server:

import { createServer } from 'runtime-edge'

const server = createServer({
  // Your Runtime Edge configuration
  port: 3000,
  handler: async (request) => {
    return new Response('Hello from Runtime Edge!')
  },
})

server.start()

🌐 Package Ecosystem

Package Version Description
runtime-edge v4.0.0 Main runtime package with CLI and server functionality
@runtime-edge/primitives v4.0.0 Core Web API primitives (Fetch, Streams, Crypto, etc.)
@runtime-edge/vm v4.0.0 Secure VM for code execution in Web Standard contexts
@runtime-edge/format v4.0.0 printf-style string formatting utilities
@runtime-edge/cookies v4.0.0 Standards-compliant cookie management
@runtime-edge/user-agent v4.0.0 User agent parsing for Runtime Edge
@runtime-edge/jest-environment v4.0.0 Jest testing environment for Runtime Edge
@runtime-edge/jest-expect v4.0.0 Custom Jest matchers for Runtime Edge testing
@runtime-edge/ponyfill v4.0.0 Polyfills and compatibility layers
@runtime-edge/types v4.0.0 TypeScript type definitions

🏗️ Architecture

Runtime Edge is built as a modular monorepo with the following structure:

packages/
├── runtime/           # Main CLI and server runtime
├── primitives/        # Core Web API implementations
├── vm/               # Secure execution environment
├── format/           # String formatting utilities
├── cookies/          # Cookie management
├── user-agent/       # User agent parsing
├── jest-environment/ # Testing infrastructure
├── ponyfill/         # Polyfills and compatibility
└── integration-tests/ # Test utilities

Each package is independently versioned and published to npm, allowing for flexible dependency management while maintaining API compatibility.


🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

# Clone the repository
git clone https://github.com/khulnasoft/runtime-edge.git
cd runtime-edge

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build all packages
pnpm build

# Start development
pnpm dev

🧑‍🤝‍🧑 Contributors

Thanks to all our amazing contributors! 💜


📄 License

Runtime Edge © KhulnaSoft — released under the MIT License. Authored and maintained by KhulnaSoft with help from our community contributors.


KhulnaSoft Website GitHub Twitter


🪄 What's New in v4.0.0

Complete Web Standards Compliance - Full implementation of Fetch, Streams, Web Crypto, URL APIs
Modular Architecture - Independent packages for flexible usage and dependency management
Enhanced Performance - Optimized for edge computing with minimal cold starts
Developer Experience - CLI tools, comprehensive testing utilities, and detailed documentation
TypeScript First - Full type safety across all packages with strict typing
Standards Compliant - Passes Web Platform Tests (WPT) compatibility suite
Production Ready - Used in production by thousands of developers
Buffer/SharedArrayBuffer Fixes - Resolved compatibility issues across all platforms
Turborepo Migration - Updated to v2.0+ configuration for better build performance
License Standardization - Migrated all packages to MIT license for better compatibility

Releases

Packages

Used by

Contributors

Languages