Skip to content
Apexify.jsDocs
Apexify.js version v5.4.5

Advanced / Advanced Overview.Mdx · guide

Advanced topics

Current Apexify.js 6.0.0 documentation for Advanced topics.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

Advanced covers cross-cutting behavior and production concerns: composition, resource governance, security, performance, migration, video, and audio. Full per-feature option matrices remain in Feature guides; exact public names/signatures belong in the API reference.


Production/runtime guides

GuideUse it for
Runtime validation & resource governanceComplete current RenderLimits, network/cache/FFmpeg/temp defaults, validation behavior
Security deploymentSSRF/private network policy, untrusted uploads, credentials, FFmpeg/temp/plugin safety, cancellation
Performance & memoryCache/reuse, raster memory, batch/concurrency, GIF/video/audio tuning, benchmark discipline
Migration to Apexify.js 6Node/modules/output/plugin/network/limit migration from older releases

Composition model

Simple imperative flows are typically:

  1. createCanvas() → CanvasResults base raster.
  2. createImage() / createText() / path2d.custom() / path2d.draw() → new PNG buffers.
  3. save() for files, or toOutput() for explicit constructor-selected encoded output.

outPut() remains only as a deprecated compatibility alias for toOutput().

For declarative multi-layer stacks (charts, nested surfaces, one-shot PNG/GIF/video), use Scene overview with createScene, renderScene, renderSceneToGIF, and renderSceneToVideoFrames.

For reusable composition, use Composition hub: templates, named assets, built-in scene-layer components, plugins, and explicit $asset resolution rules.


Composition · templates · assets · components

ChapterAnchor
Named assets (painter.assets, prepareForRender)Named assets
Templates (createTemplate, toRenderInput)Templates
Preset layer factories (painter.components)Preset components
Plugins (painter.plugins, await painter.use)Plugins
Imperative / SceneBuilder.render / batch / chain + $Imperative & batch

Template/component output is ordinary SceneLayer[]; final scene rendering remains subject to mandatory validation and resource limits.


Engines you touch indirectly

EngineRole
@napi-rs/canvasNode raster canvas, paths, text rendering
SharpImage decode/processing/compression/palette and related raster work
FFmpeg / ffprobeOptional system dependency for video/media probing/transcoding

These are current Node implementation dependencies. They do not imply the future Phase 15+ package architecture is already shipped.


Performance intuition

  • createImage() filters and transforms can be native/raster intensive; dimensions dominate memory/cost.
  • pixels.getData() / pixels.manipulate() are appropriate for explicit pixel work but scale with touched pixels.
  • batch() runs independent jobs with bounded concurrency; chain() runs sequentially and feeds output forward.
  • scenes/templates can avoid awkward repeated imperative composition; nested surfaces composite directly rather than requiring a PNG encode/decode boundary at each nesting level.
  • generated GIF AsyncIterable frames preserve producer backpressure rather than collecting all generated frames first.
  • remote video is staged by streaming into isolated temporary files.

Use Performance & memory before increasing concurrency or resource ceilings.


Video — editor pipelines

Start with Video (advanced) hub to choose videoPipeline() vs createVideo() vs Scene export.

ChapterTopic
Video pipelineDeclarative trim/splice/text/audio/synth layer stack
Render scene to videorenderSceneToVideoFrames()
Video feature guideOne-shot video/FFmpeg operations

FFmpeg/ffprobe are required only for video/FFmpeg functionality and run under the central process/network/temp/resource policy.


Audio — procedural SFX

Start with Audio (advanced) hub.

ChapterTopic
createAudioPresets, synth, sequence, compose, mix, save
Video audio operationsMux/mix/normalize audio in FFmpeg video workflows
Video pipelineDeclarative audio/synth layers

Procedural audio is bounded by duration/sample-rate/channel/event/layer/partial and peak working-memory limits; see Runtime governance.


Source-of-truth rule

Historical pages and old examples are not allowed to override current 6.0 runtime/export behavior. For the current contract use:

  1. current package runtime/exports/declarations and packed consumer tests;
  2. API reference;
  3. current feature/advanced guides;
  4. internals/changelog only as historical context.

Next steps