@ogify/core library. These types provide full type safety when creating templates and configuring renderers.
Core Types
OgTemplateParams
Base type for template parameters. All template parameter types should extend this.- Strings: Text content (titles, descriptions, names)
- String Arrays: Lists of tags, categories
- Numbers: Counts, dates, metrics
- Booleans: Flags, toggles, states
OgTemplate
Complete definition of an Open Graph image template. A template is a reusable blueprint for generating OG images.Function that generates the template output. Receives
OgTemplateOptions & { params: TParams } and can return:ReactNode— JSX element tree passed directly to Satori (recommended)string— HTML string parsed withsatori-htmlbefore SatoriPromiseof either — async renderers are fully supported
See Rendering Pipeline for details.
Satori does not support
dangerouslySetInnerHTML. For inline styled text in
JSX templates, use htmlSnippet to parse
trusted HTML fragments into Satori-compatible flex word containers.Custom fonts to use in this template. Must be a non-empty array —
validateTemplate
throws at registration time if fonts is missing.Optional emoji provider to use in this template. If not specified, defaults to
'noto'.OgTemplateRenderer
Configuration for the TemplateRenderer class. Defines available templates, global defaults, and lifecycle hooks.Map of template definitions to register, keyed by template ID
Shared parameter values applied to all templates. These values are merged with
user-provided parameters, with user values taking precedence.
Cache configuration for fonts and icons. When provided, enables LRU caching to
improve performance by reducing redundant network requests.
Hook called before rendering. Useful for logging, analytics, parameter
validation, authentication checks, and rate limiting.
Hook called after rendering. Useful for caching generated images, cleanup
operations, sending notifications, and updating metrics.
Font Configuration
OgFontConfig
Configuration for a font used in OG image templates. Fonts can be loaded from three sources (in priority order):- Pre-loaded binary data (via
dataproperty) - Remote URL (via
urlproperty) - Google Fonts API (automatic detection based on
name)
The font family name (e.g., ‘Inter’, ‘Roboto’, ‘Merriweather’)
Font weight (100-900)
Font style
URL to the font file (for custom/self-hosted fonts)
Pre-loaded font binary data
Font file format
OgFontFormat
Supported font file formats.woff: Web Open Font Format (modern, compressed)ttf: TrueType Font (legacy, larger file size)
Template Options
OgTemplateOptions
Props passed to the templaterenderer function, merged with params. Also available as options in renderToImage.
width/height values. The scale option only affects Resvg rasterization — not Satori layout. See Scale & Supersampling.
Custom fonts to use in this template
Optional emoji provider to use in this template
Optional custom width in pixels. Templates always receive the original
width/height values — scale is applied at the rasterisation step.Optional custom height in pixels
Enable Right-to-Left text direction
Supersampling scale factor for higher-quality PNG output. Satori renders the
SVG at the original
width × height; Resvg then rasterises it at
width × scale pixels wide.Constraints:
- Float values are supported (
1.25,1.5, etc.) - Values below
1are clamped to1 - Values above
4are clamped to4(prevents OOM) - Output PNG file size increases proportionally to
scale²
Emoji Providers
OgEmojiProvider
Supported emoji providers for rendering emoji characters in OG images. Each provider offers a different visual style.twemoji
twemoji
Twitter’s emoji set - colorful, rounded style
fluent
fluent
Microsoft’s Fluent emoji - 3D style with color
fluentFlat
fluentFlat
Microsoft’s Fluent emoji - flat 2D style
noto
noto
Google’s Noto Color Emoji - current standard (default)
blobmoji
blobmoji
Google’s blob-style emoji - deprecated but still available
openmoji
openmoji
Open-source emoji with outlined style
Utility Types
OgTemplateRenderResult
Return type of a templaterenderer function.
ReactNode— passed directly to Satori (JSX templates)string— parsed withsatori-html, then passed to Satori
HtmlSnippetOptions
Options forhtmlSnippet word-container layout.
Flex main-axis alignment for the word container.
Gap between word items in pixels. Overrides the font-size-derived default.
Font size in pixels. Used to derive gap when
gap is omitted (~29% of font size).