Advanced / Advanced Overview.Mdx · guide
Advanced topics
Current Apexify.js 6.0.0 documentation for Advanced topics.
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
| Guide | Use it for |
|---|---|
| Runtime validation & resource governance | Complete current RenderLimits, network/cache/FFmpeg/temp defaults, validation behavior |
| Security deployment | SSRF/private network policy, untrusted uploads, credentials, FFmpeg/temp/plugin safety, cancellation |
| Performance & memory | Cache/reuse, raster memory, batch/concurrency, GIF/video/audio tuning, benchmark discipline |
| Migration to Apexify.js 6 | Node/modules/output/plugin/network/limit migration from older releases |
Composition model
Simple imperative flows are typically:
createCanvas()→CanvasResultsbase raster.createImage()/createText()/path2d.custom()/path2d.draw()→ new PNG buffers.save()for files, ortoOutput()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
| Chapter | Anchor |
|---|---|
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
| Engine | Role |
|---|---|
@napi-rs/canvas | Node raster canvas, paths, text rendering |
| Sharp | Image decode/processing/compression/palette and related raster work |
| FFmpeg / ffprobe | Optional 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
AsyncIterableframes 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.
| Chapter | Topic |
|---|---|
| Video pipeline | Declarative trim/splice/text/audio/synth layer stack |
| Render scene to video | renderSceneToVideoFrames() |
| Video feature guide | One-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.
| Chapter | Topic |
|---|---|
createAudio | Presets, synth, sequence, compose, mix, save |
| Video audio operations | Mux/mix/normalize audio in FFmpeg video workflows |
| Video pipeline | Declarative 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:
- current package runtime/exports/declarations and packed consumer tests;
- API reference;
- current feature/advanced guides;
- internals/changelog only as historical context.