Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pocketbase #28

Open
gedw99 opened this issue Nov 13, 2024 · 6 comments
Open

Pocketbase #28

gedw99 opened this issue Nov 13, 2024 · 6 comments

Comments

@gedw99
Copy link

gedw99 commented Nov 13, 2024

I’m exploring using pocketbase PB with Xtemplate .

It’s sort of like a DB and Real time system in one with auth all the way through . It’s throws events over web sockets . Wish Is was SSE , but such is life :)

do you can have a record changes and then update all gyi effected using htmx and SSE. So all users stay up to date .

you can call it over http , so I currently use it with benthos to do any json mapping on the way in and out .

it also has an FS system for local and remote.

PB is real time so that when any record changes it tells you .

Xtemplate has the htmx stuff I need

benthos is where you can do custom logic / validation

The Xtemplate providers are nice still and useful ..

One thing I find hard with Xtemplate is sitting it all and understanding it . More examples would def help .

@taophp
Copy link

taophp commented Nov 13, 2024

IMHO, PocketBase is a interesting piece of software. It took me a while to figure out what you had in mind with this feature request. I think you would benefit from explaining your toughs and giving some use cases with some imaginary code.

If I understand you well, PB whould be a backend interface to implement the main business logic, then xtemplate would implements the front end logic. xtemplate would make requests to PB in a way or another, making it able to get collections defined in PB, something like:

{{range .PocketBase.get  'pages' 'slug' 'home' }}

to get the object from the "pages" collection with the "slug" field equal to "home". Am I right ?

xtemplate would generate entire pages with some htmx that would request some html fragments, also generated by xtemplate. Am I getting it right?

In this case, it would be a elegant way to provide RAD web developments. But:

  • I'm reluctant to allow users to build their own business logic in a no code way, as it seems hard to enable versioning in this case ; and it seems even more complicated with a mixed solution (at least, there would be some xtemplate code, right?)
  • PB is SQLite based ; I don't think xtemplate should impose a db solution ; it is "SQL agnostic" at this point, and I think it should remain like that.

I did not dive into how xtemplate is (or not) expandable but, I think that, if possible, PB-xtemplate should be available as a plugin or a module.

@gedw99
Copy link
Author

gedw99 commented Nov 13, 2024

thanks for the comments .., here we go ..

IMHO, PocketBase is an interesting piece of software. It took me a while to figure out what you had in mind with this feature request. I think you would benefit from explaining your toughs and giving some use cases with some imaginary code.

Sure can do a few use case s that I see . But in another comment as I don’t have time right now ..

If I understand you well, PB whould be a backend interface to implement the main business logic, then xtemplate would implements the front end logic. xtemplate would make requests to PB in a way or another, making it able to get collections defined in PB, something like:

{{range .PocketBase.get  'pages' 'slug' 'home' }}

to get the object from the "pages" collection with the "slug" field equal to "home". Am I right ?

yrs that’s pretty much spot on !

Xtemplate is a clever router . PB is the clever data layer .
We red some benthos though for forms processing and validation . PB has some but not enough is my hunch . You always need an escape hatch for exotic logic that abstractions just can’t provide . In fact I have be this currently talking to PB. Maybe Xtemplate has enough to replace benthos . I don’t know Xtemplate well enough / hence why examples would help but anyway .

xtemplate would generate entire pages with some htmx that would request some html fragments, also generated by xtemplate. Am I getting it right?

yes

It also has a file system API too that Xtemplate lacks .

In this case, it would be an elegant way to provide RAD web developments. But:

  • I'm reluctant to allow users to build their own business logic in a no code way, as it seems hard to enable versioning in this case ; and it seems even more complicated with a mixed solution (at least, there would be some xtemplate code, right?)

logic should go in benthos and its versioned because it’s git ops .

  • PB is SQLite based ; I don't think xtemplate should impose a db solution ; it is "SQL agnostic" at this point, and I think it should remain like that.

I get that you want an agnostic db layer and it’s elegant

I propose pb is a different interface . It’s not a traditional DB . It’s much more .

I did not dive into how xtemplate is (or not) expandable but, I think that, if possible, PB-xtemplate should be available as a plugin or a module.

Yes you have reached the same conclusions as me

@gedw99
Copy link
Author

gedw99 commented Nov 13, 2024

PB does support SSE :)
I was wrong it seems .

so don’t have to deal with awful web sockets .

ties in nicely with template and benthos then .
will prototype this in benthos to see how I can seed in to XT .

@gedw99
Copy link
Author

gedw99 commented Nov 13, 2024

Use cases are pretty obvious .

any system that needs to respond d to changing data and surface that to the gui or to any workers that carry out kind running things like sending data to no gui channels too .

any system that needs fully integrated Auth and AuthZ. PB can model authz against the data , and so gives fine grained security for whatever use csss you have extending to multi tenant scenarios also which matches perfectly with XT and caddy which supports multiple domains.

global scaling out is easy because PB can be multi master replicated using NATS and Marmot . I run it this way now . So that teams up fantastically with XT that already uses NATS. Which btw also teams up with the PB FS API for file replication using either S3 minio or NATS object storage . I actually prefer to use nats object storage because its 1 less dependency but mainly because its multi master and so we keep the data close to the compute logic , just like how PB is close to the compute logic . Latency is massively reduced , but your compute and storage are the same servers so you need to be a little careful with the types of servers you provision from . This makes operations far simpler for the average punter to not need an S3 somewhere .

Any use case where you need to add logic with Benthos . WASM workers is what I use for logic that benthos runs . Blobbing is what I use for logic and complex validation. You can reuse the PB Auth / Authz in the benthos logic for validation also .

Any use case where you want a HOWL stack . Because XT is not a software language but rather a DSL it’s HOWL and so not specific to golang developers . Benthos is the language in a way because event passes through it to PB .

There is now a benthos called Wombst that has a proper plugin model too that is openly licensed . Been using it . It can easily support more plugins as processing plugins . I use it currently for logic but also to ended non web GUI for PDF, image processing and video transcoding . I raise this point because it vastly expands XT allowing it to serve PDF, Trancoded images and videos , which web projects also sometimes need. The email template g that PB provides is mainly just for Auth . A benthos plugin can provide email templates for when you need to send emails with PDF,s attached and some basic email text with transcoded image logo.

helps too see where PB and Benthos work well with XT.

Btw I really wish XT had more examples because it is too hard to use currently due to it having its own Abstractions .

Caching and Cloudflare can be used too . I currently use the WASM golang plugins for benthos also on Cloudflare . The compilation is exactly the same . Just golang WASM. This means that XT an be your origin and Cloudflare can be your Edge . This works for all the transcoding that I do such as PDF, images. This is a highly advanced use case but helps to show an advanced roadmap of how benthos and PB can work with CDN and XT for a global scaled out system . You can then run XT is a single region but get cloud caching from cloud flare . I run things this way currently . Cloudflare WASM workers that are programmed in golang make direct calls to PB over http . This would then just travel through via XT / caddy to PB , thus providing the highly needed security layer . PB Web API is not secure enough on its own .

@taophp
Copy link

taophp commented Nov 14, 2024

Well, my bad, this is not exactly what I mean by use cases. On the one hand, we can say that we can assemble an engine with wheels and have as a use case a trip from Paris to Berlin or Rome, but not New York. This doesn't tell us much about the desired experience. These use cases would be just as suitable for a bike as a car, autonomous or even a taxi.
What I want to know is if you want to sit on the driver's side, put the key and turn on the engine, engage the clutch and start or if you want to sit on the engine and feel the wind in your hair or if you want someone to open the door for you and you sit in the back with all the leisure to do what you want.
I want to know what experience you want to get as a developer once you have assembled all the tools you propose. This is what I call a use case. And that includes some desired code samples that show concretely how you envision things. Without that, it's hard to know not only if our visions are compatible, or if what you want fits well into the scope of the project, but also how to achieve it. That's why I proposed my own code sample: to see if I understood your intention correctly.

BTW, I googled a while searching for what Benthos is. I found a lot of stuff, but not at all web or even computing related. At least, I found something named Redpanda, and, googling for both, I found that Redpanda acquired Benthos in May. As I didn't know both before, I wonder how Benthos was used (or how, concretely you use it), and what is the impact of this acquisition on Benthos. And I don't really understand what it has to do with Xtemplate.

To put it in one sentence: I'm very pleased and grateful to see your enthusiasm in engaging in the same projects as me, but I have some hard times to understand where and how you wanna go, as you are often abstract and talking about mixing tools I've never heard about before. It makes me think I should provide a roadmap for my own project (LLW) and, maybe, you should do so, so we can compare notes.

@gedw99
Copy link
Author

gedw99 commented Nov 14, 2024

I am def a systems architect and think in abstractions because I have been working with these tools for ages .

glad you found Redpanda. Yep it’s the new benthos. Still works like benthos so all good .

Roadmaps are great . Can do that for sure .

also what about a chat on signal one day ? Mine is on my github repo profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants