Azgaar / armoria-api

Heraldry generator API
https://armoria.herokuapp.com
Other
38 stars 7 forks source link

Merge Armoria API with Armoria UI #6

Open Azgaar opened 11 months ago

Azgaar commented 11 months ago

There is no real need in Armoria API being a separate project. The maintenance has a cost (both time and money), while a separate project doesn't provide any value.

We can create a single SvelkeKit project and move the API there as well as UI. Can deploy for free on Vercel

Issues:

Benefits:

Azgaar commented 11 months ago

@Blipz, what do you think about it?

Blipz commented 11 months ago

@Blipz, what do you think about it?

Always nice to reduce code duplication! If I understand correctly, renderers for UI and API would still be different, right?

Azgaar commented 11 months ago

Yes, node.js cannot render as browser it doesn't have canvas API. So it will be basically the same

Blipz commented 1 month ago

Yes, node.js cannot render as browser it doesn't have canvas API. So it will be basically the same

I'd suggest replacing resvg-js by a package using a headless browser, like https://www.npmjs.com/package/convert-svg-to-png. A quick test shows that this would solve all the feature inconsistencies between UI and API.

Azgaar commented 1 month ago

Yes, node.js cannot render as browser it doesn't have canvas API. So it will be basically the same

I'd suggest replacing resvg-js by a package using a headless browser, like https://www.npmjs.com/package/convert-svg-to-png. A quick test shows that this would solve all the feature inconsistencies between UI and API.

Sounds interesting. Did you try it? I have a concern on how fast it can be, it should be pretty fast as it's an API.

Blipz commented 1 month ago

Sounds interesting. Did you try it? I have a concern on how fast it can be, it should be pretty fast as it's an API.

Here are some metrics on my machine:

Azgaar commented 1 month ago

200ms is acceptable, I believe. Yes, it would be nice to use chromium engine to render SVG, it will allow us to remove the code difference between 2 renderers.

Blipz commented 1 month ago

It turns out the performance depends quite heavily on the size of the image (previous metrics were for 500x500), so I don't know how viable it will be in the end.

Azgaar commented 1 month ago

500 is a good size. We can set a hard-coded limit to 1000px. If someone needs more, they will have to use SVG and render it manually at any size