examples icon indicating copy to clipboard operation
examples copied to clipboard

sse example using datastar

Open joeblew999 opened this issue 8 months ago • 5 comments

The current example has hard coded js at https://github.com/goadesign/examples/blob/master/sse/public/index.html

Suggest we look at using datastar because it removes all custom JS, by using a htmx pattern: https://github.com/starfederation/datastar/tree/develop/examples/go/hello-world


go run .

The Goa DSL is designed around the notion oF resources and so is datastar. So I think code gen will work really well with it. also they both use Chi.

it makes it possible to essentially gen some of the GUI, because all state is on the server and simple HTML fragments are all that is needed. tailwind css is all there as you can see from the HTML.

joeblew999 avatar May 05 '25 06:05 joeblew999

Yeah that could be a great example, care to submit a PR?

raphael avatar May 05 '25 17:05 raphael

It will take me a while to do this .

Can you suggest where it should be ? The weather example seems pertinent .

joeblew999 avatar May 05 '25 23:05 joeblew999

The current SSE example uses an internal SSE system .

I’m not sure Datastar can use that as it has its own SSE system that can also work with NATS Jetstream - as a leaf node typically.

Can you have a look ?

joeblew999 avatar May 05 '25 23:05 joeblew999

I see yeah doesn't look like Goa would add a lot of value there, seems like a separate tech stack.

raphael avatar May 13 '25 00:05 raphael

Agree . Glue the 2 together , without touching either via a simple middleware extension ?

DS is the frontend ( on the backend ) . All DS wants to do is call down into Goa , get data , and return html fragments.

Plus when a record changes inside Goa ( via a third party call , for example ) , to tell DS ( via sse or web hook ).

Nice and seperate. Will also allow me to add an auth gui to goa, since Goa has a decent auth api now.

if you have any thoughts , example links , etc would be helpful if you have time , so I can work through it as quickly as possible , and OR back stuff that does the right approach .

joeblew999 avatar May 13 '25 03:05 joeblew999