rystaf / mlmym

a familiar desktop experience for lemmy
GNU Affero General Public License v3.0
246 stars 16 forks source link

Does this really need a "running server"? #82

Open RonSijm opened 10 months ago

RonSijm commented 10 months ago

Hey there,

I've been using this project and running it locally, (not in the docker, just straight from source) - and I was curious whether this actually really needed a running server. What this project mostly does is serve a front-end.

It's also possible to compile go into to WASM, and just serve html from there.

I was trying to do that myself from source, but ran into some obstacles. But that's because I'm not super familiar with GO yet - though I have build a bunch websites in Blazor (C# WASM) that work in a similar faction there C#/Blazor is just generating html client size

The main reason/benefit to do it this way would be so that it can be hosted anywhere without a server, for example AWS S3 or even Github Pages in a similar fashion as React or Blazor based front-ends. - and so without any/neglectable costs

I noticed it uses the server to proxy the login request back into itself, but that isn't really necessary anymore. If you look at https://phtn.app for example, a different alternative Lemmy Front-end, it just sends the login request straight to https://programming.dev/api/v3/user/login.

Was wondering what other people though of this, specifically maintainers / contributes to this project (@rystaf) - Or if there would be reasons why this wouldn't possibly work in WASM :)

ollytom commented 8 months ago

The server fetches data from Lemmy via its HTTP API then renders HTML from templates; see https://github.com/rystaf/mlmym/tree/main/templates

Something needs to make a HTTP request to Lemmy.

mlmym could be modified slightly to run from Wasm and not start a HTTP server. In this case requests to Lemmy could be made by the browser rather than the server (just like phtn).