open-index/open-npm huggingface dataset:
npm package: @og-engine/adapter-cloudflare
Description: Cloudflare platform adapter primitives for `og-engine`.
Latest version: 0.1.0

# @og-engine/adapter-cloudflare

Cloudflare platform adapter primitives for `og-engine`.

This package provides:
- R2 storage adapter (`cloudflareStorage`)
- KV cache adapter (`cloudflareCache`)
- in-memory template registry helper (`cloudflareRegistry`)
- composed adapter factory (`cloudflareAdapter`)

## Installation

```bash
pnpm add @og-engine/adapter-cloudflare @og-engine/core @og-engine/types
```

## Usage

```ts
import { cloudflareAdapter, cloudflareRegistry } from '@og-engine/adapter-cloudflare';
import { createHandler } from '@og-engine/core';
import type { OGTemplate } from '@og-engine/types';

const templates: OGTemplate[] = [/* your templates */];

const platform = cloudflareAdapter({
  KV: env.KV,
  BUCKET: env.BUCKET,
  PUBLIC_BASE_URL: env.PUBLIC_BASE_URL,
  registry: cloudflareRegistry(templates)
});

const handler = createHandler({ platform });
```

## Exports

- `cloudflareStorage(bucket, publicBaseUrl)`
- `cloudflareCache(kv)`
- `cloudflareRegistry(templates)`
- `cloudflareAdapter(bindings)`
npm package: @og-engine/adapter-node
Description: Node.js platform adapter primitives for `og-engine`.
Latest version: 0.1.0

# @og-engine/adapter-node

Node.js platform adapter primitives for `og-engine`.

This package provides:
- filesystem storage (`fileSystemStorage`)
- in-memory cache (`memoryCache`)
- in-memory template registry helper (`staticRegistry`)
- composed adapter factory (`nodeAdapter`)

## Installation

```bash
pnpm add @og-engine/adapter-node @og-engine/core @og-engine/types
```

## Usage

```ts
import { nodeAdapter, staticRegistry } from '@og-engine/adapter-node';
import { createHandler } from '@og-engine/core';
import type { OGTemplate } from '@og-engine/types';

const templates: OGTemplate[] = [/* your templates */];

const platform = nodeAdapter({
  storageDir: './.og-cache',
  baseUrl: 'http://localhost:3000',
  registry: staticRegistry(templates)
});

const handler = createHandler({ platform });
```

## Exports

- `fileSystemStorage(dir, baseUrl)`
- `memoryCache()`
- `staticRegistry(templates)`
- `nodeAdapter(options)`
npm package: @og-engine/core
Description: Core rendering and request handling primitives for `og-engine`. This package converts typed template inputs into rendered OG images, generates metadata payloads, and coordinates storage/cache behavior via adapter interfaces.
Latest version: 0.1.0

# @og-engine/core

Core rendering and request handling primitives for `og-engine`. This package converts typed template inputs into rendered OG images, generates metadata payloads, and coordinates storage/cache behavior via adapter interfaces.

## Installation

```bash
pnpm add @og-engine/core
```

## Basic usage

```ts
import { createHandler } from '@og-engine/core';
import type { PlatformAdapter } from '@og-engine/types';

const platform: PlatformAdapter = {
  storage: /* your storage adapter */,
  cache: /* your cache adapter */,
  registry: /* your template registry */
};

const handler = createHandler({ platform });
const image = await handler.handleImageRequest({
  template: 'sunset',
  size: 'og',
  params: { title: 'Hello' }
});
```

## API reference

- `createHandler(deps)`: creates image/meta handlers.
- `render(req, template, fonts)`: runs the render pipeline.
- `coerceParams(raw, schema)`: validates/coerces raw params.
- `buildCacheKey(req, templateVersion)`: deterministic cache key generator.
- `getDefaultFonts()`, `loadFont(name, url)`: font loading helpers.
- `initWasm()`, `getResvg()`: runtime WASM/bootstrap helpers.

## Used by

- `@og-engine/adapter-node`
- `@og-engine/adapter-cloudflare`
- `@og-engine/adapter-vercel`
- `apps/web`
- `apps/worker-cf`
- `apps/server-node`
npm package: @og-engine/sdk
Description: Zero-dependency SDK for `og-engine`. Provides lightweight utilities for building OG image URLs and metadata URLs for use in frontends (Next.js, Astro, Remix, etc.) or backends.
Latest version: 0.1.0

# @og-engine/sdk

Zero-dependency SDK for `og-engine`. Provides lightweight utilities for building OG image URLs and metadata URLs for use in frontends (Next.js, Astro, Remix, etc.) or backends.

## Installation

```bash
pnpm add @og-engine/sdk
```

## Basic usage

### 1. Build an OG image URL

```ts
import { buildOgUrl } from '@og-engine/sdk';

const url = buildOgUrl({
  baseUrl: 'https://og.example.com',
  template: 'sunset',
  params: {
    title: 'Hello from SDK',
    author: 'og-engine'
  }
});
// → 'https://og.example.com/api/og?template=sunset&size=og&format=png&title=Hello+from+SDK&author=og-engine'
```

### 2. Build metadata URL (for og:image tags)

```ts
import { buildMetaUrl } from '@og-engine/sdk';

const url = buildMetaUrl({
  baseUrl: 'https://og.example.com',
  template: 'minimal',
  params: { title: 'Pricing' }
});
// → 'https://og.example.com/api/meta?template=minimal&size=og&format=json&title=Pricing'
```

## API reference

### `buildOgUrl(options)`
Builds a fully qualified `og-engine` image URL.
- `options.baseUrl`: Base URL of the hosted engine.
- `options.template`: Template ID.
- `options.size`: Platform size preset (default: 'og').
- `options.format`: Output format (default: 'png').
- `options.params`: Key-value map of template-specific parameters.

### `buildMetaUrl(options)`
Builds a fully qualified `og-engine` metadata URL.
- `options.baseUrl`: Base URL of the hosted engine.
- `options.template`: Template ID.
- `options.size`: Platform size preset (default: 'og').
- `options.format`: Metadata response format ('json' or 'html', default: 'json').
- `options.params`: Key-value map of template-specific parameters.

## Dependencies

This package has **zero** external dependencies and can run in any JavaScript environment (Browser, Node.js, Edge, Deno).
npm package: @og-engine/types
Description: Shared TypeScript contracts for `og-engine` packages. This package contains strongly-typed interfaces and utility types for template definitions, render requests, platform adapters, and metadata responses used by core and adapter packages.
Latest version: 0.1.0

# @og-engine/types

Shared TypeScript contracts for `og-engine` packages. This package contains strongly-typed interfaces and utility types for template definitions, render requests, platform adapters, and metadata responses used by core and adapter packages.

## Installation

```bash
pnpm add @og-engine/types
```

## Basic usage

```ts
import type { OGTemplate, PlatformSize, TemplateSchema } from '@og-engine/types';

const schema = {
  title: { type: 'string', required: true, maxLength: 120 }
} satisfies TemplateSchema;

const template: OGTemplate<typeof schema> = {
  id: 'example',
  name: 'Example',
  description: 'Example template',
  author: 'og-engine',
  version: '1.0.0',
  supportedSizes: ['og' satisfies PlatformSize],
  schema,
  render: ({ title }) => <div>{title}</div>
};
```

## API reference

- `PLATFORM_SIZES`: canonical size map for supported social platforms.
- `PlatformSize`: union of supported size keys.
- `TemplateSchema`, `SchemaFieldType`, `InferParams`: schema/typing helpers for templates.
- `OGTemplate`, `TemplateMetadata`, `RenderContext`: template contracts.
- `StorageAdapter`, `CacheAdapter`, `TemplateRegistryAdapter`, `PlatformAdapter`: integration interfaces.
- `OGRequest`, `MetaRequest`, `MetaResponse`: request/response payload types.

## Used by

- `@og-engine/core`
- `@og-engine/adapter-node`
- `@og-engine/adapter-cloudflare`
- `@og-engine/adapter-vercel`
- template packages under `templates/*`
- apps under `apps/*`