iii icon indicating copy to clipboard operation
iii copied to clipboard

Feature pairity with other backend frameworks (nest.js, fast api, flask, etc...)

Open rodrigomf24 opened this issue 1 year ago • 5 comments

Context

Motia provides an entire backend ecosystem for software developers, an essential part of this ecosystem is its framework. The framework is solid, but there are essential features that most backend frameworks don't skimp on and its up to the developer to use these features with the required amount of security/considerations when their systems are running on a live environment.

Some of these basic features are customizations of the HTTP layer such as:

  • cors
  • middleware (authentication, body parsers, allowed headers, etc...)

What do we need?

Motia steps sit at the core of the framework, currently there is support for some configurations at the step level (i.e.: authentication), but for flows that have multiple API steps, the configuration per step becomes a limitation.

Here are some of the proposed changes:

Allow global middleware that applies for a group of steps

Introduce a new middleware primitive into the Motia architecture, that allows for middleware to be executed prior to the execution of a given step (part of the lifecycle of a step). This middleware can be authn or authz, cors (for api steps). This middleware could be configured to apply to all steps in a motia project (agnostic of flow), or to a specific group of flows.

Allow for http configurations for a given step or group of API steps

Allow API steps to be configured for their HTTP layer, i.e.: cors, body request limits, allowed headers (i.e.: content-type)

For self-hosted projects, allow configuration of the express server that hosts the api endpoints and workbench

For projects that are self-hosted and rely on the express server spawned from the motia start command, allow to enable specific express features such as:

  • cors
  • body parsers (multer, busboy, etc...)

rodrigomf24 avatar Jul 31 '25 16:07 rodrigomf24

We have a simple middleware configuration, it's per step, but ideally we should have a global middleware configuration (similarly to what fastify has)

but multer and body parser, we don't have plans to supporting it, in fact, we want to discourage devs from uploading to steps. Instead, we want to provide a built-in support for storage and file uploads

sergiofilhowz avatar Jul 31 '25 16:07 sergiofilhowz

I agree in terms of best practices, but it does seem limiting to not support these in principle

mfpiccolo avatar Jul 31 '25 16:07 mfpiccolo

Amongst everything I would wish for from other known backend, is SSE. Motia currently supports web sockets, which is nice but also limiting.

Nowadays all AI apps are using SSE to cover streaming (unless you are talking about relative voice apps).

Having a similar implementation as the current streams (actually it could be exactly the same, only a type of stream - ws|sse -) to be able to send SSE event would be awesome !

unsync avatar Aug 05 '25 05:08 unsync

Hey @unsync! 👋

Really appreciate this thoughtful feedback! You're absolutely right about SSE being in active discussions for modern AI applications - we've been having some internal discussions about this exact need as more developers are building with MCPs and AI integrations.

Your timing is perfect, actually. I'm going to create an internal ticket to track this properly and get it in front of our team. SSE support would definitely align well with our goal of feature parity with other backend frameworks.

I'll make sure to loop back here with updates as we learn more from the team about the implementation timeline and approach. Thanks for taking the time to share this - feedback like yours really helps us prioritize what matters most to the community!

Will keep you posted! 🚀

rohitg00 avatar Sep 13 '25 09:09 rohitg00

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within 7 days. Please feel free to comment if you believe this issue is still relevant. Thank you for your contributions to Motia! 🚀

github-actions[bot] avatar Nov 13 '25 02:11 github-actions[bot]