Skip to content

khulnasoft/runtime-edge

Repository files navigation

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

Build Status NPM Version License: MIT Documentation Contributors


DocumentationCLIIssuesWebsite


🚀 Overview

Edge Runtime 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 Edge Runtime 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 Edge Runtime

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 Edge Runtime configuration
  port: 3000,
  handler: async (request) => {
    return new Response('Hello from Edge Runtime!')
  },
})

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 Edge Runtime
@runtime-edge/jest-environment v4.0.0 Jest testing environment for Edge Runtime
@runtime-edge/jest-expect v4.0.0 Custom Jest matchers for Edge Runtime testing
@runtime-edge/ponyfill v4.0.0 Polyfills and compatibility layers
@runtime-edge/types v4.0.0 TypeScript type definitions

🏗️ Architecture

Edge Runtime 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

Edge Runtime © 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

About

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 8