cosmo icon indicating copy to clipboard operation
cosmo copied to clipboard

chore(RFC): open core module system v1

Open StarpTech opened this issue 1 year ago • 8 comments

Motivation and Context

Related work:

  • https://github.com/wundergraph/cosmo/pull/1130#issuecomment-2452872727
  • https://github.com/wundergraph/cosmo/pull/1125

TODO

StarpTech avatar Aug 11 '24 09:08 StarpTech

A few goals I'd like to see covered:

  • load my own config from my own config provider
  • modify any config after load but before using it for a new mix
  • allow the user to customize the transport (we're currently wrapping the default transport, let the user bring their own)
  • hook into events like normalization, validation, parse (before, after)
  • allow the user to define additional validation rules/steps
  • Ideally, calling hooks is built in a way that automatically generates meaningful traces so that we're able to understand if and how much time the Router spends in a hook
  • it should be easy to create a custom module / plugin as a go module which can then be imported and configured easily, making it simple to re-use and share custom extensions
  • it would be nice if each module had it's own namespace (mandatory), like a prefix, so that the module can easily extend the existing Router config.yaml with it's own configuration without conflicts
  • it should be possible to define custom authentication hooks
  • it should be possible to define custom authorization hooks
  • it should be possible to define custom rate limit hooks

Additional comments: Should we call it Gateway or Router? We talk a lot about Router, should we stick to this convention?

I'll look more into the RFC and give more specific feedback later/tomorrow.

jensneuse avatar Aug 11 '24 10:08 jensneuse

A few goals I'd like to see covered:

@jensneuse Please take a closer look to the proposal. Most of your points has been already addressed. For other points, I do miss a real world use case e.g

allow the user to customize the transport ...

The goal of the module system is to enable all sorts of use cases, but we need to be very careful not to expose internals where developers can shoot themselves in the foot.

Other points are valid though and I'm going to address them. Thank you.

StarpTech avatar Aug 11 '24 13:08 StarpTech

A few goals I'd like to see covered:

@jensneuse Please take a closer look to the proposal. Most of your points has been already addressed. For other points, I do miss a real world use case e.g

allow the user to customize the transport ...

The goal of the module system is to enable all sorts of use cases, but we need to be very careful not to expose internals where developers can shoot themselves in the foot.

Other points are valid though and I'm going to address them. Thank you.

Some companies want to have full control over the transport. I'd leverage our existing transport architecture, but allow them to override the wrapped transport if they want to. It's a potential risk, sure, but in such a case they will know what they do.

jensneuse avatar Aug 11 '24 13:08 jensneuse

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Sep 11 '24 05:09 github-actions[bot]

Closed as inactive. Feel free to reopen if this PR is still being worked on.

github-actions[bot] avatar Sep 25 '24 05:09 github-actions[bot]

Closed accidentally from bot

StarpTech avatar Sep 25 '24 21:09 StarpTech

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Oct 12 '24 05:10 github-actions[bot]

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Apr 21 '25 05:04 github-actions[bot]

Closed as inactive. Feel free to reopen if this PR is still being worked on.

github-actions[bot] avatar May 05 '25 05:05 github-actions[bot]

Closed in favor of the ADR https://github.com/wundergraph/cosmo/pull/1863

StarpTech avatar May 15 '25 08:05 StarpTech