SYSTEM DESIGN / CURRENT SHAPE

Fast where
it matters.

A fast Go CSS engine behind a PostCSS-compatible JavaScript surface. The Go core owns the hot path; Node and browser packages own ecosystem integration.

Go owns the data path Parse, AST mutation, plugin visitors, stringify, warnings, and source maps run in the native engine.

A narrow native boundary Node uses a compact binary AST over Node-API; WASM keeps its Worker message contract.

JavaScript owns the ecosystem surface Config, plugins, and PostCSS-shaped results stay in Node; Go also owns the parse-free no-work map path.

CSS Tokenizer
Parser AST
Plugin visitors Mutation
Stringifier CSS + source map
02 / SYSTEM MAP

Package boundaries

Each layer owns one part of the runtime contract, keeping the native engine independent from host-specific integration.

LayerResponsibility
Go engineParse, AST mutation, plugin visitors, stringify, warnings, and source maps.
Node serviceNative addon loading, Node-API async work, synchronous calls, option normalization, and result handling.
JavaScript compatibilityConfig, JS plugins, message combining, and PostCSS-shaped results. Map options are normalized in @postcss-go/shared; Go owns map generation, previous maps, and annotations.
WASM serviceSame service contract as Node, via a Worker and Go WASM.
03 / RUNTIME PATH

Hybrid request flow

JavaScript owns config, plugins, and PostCSS-shaped results. One request crosses the bridge into Go for parse, AST work, and stringify, then returns with CSS, map, messages, and AST.

01 Host runtime CLI · Node · WASM · plugins
request
02 Node-API boundary binary AST · options · errors
dispatch
03 Go processor parse → mutate → stringify
response
04 PostCSS-shaped result CSS · map · messages · AST
ModuleResponsibility
serviceShared async service contract.
nativeNode-API async/sync operations, compact AST codec, and option normalization.
browserWorker-backed service; @postcss-go/wasm ships the WASM assets.
cliConfig, JS plugins, message combining, and writing Go-generated CSS and maps.