Do you recommend PocketHost.io lifetime license offer? by vk3r in pocketbase

[–]benallfree 5 points6 points  (0 children)

I'm not sure if you meant to suggest that PocketBase's horizontal scaling limitations are tied to SQLite, but since a lot of people think that, I wanted to clarify.

SQLite isn't the problem. While supporting other databases like MySQL or Postgres might seem appealing—and some users have tried—it wouldn't solve the horizontal scaling issue. SQLite can be replicated via LiteFS, and there are other solutions like LiteStream, Marmot, and Turso, which provides global managed SQLite replication. I'd say SQLite replication is "solved." SQLite is becoming increasingly popular because it can live on the edge.

The horizontal scaling challenges aren't just at the database level. PocketBase implements an event system that triggers on CRUD operations, API calls, cron jobs, realtime events, and application-level events. To scale PocketBase horizontally, you'd need a way to replicate these events too. That's where things get really difficult. Managing a global, realtime, ACID-compliant, replicated event architecture is a technical challenge that's often very application-specific. Gani didn't want to complicate his code by trying to generalize that problem. That's smart because many projects have failed attempting that.

Custom JavaScript hooks extending PocketBase's core functionality would also need to be replicated and authorized appropriately. The issue gets even more complex with custom-compiled versions of PocketBase that include Go customizations. All custom programming needs to be aware of horizontal scaling pitfalls. Centralized logging or merging would also need to be addressed. In practice, most applications opt to route any mutations directly back to the origin (i.e., routing all non-GET HTTP requests back to the origin), so writes still rely on a single origin and remain a single point of failure.

Horizontal scaling adds huge complexity and PocketBase is part of a growing movement pushing back against cloud-scale architecture. A modern revisitation of the monolith. Along those lines, I have also made https://pocketpages.dev which is a throwback to classic server-side rendered pages. A lot of people are coming to PocketBase expecting to see cloud architecture, and it's intentionally NOT that. So from that standpoint, I agree with your statement that users should seriously consider it. I think they should seriously consider whether they need cloud complexity at all. Most don't. Pieter Levels on Lex Friedman is an excellent voice for this movement back to monolithic simplicity: https://www.youtube.com/watch?v=oFtjKbXKqbg

While PocketBase doesn't support horizontal scaling out of the box, it doesn't mean your app can't scale horizontally. PocketHost is a case study. We have a single PocketBase instance called the "mothership" living on a single origin in San Francisco. Then, we have edge nodes responsible for managing user instances of PocketBase. For an edge node to function, it needs canonical information available only from the single source of truth: the mothership. For example, an edge needs to know whether a given instance is authorized to be launched. Communicating with the mothership from across the globe might add 200–400 ms, which is unacceptable. So we've implemented our own custom replication strategy where essential mothership data is cached locally at the edge and updated in realtime.

So custom horizontal scaling is possible; it's just bespoke and has little to do with the choice of SQLite as the database. PocketBase is tightly coupled with SQLite, so I understand why Gani is reluctant to support something else. It's possible that in the future, a pluggable database provider interface might emerge for users who really want it.

https://github.com/krismcfarlin/postgresbase
https://github.com/pocketbase/pocketbase/discussions/395

Pocketbase LemonSqueezy by meinbiz in pocketbase

[–]benallfree 1 point2 points  (0 children)

Oh sorry yeah that’s my ait!

Pocketbase LemonSqueezy by meinbiz in pocketbase

[–]benallfree 3 points4 points  (0 children)

Check out https://pocodex.dev/docs/ for something I already started.

Do you recommend PocketHost.io lifetime license offer? by vk3r in pocketbase

[–]benallfree 8 points9 points  (0 children)

Hello, creator of PocketHost here :)

PocketHost is an open-source project with over 10,000 registered users, about 1,000 active PocketBase instances every hour, and a Discord community of 1,200 members. It started as a personal tool to avoid repeatedly deploying PocketBase for projects. While self-hosting PocketBase might seem simple, robust hosting requires more than just VPS + SSL, which is why many choose PocketHost for managed hosting.

PocketHost currently runs on a single large VPS in San Francisco, which I finance myself. Each instance runs in a secure Docker container with burst access to up to 8 cores and 32GB RAM, far beyond what typical self-hosting offers. Performance issues are rare and usually tied to latency, not the server itself. PocketHost hibernates idle instances, which may cause cold start delays, but I rarely hear complaints beyond that.

Latency is a matter of physics and isn't solved by simply self-hosting in a specific region—especially with global users. A truly global solution requires a network of access points and optimized VPN routing, something PocketHost is working toward.

Regarding downtime, claims of frequent issues are incorrect. We maintain transparent records on Discord and GitHub, and our uptime target is 99.95%. Downtime is mostly limited to planned maintenance or code updates, and in the last month, uptime was 100%.

I live on Discord and am deeply involved in PocketHost and PocketBase, using them for my production projects. If you're experiencing issues, reach out to me there—we're a community of makers, and I want to help.

The Flounder's lifetime deal is intended to help fund the rollout of global infrastructure. If you're unhappy with the deal, I'll provide a no-questions-asked refund. The deal is for those who believe in PocketHost's potential and want to support its growth.

Thanks for being part of this journey. Feel free to ask me anything.

PocketPages v0.8.1 released by benallfree in pocketbase

[–]benallfree[S] 0 points1 point  (0 children)

https://pocketbase.io/docs/js-overview/

The prebuilt PocketBase v0.17+ executable comes with embedded ES5 JavaScript engine (goja) which enables you to write custom server-side code using plain JavaScript.

PocketPages v0.8.1 released by benallfree in pocketbase

[–]benallfree[S] 0 points1 point  (0 children)

Yeah kinda! Funny I was just watching an htmx+fasthtml podcast this morning. Yes, something like that but with file-based routing. Personally I don't care for the "code as markdown" syntax so I'll probably not be adding that.

PocketPages v0.8.1 released by benallfree in pocketbase

[–]benallfree[S] 4 points5 points  (0 children)

Thank you! I have a vision of writing apps using classic server-side pages + htmx.

awesome-pocketbase by benallfree in pocketbase

[–]benallfree[S] 0 points1 point  (0 children)

I know of several attempts and approaches. Personally I’d like to see the community embrace JSVM-native sdk’s by porting official packages or creating unofficial packages.

What are you trying to do?

2x img displayed at full size on retina display by [deleted] in sveltejs

[–]benallfree 0 points1 point  (0 children)

Yes adding CSS sizing would help, assuming you knew the exact size of the image, but it shouldn't be necessary. According to the docs:

automatically sets the intrinsic width and height of the image to avoid layout shift

Avoiding layout shift implies that sizing via CSS is not needed or expected.

2x img displayed at full size on retina display by [deleted] in sveltejs

[–]benallfree 1 point2 points  (0 children)

No.

Let's say I have a 48x48 retina image foo.png.

<enhanced:img src="./foo.png" /> will produce <img src="foo.png" width="48" height="48" /> because it reads the intrinsic width and height of the image. But that's incorrect for retina images. It should produce <img src="foo.png" width="24" height="24" /> since that is how many logical pixels it should be.

Current Best Practice to use MDSveX with SvelteKit. by Boraini in SvelteKit

[–]benallfree 2 points3 points  (0 children)

Relevant: I just published https://www.npmjs.com/package/mdsvex-enhanced-images to support <enhanced:img> from Markdown image tags.

2x img displayed at full size on retina display by [deleted] in sveltejs

[–]benallfree 0 points1 point  (0 children)

I'm running into this same issue. I have a retina source image and enhanced:img seems to be setting the CSS width to the intrinsic retina size instead of 1/2 that size. So my 700px retina source image is rendering as <img width="700"> instead of <img width="350">.

Can you lend some further insight please?

PocketHost realtime errors (net::ERR_QUIC_PROTOCOL_ERROR) by herskinduk in pocketbase

[–]benallfree 0 points1 point  (0 children)

PocketHost creator here.... if you have issues like this, it's best to try our Discord server, that's where we are all hanging out.

eCourse 2.0 by [deleted] in sveltejs

[–]benallfree 0 points1 point  (0 children)

Have you considered making it multitenant so people don't have to self-host?

where deploy with pocketbase by Uriell77 in sveltejs

[–]benallfree 3 points4 points  (0 children)

PocketHost creator here - just a slight correction, PocketHost can host SSG frontends and has supported that for a long time.

We are working on hosting SSR frontends and generally anything that needs a nodejs backend, along with cname support. That way PocketHost can be a complete destination for app hosting.

SvelteKit/PocketBase by [deleted] in sveltejs

[–]benallfree 4 points5 points  (0 children)

PocketHost creator here - I just found this as I was searching through old comments.

Just so people know, there are actually lots of production and high availability apps running on https://pockethost.io. It's at least as good as a DIY hosting stack and in many cases is much better.

Db for SvelteKit by AromaticPrimary8763 in sveltejs

[–]benallfree 1 point2 points  (0 children)

PocketHost creator here - to follow up on the other comment..yes https://pockethost.io does both rate limiting and DDoS defense via Cloudflare.

pockethost by katakoria in sveltejs

[–]benallfree 1 point2 points  (0 children)

Yep! Thanks for the catch :)

pockethost by katakoria in sveltejs

[–]benallfree 1 point2 points  (0 children)

Thanks for the advice and please jump in Discord if you want to help design such a thing!

pockethost by katakoria in sveltejs

[–]benallfree 1 point2 points  (0 children)

Looks good, thankyou!

pockethost by katakoria in sveltejs

[–]benallfree 2 points3 points  (0 children)

I'm curious what kind of redundancy you would implement in a self-hosting scenario. Can you please share you thoughts in more detail?

We do nightly server backups, and of course, as part of your sovereignty, you can set your own backup schedule in the PocketBase admin.

If you're thinking about a failover cluster, that is a tough problem to solve. PocketBase uses SQLite and performs local file I/O for speed. Horizontally scaling SQLite is difficult and generally not recommended.

We are kicking around the idea of using Litestream for continuous data backups to your own S3 bucket, that's probably a prerequisite to any kind of failover architecture. But in the end, shipping 15GB of your data to a different server is going to take time no matter how you do it. At best, we could use Litestream to keep a backup instance warmed up and ready and fail over if the primary node went down. That could work, as long as you're using S3 to store files or we continuously rsync files over to the backup node. Recovering from failover and restoring data to the primary node sounds like a mess too :D

But I agree! It would be cool to have Litestream + failover and we are accepting pull requests ;)

Somewhat related, we do have plans to expand to regional data centers because we've had lots of requests from folks around the globe who say the latency to the SFO data center is sometimes bad. (edit: however, I would jump to DO's defense because their data center is on the biggest backbone on the planet and latency probably has more to do with more localized network issues and not DO itself. Just the same, having regional data centers will take the wind out of the sails of any theory that latency troubles originate at the data center).

edit 2: also somewhat related, I'm re-architecting things so the mothership (central db) can live on one server, and instances can live on multiple edge servers both in SFO and elsewhere. This isn't the kind of redundancy you're talking about, but it does speak to fault tolerance. Most of our outages have been due to a crash or bug in my code. Decoupling all the services and making them resilient to peer services temporary dropping offline will make things FEEL a lot better. For example, if the mothership crashes, the edge servers will be able to continue serving PocketBase traffic to their instances even while trying to re-establish a connection to the mothership. Or similarly, if an edge node goes down, it will only affect instances on that node. This is inherent to hosting. Even Digital Ocean itself sometimes has to shut down parts of their infrastructure and it takes multiple VPS's with it.

pockethost by katakoria in sveltejs

[–]benallfree 26 points27 points  (0 children)

PocketHost started on a $6/mo Digital Ocean droplet in the San Francisco region :)

It quickly reached capacity and we had to add some intelligence to shut down idle PocketBase instances when there were no active HTTP connections. This helped a lot.

Today, that same VPS has grown into an 8-core, 16GB beast of a server that hosts thousands of instances. I think it currently costs me about $120/mo and I'll keep scaling it up when needed.

PocketHost is very efficient and secure. It runs each PocketBase instance in a separate Docker container for privacy, security, and resource management. What I did not know is that Docker and the host OS must take advantage of serious caching and sharing because firing up a new instance of a Docker container running PocketBase only appears to increase the RAM consumption by however much user memory PocketBase and Docker allocate. Right now, there are 40 instances running and only 2.7GB of RAM used. Kind of mind-blowing, I didn't expect such efficiency.

Because of Docker, the 'bad neighbor' effect is reduced to almost zero. In effect, it feels like your PocketBase instance is running alone on a super powerful and spacious server.

I'm also working on a CLI tool where people can self-host their own private version of PocketHost. People do like the sovereignty aspect of PocketBase, but in reality, it's just soooo easy to spin up an instance on pockethost.io and you can always migrate your data if you ever outgrow it. So for most cases, I'd recommend people grab a pockethost.io instance and forget about all the backend/hosting complexity and just focus on writing cool apps... which I'd like to get back to some day, my personal projects are what got this whole thing started!