getAlby / nostr-wallet-connect

Nostr Wallet Connect (NIP-47) application to allow apps to connect to your node
https://nwc.getalby.com
Apache License 2.0
103 stars 31 forks source link

Expose API and extract UI into separate application #183

Closed rolznz closed 6 months ago

rolznz commented 9 months ago

A simple React (or other frontend framework) app can then talk to the NWC backend. This simplifies the go app (which the frontend is hard to maintain with a lot of custom JS) and enables other apps (like getalby.com) to embed their own NWC UI directly rather than directing users to a separate application.

For Umbrel we should be able to add a second service to the docker-compose.yml: https://github.com/getAlby/umbrel-community-app-store/blob/master/alby-nostr-wallet-connect/docker-compose.yml

Another approach would be to integrate it into the existing container:

rolznz commented 9 months ago

@bumi @im-adithya do you have any thoughts here? does the general idea sound good to you?

im-adithya commented 9 months ago

Yes, awesome!

bumi commented 9 months ago

I don't think we need a second service.

The go server would simply serve the static files for the frontend.

So we expose a JSON API for:

and move the UI into a react application that consumes this API.

rolznz commented 9 months ago

Some thoughts (needs review):

https://medium.com/@pavelfokin/how-to-embed-react-app-into-go-binary-12905d5963f0 this looks like maybe an option for the go side ? (@im-adithya to see if it works or something else needed for the bundling as a desktop app: https://github.com/getAlby/nostr-wallet-connect/issues/185)

Then we could try a vite template with (create-vite using react-swc-ts template https://vitejs.dev/guide/) https://vitejs.dev/guide/static-deploy.html - the dist folder should be ignored in github and we need to make sure we compile it somehow to make sure it works on umbrel

I would try that first so we have a skeleton app and make sure the go app can serve both the HTML and run its normal backend services and new JSON API simultaneously.

Then we can add tailwind and other react libraries and routing, etc. as a followup step?

im-adithya commented 6 months ago

And thus was born https://github.com/getAlby/nostr-wallet-connect-next :rocket: