skdb icon indicating copy to clipboard operation
skdb copied to clipboard

Consider if package structure can be simplified

Open jberdine opened this issue 11 months ago • 2 comments

Currently the package dependency structure is:

api /->
core -> api
wasm -> core
addon -> core
runtime -> wasm, ?addon
server -> runtime
helpers -> core, api

A couple things are not clear to me:

  1. Is there a need to separate runtime and server? I don't see anything that would get in the way of merging runtime into server. Am I missing something?
  2. Is the exported API surface of core actually the minimal common functionality that is needed by both wasm and addon? If not, should the extras be moved into wasm / addon?
  3. Is there a need to separate core from api, or could core be merged into api but not exported?

jberdine avatar Jan 07 '25 15:01 jberdine

There has been a bit of drift since then, but initially there was (IIRC) only core, server and helpers (and client but that was before SSE), i.e. no api, no wasm, no addon and no runtime. The idea was that:

  • server would contain only the logic for taking a reactive service definition and spawning the http servers to expose it through HTTP/SSE.
  • core would contain the type definitions needed to declare a reactive service, along with the skip bindings
  • helpers would contain a mix of things that were not strictly needed by the other two, but probably nice to have for some users in some cases (and was expected to be reviewed and stripped down).

@skiplabsdaniel can probably give you more accurate context on why api/wasm/addon/runtime were introduced.

beauby avatar Jan 07 '25 15:01 beauby

In first place, api was introduced to have a common interface between addon and wasm. Initially the addon was a node native copy of wasm code. Now, api and core can effectively be merged. wasm and addon was created to allow separated load, as addon is built during npm install it's need to be in separated package to prevent full install failure. runtime was introduced to automatically manage the addon install failure and use the wasm version in that case. If we consider that we never use the skip runtime without the server, server and the runtime can effectively be merged. Today, the wasm package is always installed with runtime due to the npm project manager mechanism, in clean npm world, the package wasm is installed only if the addon install failed.

skiplabsdaniel avatar Jan 09 '25 09:01 skiplabsdaniel