# Code Deb OG Factory SDK

**Target release:** `@codedeb/og-factory@0.1.0` passed isolated ESM installation and TypeScript checks. Its public npm publication has not been independently verified; check the registry before installation.

Open Graph image generation — intended for developers building reliable storefronts, search infrastructure and production applications. Unlike a hosted platform, the SDK does not require a Code Deb account for its pure functions.

## Build, test and stage

```bash
npm ci
npm run test:nepal-sdks
npm run sdk:pack:verify
node scripts/sdk/stage-npm-package.mjs sdk-og-factory
```

These commands prepare the candidate without publishing it. Review the generated `.sdk-artifacts/npm-stage/sdk-og-factory` contents and all licenses. After a successful, independently verified npm release, the installation command will be `npm install @codedeb/og-factory`. Do not advertise this command as publicly working before release verification.

## Quickstart using implemented exports

```ts
import {renderOgSvg} from '@codedeb/og-factory';
const svg=renderOgSvg({title:'Premium Nepal tea',subtitle:'Single-estate products',brand:'Code Deb',template:'editorial'});
console.log(svg);
```

## Public API contract

| Entry point or function | Responsibility |
| --- | --- |
| `renderOgSvg(spec)` | Pure, HTML-escaped SVG with constrained dimensions, templates and colors |
| `wrapOgText(text)` | Bounded title wrapping and deliberate overflow rejection |
| `renderOgPng(spec)` | Optional Sharp-based PNG on trusted Node.js runtimes |

## Production integration

Use only verified fonts and colors. Test titles across languages and devices; the SVG is deterministic but not a substitute for branded design review. PNG requires installing the optional sharp peer dependency. Do not fetch untrusted remote SVG or CSS.

The published SDK must have bounded resource use, correct authentication boundaries where applicable, and tests for malformed input. Caller-owned storage, OAuth, background jobs or hosted services must be configured explicitly rather than invented by the library.

## Compatibility and release history

- **0.1.0 candidate — 21 November 2026:** First implementation of the documented independent module, subject to the complete release gate.
- JavaScript ESM with generated TypeScript declarations; Node.js 20+ for Node execution.
- No npm publication, hosted API, SLA, vendor certification, ranking guarantee or customer data access is implied by this candidate.
- Code Deb-owned package code is intended for Apache-2.0 distribution. Third-party dependencies, data and trademarks retain their own terms.

## References and related SDKs

- [Developer SDK index](/docs/sdk)
- [Code Deb Developer resources](/docs/resources)
- [Reference standards and vendor documentation](https://ogp.me/)




## Integration design walkthrough

1. Escape untrusted titles and brand strings before generating an SVG.
2. Enforce a deterministic canvas and line-width budget for multilingual text.
3. Render PNG only in a trusted Node worker using the optional Sharp integration.
4. Store generated assets on a caller-owned CDN and use their actual URLs in page metadata.

## Release verification and package installation

```bash
npm view @codedeb/og-factory@0.1.0 version
# Only after the registry returns this exact version:
npm install @codedeb/og-factory@0.1.0
```

Never confuse a passing local package/TypeScript test with accepted npm publication. The npm registry must expose version metadata, the expected `latest` dist-tag and a retrievable tarball before the release is announced as installable. The source repository and customer integrations remain private.

## Production acceptance checklist

- Exercise normal, empty and malformed input using the documented ESM exports.
- Compare results with source HTML or authorized external API evidence, not generated placeholder data.
- Implement explicit failure handling, timeouts and limits in any caller-owned network adapter.
- Record meaningful audit findings and version-specific regressions without claiming search rankings or Google approval.

## Common problems

**Version not found:** Confirm the package's exact version on [npm](https://www.npmjs.com/package/@codedeb/og-factory); its release may still be pending. **Unexpected findings:** Compare real captured HTML and HTTP status with your audit inputs. **Third-party integration fails:** Verify your own OAuth, hosting, robots compliance and network policies; the SDK never grants external access.

## Related guides

[seo](/docs/sdk/seo) · [render diff](/docs/sdk/render-diff) · [All developer SDKs](/docs/sdk) · [Engineering resources](/docs/resources)
