Build your own API

Hey team :wave:

This falls into a feature request but could also be a workflows thing.

Imagine having the ability to repurpose workflows in the following way:

  • create folder which will have a specific path / act as GW
  • individual workflows act as sub-paths
  • you offload and manage your logic outside of apps but heavily leverage this feature

This could be a proving ground for large Enterprise orgs but could be a backbone of smaller / medium orgs to unify efforts and promote code reusability.

Hi @stefancvrkotic!

Super interesting idea, by GW do you mean gateway?

My first reaction to this would be that this could be done with workflow connecting to other workflows along with branching logic at both the top level workflow that decides what data came in and where it should go for what purpose.

With the sub level workflows branching out from the source and handling specific use cases based on the payload given from the top level workflow.

Let me know how this idea in my head lines up with yours. The more specifics the better in terms of flushing out an actionable feature request for workflow architecture! :sweat_smile:

1 Like

Yeah, gateway.

1 way would be chaining workflows other would be creating workflows for specific action i.e. POST /products.

Ahh I see, very interesting.

I can definitely think of a ton of useful possibilities for this type of architecture.

Currently the only exposed API routes are workflow triggers, and we always caution users to have the highest level of security with those endpoints to prevent these routes from being spammed/Ddossed as the Retool cloud could be at risk from a workflow overload :sweat_smile:

Now that I think about it, this idea is kind of similar to turning a Retool app into a backend server :robot: which I had another user ask about. I think it could be very promising for a lot for use cases but also bears risks.

Maybe this would be a self-hosted only option for users to set up firewalls/greater controls for incoming web traffic :thinking:

Hey @stefancvrkotic @Jack_T !

I was actually talking with @lizzie about this recently. Very promising indeed.

Currently we’re using the Wundergraph SDK on Railway as an out-of-box way to set up this gateway, then calling Retool Workflow endpoints from there.

Nice benefit of the sdk is that it also generates an OpenAPI schema (and inputs + responses are typesafe/etc).

There’s obviously lag introduced because of the multiple hops (instead of directly calling workflows), but I find the tradeoff to be worth the discoverability and other downstream benefits of using the SDK, especially as our platform grows larger. (We can use the generated client SDK for our API in Retool’s custom react components, for example)

Of course, Workflows as a native gateway and API would be a way smoother solution. WG has some additional benefits, but I’m looking forward to seeing how this develops within Retool!

Was going to put together a post on the Retool-WG setup (and share the Railway template) in a few weeks. Happy to share if you’re interested.

2 Likes

Confirming that this is something we are actively thinking about on the workflows side! In brainstorm and prototype mode for now, but will loop you in for feedback in the coming months! Thanks for the tag @matei :blush:!

3 Likes