Minified Server Actions API

I have tested minified a server action API. For Wappler UI its the same, nothing changes, all options works correctly without issues, but of course only the readability in the .json file will be affected if someone manipulate the file directly.

The minified proccess can save between 50-60% of the API size, thats from 100kb to 40-50kb final size in a real scenario with large API structure.

I don’t know if maybe someone edit manually the .json API file, but maybe an options for users that need to manipulate directly the file can be solve it by change the way in how Wappler read the API files, instead of "/app/api" change it to .wappler folder just like do with “config” and “module” folders for each target, and provide an engine that on every save it generate a minified version in "/app/api" folder.

So, my suggestions are:

  • In Wappler UI the API’s should be readed from ".wappler/targets/myTarget/app/api" this are unminified versions.
  • On every save it generate a minified version in the root folder of project just like now works "/app/api".

At the end the total folder of API could be reduce in size in about a 50%, if your API folder has 5mb, with the minified versions can be reduced to 2.5mb, I think thats a lot. And for slow network connections like mobile could be good with this.

Please, correct me if I’m wrong if the size of the API matter or not?

Thanks.

Hi,
Server action files are never served to client side.
They are ‘loaded’ on server side itself when a request comes in.
Not sure how much these saving will affect the already very fast NodeJS server.

Minifying the EJS files could definitely be a good addition - as they are sent to client.

Thanks @sid, good to know, this is the kind of info that we all need to know.

So, if the file itself is not loaded by client side, the impact of it will be in the server itself, I mean the impact will be in the resources of server. And 100kb is really not important because because the server handle and proccess the file, and the client only receives the result of that API, right?

With that in mind this feature request have not sense at all, it works for just knowledge to other users.

Yes.