marblejs / marble

Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.
https://marblejs.com
MIT License
2.15k stars 69 forks source link

[RFC] Package ecosystem reorganization #295

Closed JozefFlakus closed 3 years ago

JozefFlakus commented 3 years ago

Overview

The current official package/modules ecosystem consist of:

Problem statement

  1. 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.
  2. 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.
  3. @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

  1. 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.
  2. @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.
  3. The new package layer reorganization can be introduced with the release of version v4.0

Things to consider

Migration path

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';
JozefFlakus commented 3 years ago

Moved to discussions 👉 #316