The current official package/modules ecosystem consist of:
@marblejs/core
@marblejs/messaging
@marblejs/websockets
@marblejs/testing
@marblejs/middleware-logger
@marblejs/middleware-io
@marblejs/middleware-joi
@marblejs/middleware-jwt
@marblejs/middleware-body
@marblejs/middleware-cors
@marblejs/middleware-multipart
Problem statement
Main framework monorepo contains deprecated packages (eg. @marblejs/middleware-joi) that are no maintained anymore - their versions are automatically bumped-up from release to release. The Joi validation middleware was the first community driven package that was used for HTTP request validation. Due to the difficulties in proper type inference, it was deprecated with the introduction of version v2.0, when io-ts-based middleware was released.
Community doesn't have a dedicated environment/space where they can propose new non-core modules and easily contribute to the ecosystem, eg. like fp-ts-contrib does.
@marblejs/core API layer is too big. It contains a core/common abstractions that are used across other modules, like: messaging, testing, websockets, middlewares mixing core functionalities with HTTP protocol context. With an introduction of messaging module HTTP protocol is not the only one available transport layer that Marble.js apps can be built on.
Proposed solution
New, separate monorepo marblejs/contrib (?) for community driven packages that are out of scope core modules. First candidates for migration: @marblejs/middleware-joi and maybe @marblejs/middleware-jwt.
@marblejs/core package should be split into two parts: reduced API layer for @marblejs/core and brand new @marblejs/http package. All existing HTTP related API would be moved to the new scope, where the core package will include all basic and common interfaces and API's that are used across all dependent modules: testing, websockets, messaging and new http.
The new package layer reorganization can be introduced with the release of version v4.0
Things to consider
Some middlewares can be baked into main modules, eg. cors, multipart, body or logger can be scoped and baked into the future @marblejs/http module. The only problem that I foresee is the maintenance experience/cost - it will be hard to maintain so many things in one place. Maybe separation into dedicated packages is still valid and good path. 🤔
Migration path
It is not so drastic braking change
joi-based middleware due to it's deprecation should not be used so widely,
the change mostly affects imports:
Instead of:
import { r, HttpStatus, useContext, combineRoutes } from '@marblejs/core';
we will have:
import { useContext } from '@marblejs/core';
import { r, HttpStatus, combineRoutes } from '@marblejs/http';
Overview
The current official package/modules ecosystem consist of:
Problem statement
io-ts
-based middleware was released.messaging
,testing
,websockets
, middlewares mixing core functionalities with HTTP protocol context. With an introduction ofmessaging
module HTTP protocol is not the only one available transport layer that Marble.js apps can be built on.Proposed solution
marblejs/contrib
(?) for community driven packages that are out of scope core modules. First candidates for migration: @marblejs/middleware-joi and maybe @marblejs/middleware-jwt.@marblejs/core
package should be split into two parts: reduced API layer for @marblejs/core and brand new @marblejs/http package. All existing HTTP related API would be moved to the new scope, where the core package will include all basic and common interfaces and API's that are used across all dependent modules:testing
,websockets
,messaging
and newhttp
.v4.0
Things to consider
cors
,multipart
,body
orlogger
can be scoped and baked into the future@marblejs/http
module. The only problem that I foresee is the maintenance experience/cost - it will be hard to maintain so many things in one place. Maybe separation into dedicated packages is still valid and good path. 🤔Migration path
Instead of:
we will have: