-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create (server) API for Studio #86
Comments
Do we have a list of those actions the server should perform, e.g. generation of templates? |
At the moment in plans is implement things from playground, so generating and downloaded result of templates. In future we can implement (as @jonaslagoni suggest) the model generation, optimizations etc, but a lot of things we can perform in browser, because our libraries are isomorphic, so the most important thing is the generation of templates. The list is open and we can add to it whatever we/community need.
It depends in which way we will go - in which form we will distribute that API - because we have several options:
Of course, for first option, the costs are 0, for second it depends on traffic 😅 So at the moment I don't know. We should check what traffic we have on https://playground.asyncapi.io/ and by this estimate costs. But we must also remember that the community will grow, so costs also. We can also limit hourly/IP requests to reduce costs etc. |
Hi @magicmatatjahu 🙂, in regards to the technology/framework I think Node.js & Express.js w/ TypeScript is fine. I think it would be cool to have a version of the API deployed in DigitalOcean, for example, but have it rate-limited like you mentioned, to reduce costs. For the API design I think for now we would have endpoints that is the equivalent of the markdown route: Line 14 in 06cd3b1
To generate and download the result of templates. I just don't know if it would only be markdown or more templates. If we want the What other endpoints does everyone think the API needs? @jonaslagoni suggestion for the optimizer is pretty cool, can we use the package https://github.com/asyncapi/optimizer on the client-side, or do we need an endpoint on the API? |
Perhaps not to go in very detail on this, as I think it's not the most important part about this issue: I would say the only (strong) reason for adding a rate limiter are attacks. So I would say, with lower priority, we could add nginx in front of all our HTTP services (meaning current playground, hub, etc), which can implement a simple leaky bucket algorithm based on headers and/or IP. This could be automated by the installation scripts (Terraform). |
Definitely let us not overcomplicate. We do not create a commercial API, but free service that can be improved basing on how we learn it is used. Rate limiting can be added once we see someone abuses the API, and doesn't make much sense to focus on all these tiny details IMHO (better first connect google analytics to playground to see how ofter people actually click download button - but again if that really makes sense) More important. And I have a pretty strong opinion here 😄 We should follow API first approach here, so really looking forward to seeing the API designed with latest OpenAPI and some code generated with it 😄 |
Fran once suggested to go with the GraphQL - it would make sense in case we expand the API, but if we end up with just a generator then I think simple REST is enough. |
Exactly, I also thought about that in this way, that you will have possibility to generate not only markdown/html but also another our templates. Most likely we won't go for custom template generation due to security issues.
We will use optimizer in the client-side, but maybe we will also create endpoint for that in API. Currently only the generator cannot be used on the client side and it is a priority, but if need be we will do endpoints for other things too :) |
even if we expand to more, like optimizations, diff, etc. I honestly do not see a benefit of using GraphQL. This is going to be an API that you use for one thing at a time IMHO. REST should be grant |
I suggested GraphQL when it was only a server for the frontend but since it's going to be an open API that anyone would use, I'd go for a REST API instead. Usually, I go for GraphQL when I control the API and the client(s). If we let anyone call our API, we don't control the clients anymore and therefore I think it would be better to bring a REST API. |
I would be very willing to start writing the discussed API app, of course only the |
I would say immediately in a new repo, and ensure you design the API first with OpenAPI 😆 (no joke). |
About OpenAPI I know 😄 So then, what name of new repo? |
Isn't |
What about The name can always be changed, but what about the tech stack? @BOLT04 suggested to use Express + Typescript. Do you agree @jonaslagoni @smoya @derberg? The app will be small at first, so we can always switch to another framework in next iteration if we want. |
Otherwise, ExpressJS seems like the standard. |
Ok, I will create |
I'd consider using https://github.com/anttiviljami/openapi-backend as the tech stack. |
We have such a project in our organization (https://github.com/asyncapi/server-api) and we are very close to integrate first path ( |
In #80 proposal was proposed to create a (server) API that would later be used by the Studio for things that cannot be done in the browser. Most of our tools are isomorphic, but e.g. generator still need to run a NodeJS environment. Issue is opened to discuss how this API should look like, what it should offer, in which technology/framework it should be written and in which way it should be distributed.
@jonaslagoni @derberg @fmvilas @smoya You should be interested in this topic :)
@BOLT04 If you want also add comment, feel free, but I'm not forcing anything.
Closed issues (related to old implementation of the Studio) but are related to the server API and should be consider to implement:
The text was updated successfully, but these errors were encountered: