Pocketbase is amazing! So far I had a great experience using it as a backend/database for the app I'm building where I'm using React with Vite for the frontend. I'm using it mainly for auth and for keeping track of paid and free accounts. Some things that I found rather useful:
- It's super easy to host. I was initially thinking of using Appwrite or Supabase but found it a tricky to self-host them, especially Supabase. I could spin up Appwrite quickly via CapRover, but found it an overkill for what I needed.
- View collections [1] make it easy to return just a subset of the data that you need. In my case I'm using a view collection as a join for users and paid_users collections, where I just return their paid through date.
- The fact that you can extend it with Go or JS [2] should make it possible to completely skip having a backend, at least if your needs aren't very complex.
I definitely plan to continue using it for some smaller/side projects. Currently I'm thinking of trying to use it as CMS for an Astro blog and in the future as backend for some browser extensions.
I feel like super easy to host needs to be re-emphasized. We're talking about dropping a single binary into your server and you're off to the races. If only more things were so simple.
I've been developing on PocketBase for 2 months. The system goes into production in 1 to 2 months.
I'm exceptionally happy with it. I'm developing an webapp for a friend's company and wanted a very simple system to hand-off. The whole thing is running with one binary: Pocketbase. It runs a webserver, server-side Javascript (compiled TypeScript) code, and SQLite database. The single process is hosted on Vultr for $12 per month. My frontend is written in SvelteKit (static adapter) + Svelte + TypeScript.
Pocketbase is well done. The author has been exceptionally responsive to my questions. He is fast and clear.
I have had a few minor issues: The documentation has bare spots (but is very good for most things). I had to write my own CSV loader. (I hope to open-source it.) Writing lots of objects through the CRUD interface is slow. (It's possible to write faster using server-side code.) Unit testing for the server-side JavaScript had to be shoehorned in. And I wish Copilot/ChatGPT could answer questions better. But these issues have been minor, given all my work on the project.
It has some quirks. There's no way to set the 404 page on the webserver. And the binary's location in the filesystem matters. It was designed for the author's use and you have to live with these choices.
As I said, I've been happy using it. It fit my needs exactly: simple and I could code everything in one language, TypeScript. Pocketbase is not high-performance, but I didn't need that. I've had a few ideas for side projects and, when I'm done this work, I'll implement one on Pocketbase because it is that easy.
And, as part of my contract, my friend's company will donate to Pocketbase. :)
I've been using Pocketbase in production for a few months now, with alpinejs on the front end.
The development philosophy is on point. It's genuinely pleasant, pragmatic software which serves a real purpose and it improves weekly without feature creep.
I watch the discussions and issues slowly getting more tiresome as it becomes more mainstream and worry that he'll burn out trying to keep up with the level of support he's offered until now.
I would very strongly encourage anyone using this to generate income to support the project on open collective.
I have been following PocketBase since its early day - what I absolutely love about this project is how it actively tries to avoid complexity and focuses on simple yet minimalist approach. Moreover, the ease of deployment by simply uploading a single binary on the server makes it even more attractive.
After they introduced Javascript support in the backend - I feel it became a serious contender to challenge Remix, Next.js etc. frameworks.
I use PocketBase for mostly everything where I need a back end now. I came across a situation where I needed to write a custom SQL join (technically I could have just fetched all the data and done it in Node, I suppose).
I was shocked at how easy it was to write the query even inserting URL parameters and selecting based on the authenticated user only.
Fully recommend for basically everything. Great app. Not sure it would replace Next or Remix, but definitely add to the stack to simplify.
I was looking for a frontend I could use out of the box on top of a sqlite database to design and store my wine collection (since I removed Vivino and its 800+ "partners" it shares my data with).
Looks like a single executable, the admin interface and the database I can store on my laptop (and add it to my backup) is all I was looking for. Thank you for PocketBase and thank you for sharing it.
It is great to see the number of good opensource projects in this area. Grist and NocoDB deserve mentions, although more targeted towards database management. It is also amazing that they provide so simple ways to get started (single file/electron)
I've skimmed at the docs, and it's not clear to me how it would deal with:
* Something like row-level access control, so that people can only access the data in tables that belong to them (say clients can only view their own purchases, and also not modify them after they checked them out).
* Integration with the rest of the world, e.g. sending email, acting on triggers, etc.
* Something like CSV export/import.
* Internationalization.
Would that all be possible? Straightforward? Do those all require extending (with go or js)?
Re internationalization, I think you're right. I don't have experience building app/websites, a fortiori with internationalization, so I threw this question in with the lot!
The first point (authn) is inherent to the unextended framework via filter rules.
Most of the remainder requires extension other than authz emails, but extension at its simplest just means adding a plain old JavaScript function to run on a record lifecycle event of some kind - typically [before/after] [insert/update/delete] of <record>. Various GO APIs are exposed to the JavaScript runtime for doing filesystem, cryptography, http, email, etc work.
Out of all the PaaS I tried including Supabase and Appwrite, Pocketbase is the best. Great performance, intuitive features, actually self hosted and a joy to deploy.
Have been using pocketbase in production for a mobile app for a couple of month now and so far it was a _very_ pleasent experience. Together with the JS SDK it is now my go to backend framework for everything where I don't need specialized libraries (like ML stuff etc.)
Example has
1. Auth
2. Route rules
3. CRUD actions
4. Realtime events
5. Storage
Needs refactoring but I really enjoyed working with it, I want to add stripe subscriptions to this taking routes rules to it's limits, not sure how yet, will figure it out.
Been using Pocketbase for almost all of my projects lately. Its realtime database is especially nice to introduce multiplayer functionality with relative ease.
It plus SvelteKit has been a dream to get up and running using the JS SDK.
For CRUD apps, sveltekits progressive enhancement and form actions make it quick to to add simple function to the page. You can store the pocketbase instance, pb, in locals and reference it all over the application.
For more multiplayer things, sticking a client-side subscription to a collection allows updates of elements that can be worked with/added/moved around etc.
I've been using Pocketbase for several projects. While it's a delightful experience for solo-dev to quickly finish a project from backend to complicated frontend, I wish it has bulk-insert out of the box.
More than one server. Sqlite should be thread safe and simple services can scale to thousands of parallal users. If you are OK with some downtime every 6 months when server goes down it will scale well. Deploy/ rollback will be an effort.
Gotcha. And that makes sense for the purpose of the project. Should one have multiple instances of sqlite dbs, what strategies exist to keep them synced?
I've been using Pocketbase for personal projects on the machine I use to self-host services. It's great. You get CRUD and real-time stuff for free and I didn't really have to spend much time learning to start working with it and having it running in an LXC.
This just looks like the "Event Bus" [1] [2] [3] pattern, this is not the one from the React world if you were thinking about that. Hooks here are just the following, the "Hook" is just a collection of event handlers.
type Handler[T any] func(e T) error
type handlerPair[T any] struct {
id string
handler Handler[T]
}
type Hook[T any] struct {
mux sync.RWMutex
handlers []*handlerPair[T]
}
It's very useful when you want to make an easily extensible library/framework/application, as you can see in pocketbase/core/app.go you can register handlers for various things that can happen.
I like the idea, but after using it, the query apis aren't expressive enough. I wish I could write SQL instead of making 2+ api calls to get the data I want.
It's a binary called "pocketbase" that you can download and run on your machine. When you run it, it starts a localhost web server. That server includes a web based UI tool that lets you create "collections" (effectively database tables) and insert/update/delete data in them.
More importantly, it provides a JSON API (and a client library) for interacting with those collections.
If you have ever built a web app backend that consists of a database, a REST API for that database, and a web admin interface to the database - well, this gives you all of that for free, just by running an executable.
Ok so essentially an easy to host activeadmin (rails library). I think the single executable that runs on every os makes it very interesting for usecases where data is generated into a static site
Aren't there entire classes of problems that shouldn't exist for SQLite because it's intended to be an embedded database, as opposed to a client/server architecture like Postgres/Supabase?
Beyond the standalone server mode, I'm able to literally import this as a library/framework right into my Go app (https://pocketbase.io/docs/go-overview/). Having a single binary that contains my custom business logic + a very nice DB/Auth/Admin/... is a very compelling option.
PocketBase is trying to be a simple webserver, code-running backend, and database. I believe the author chose SQLite because it is simple. PocketBase isn't trying to have every feature nor be high performance.
I feel like this will be super interesting when pairing with static site generator such as eleventy. Using static site generator is sometimes difficult because of lacking a web backend and ghost is too heavy for me.
Could you explain a bit more this setup? I have been looking for a way to have a tool to fill pages for a static site generator that's local and then just git push in a simplified way.
The idea is to create a website for my mother, without having to deal with hosting at all (static github pages).
Some static site generators have good support for generating pages from a dynamic source, say API, database or anything you can access using programming language.
See eleventy, for instance, has the “Javascript data files” [1], it run some JS code to generate a list of posts, here we can fetch from pocketbase, then, we can generate pages dynamically [2].
Pocketbase in this case just act as a lightweight CMS.
It is simple, so its single program is (1) a webserver, (2) runs server-side code, and (3) hosts a DB. I'm running a $12-per-month server on Vultr and its only service is PocketBase.
You don't need to host the webpages on PocketBase. If you wanted all your webpages to be on Github Pages, you could do that.
I like this for testing and quick/simple database, very useful in concept for building a platform for embedded work, where you don’t need to go down the rabbit hole in the whole full stack tech.
How are database migrations handled in this? Ive never understood how BaaSes are to be used when I need to add a new column to my table and do some inserts into it in the same migration
A lot of these tools just abstract away migrations. But I do know some like Supabase let you clone a copy locally and manually perform migrations if you see fit
Can this thing be used for a forum type site + a minimal game feature with around 5k daily users? How could you scale this with a single common database?
I mostly know Python. Is there something similar in Python? Or the backend language is not relevant, because you mostly use this from JavaScript anyway?
I have been building a project https://github.com/claceio/clace which aims to make building hypermedia based web applications easier. Clace is implemented in go, it uses Starlark (python syntax subset) for application configuration. With Clace, the apps are implemented using Starlark and (go) html templates, HTMX is used for web interface, app developer does not need to write any JavaScript.
If anyone is interested in extending I have done some work on it and can confirm it is quite easy. I extended it to be able to use stripe check it out below:
It can be the backend itself if you just need auth (both authentication and authorization) and your SQL tables to be a REST API. This often suits frontend single page applications in JS/TS and Pocketbase also provides a JS SDK to ease this (with realtime updates). It's a similar model to Firebase but without the lock-in.
However if you want to write more logic you can also import Pocketbase as a library and extend it with hooks, custom endpoints etc. all written in Go.
Edit: Added more info about using Pocketbase with a JS SPA frontend.
You would use it instead of things like Supabase and Appwrite. It gives you a server, a db and easy authentication, authorization with real-time queries like firebase.
Maybe it's not for me, I really don't know what that means. If it only describes itself as "a replacement for <name>" I feel like I'm not the target at all.
Depends on what you consider minimal, but I enjoy working with PocketBase and VanJS[1]. However there is no component library built in (if this is what you were asking for).
If you want a front-end for a single-page webapp, I loved Svelte. It puts all the HTML, JavaScript/TypeScript, and CSS together in the same place. The tutorial is delightful.
BUT, if you need a multi-page webapp, SvelteKit is complicated and not well documented.
It's like saying nginx is better than superbase/firebase. Apples to oranges.
You could replicate PocketBase in Readbean, but you would have to implement from scratch:
- resources with CRUD API and real time subscriptions
- admin UI
- authz & authn system
I didn't say it's better. Why are people always misinterperting what they read (it's like you've never had text interpretation classes at school, or logic lessons to undestand how to infer implications from logical statements correctly)?
Please read again: I said it's vastly simpler (which may not be better for you!) and lighter (just measure it). The comparison is apt for me because the description "open-source backend in one file" matches both projects well and it's something I'm interested in, with readbean being far closer to my alley.
Wanted to say thanks for the comment because TIL redbean, which in turn led me to learn about Justine Tunney, who appears to be a super-human programmer based on what I've read so far. Lots of inspirational discoveries on HN this weekend for me—Thanks ya'll!
Are you a developer? Because it seems to be geared towards developers. It's something like a all-in-one backend that you can use as a starting point and extend if needed.
Personally, I think the website is clear and concise. Doesn't even have any marketing filler which is a huge plus in my corner.
It is a simple program that (1) hosts a webserver, (2) runs server-side code, and (3) hosts a database. It also has built-in support for logging in and permissions to data.
Thus, if you want to write a simple website that needs permissions, storage, and server-side code, it's a great backend solution. The limitation is that it isn't high performance.
It's like a smaller Supabase, which was an open source alternative of Firebase. So basically a database, authentication, file storage, and backend in one solution.
Pro:
- It will be cheaper when scale
- You have full control of the data since selfhosted
- Easier to extend with custom code
Cons:
- you need to take care of all the hosting, backups, etc
- cant scale to infinity like firebase (but on the other hand when you reach that scale youe firebase bill will be huge anyway)
There’s something to be said about drastically reducing your threat surface too. Locking down 1 server is easier than locking down a fleet. You can still have security in depth inside your server.
TypeScript is support on the frontend for oldtimers like me who have used plain JS for far too long and refuse to accept the torture of unnecessarily untyped languages any longer.
Also as already mentioned by others there exist web APIs.
Pocketbase is amazing! So far I had a great experience using it as a backend/database for the app I'm building where I'm using React with Vite for the frontend. I'm using it mainly for auth and for keeping track of paid and free accounts. Some things that I found rather useful:
- It's super easy to host. I was initially thinking of using Appwrite or Supabase but found it a tricky to self-host them, especially Supabase. I could spin up Appwrite quickly via CapRover, but found it an overkill for what I needed.
- View collections [1] make it easy to return just a subset of the data that you need. In my case I'm using a view collection as a join for users and paid_users collections, where I just return their paid through date.
- The fact that you can extend it with Go or JS [2] should make it possible to completely skip having a backend, at least if your needs aren't very complex.
I definitely plan to continue using it for some smaller/side projects. Currently I'm thinking of trying to use it as CMS for an Astro blog and in the future as backend for some browser extensions.
[1] - https://pocketbase.io/docs/collections/#view-collection
[2] - https://pocketbase.io/docs/use-as-framework/
I feel like super easy to host needs to be re-emphasized. We're talking about dropping a single binary into your server and you're off to the races. If only more things were so simple.
Isn’t that how any Go project is put online?
1 reply →
Didnt docker make this easy for all projects?
2 replies →
Is that the same concept that Deno uses?
I've been developing on PocketBase for 2 months. The system goes into production in 1 to 2 months.
I'm exceptionally happy with it. I'm developing an webapp for a friend's company and wanted a very simple system to hand-off. The whole thing is running with one binary: Pocketbase. It runs a webserver, server-side Javascript (compiled TypeScript) code, and SQLite database. The single process is hosted on Vultr for $12 per month. My frontend is written in SvelteKit (static adapter) + Svelte + TypeScript.
Pocketbase is well done. The author has been exceptionally responsive to my questions. He is fast and clear.
I have had a few minor issues: The documentation has bare spots (but is very good for most things). I had to write my own CSV loader. (I hope to open-source it.) Writing lots of objects through the CRUD interface is slow. (It's possible to write faster using server-side code.) Unit testing for the server-side JavaScript had to be shoehorned in. And I wish Copilot/ChatGPT could answer questions better. But these issues have been minor, given all my work on the project.
It has some quirks. There's no way to set the 404 page on the webserver. And the binary's location in the filesystem matters. It was designed for the author's use and you have to live with these choices.
As I said, I've been happy using it. It fit my needs exactly: simple and I could code everything in one language, TypeScript. Pocketbase is not high-performance, but I didn't need that. I've had a few ideas for side projects and, when I'm done this work, I'll implement one on Pocketbase because it is that easy.
And, as part of my contract, my friend's company will donate to Pocketbase. :)
> And, as part of my contract, my friend's company will donate to Pocketbase. :)
What a positive way to give back! Kudos!
I've been using Pocketbase in production for a few months now, with alpinejs on the front end.
The development philosophy is on point. It's genuinely pleasant, pragmatic software which serves a real purpose and it improves weekly without feature creep.
I watch the discussions and issues slowly getting more tiresome as it becomes more mainstream and worry that he'll burn out trying to keep up with the level of support he's offered until now.
I would very strongly encourage anyone using this to generate income to support the project on open collective.
What other technologies in the stack you have?
There are two C# services which do some background bits and pieces.
This logic could have been put within pocketbase as well, but the body of work they depend on was already .net.
Other than that it's just little JavaScript callbacks in the back and typescript in the front.
There isn't much missing that you truly need to bolt things on for, provided SQLite is appropriate for your usecase.
I have been following PocketBase since its early day - what I absolutely love about this project is how it actively tries to avoid complexity and focuses on simple yet minimalist approach. Moreover, the ease of deployment by simply uploading a single binary on the server makes it even more attractive.
After they introduced Javascript support in the backend - I feel it became a serious contender to challenge Remix, Next.js etc. frameworks.
Looking forward to v1
I use PocketBase for mostly everything where I need a back end now. I came across a situation where I needed to write a custom SQL join (technically I could have just fetched all the data and done it in Node, I suppose).
I was shocked at how easy it was to write the query even inserting URL parameters and selecting based on the authenticated user only.
Fully recommend for basically everything. Great app. Not sure it would replace Next or Remix, but definitely add to the stack to simplify.
Interesting! I haven't made anything serious yet with the PocketBase (mostly due to lack of time & not anything to do with PB).
I'm curious to know what kind of projects did you build using PB and how was your development experience?
4 replies →
it actively tries to avoid complexity
Sounds refreshing.
I was looking for a frontend I could use out of the box on top of a sqlite database to design and store my wine collection (since I removed Vivino and its 800+ "partners" it shares my data with).
Looks like a single executable, the admin interface and the database I can store on my laptop (and add it to my backup) is all I was looking for. Thank you for PocketBase and thank you for sharing it.
That's why I always come back to HN :-)
It is great to see the number of good opensource projects in this area. Grist and NocoDB deserve mentions, although more targeted towards database management. It is also amazing that they provide so simple ways to get started (single file/electron)
- https://github.com/gristlabs
- https://nocodb.com/
Did not know about either of those, thanks. I've been using Baserow for small projects that I believe Pocketbase is a way better fit.
I've skimmed at the docs, and it's not clear to me how it would deal with:
* Something like row-level access control, so that people can only access the data in tables that belong to them (say clients can only view their own purchases, and also not modify them after they checked them out).
* Integration with the rest of the world, e.g. sending email, acting on triggers, etc.
* Something like CSV export/import.
* Internationalization.
Would that all be possible? Straightforward? Do those all require extending (with go or js)?
Looks like a nice tool.
I've been developing for PocketBase for 2 months.
As someone else mentioned, API rules can control access to rows.
It can send emails. Set timers. And send its own requests to other webservers. (I haven't used any of these features.) https://pocketbase.io/docs/js-sending-emails/
I had to write my own CSV importer. (I'm hoping to open-source it.)
As for internationalization, what specific features did you want? That seems more like a front-end feature.
Re internationalization, I think you're right. I don't have experience building app/websites, a fortiori with internationalization, so I threw this question in with the lot!
Check out
API Rules https://pocketbase.io/docs/api-rules-and-filters/#api-rules
Hooks https://pocketbase.io/docs/js-overview/
Admin panel has backups for data, and import/export of collections schema
The first point (authn) is inherent to the unextended framework via filter rules.
Most of the remainder requires extension other than authz emails, but extension at its simplest just means adding a plain old JavaScript function to run on a record lifecycle event of some kind - typically [before/after] [insert/update/delete] of <record>. Various GO APIs are exposed to the JavaScript runtime for doing filesystem, cryptography, http, email, etc work.
For i18n you have templates and a database.
Out of all the PaaS I tried including Supabase and Appwrite, Pocketbase is the best. Great performance, intuitive features, actually self hosted and a joy to deploy.
Have been using pocketbase in production for a mobile app for a couple of month now and so far it was a _very_ pleasent experience. Together with the JS SDK it is now my go to backend framework for everything where I don't need specialized libraries (like ML stuff etc.)
Pocketbase is amazing, I had made a small starter with nuxt 3.
https://github.com/fayazara/pocketbase-nuxt
Example has 1. Auth 2. Route rules 3. CRUD actions 4. Realtime events 5. Storage
Needs refactoring but I really enjoyed working with it, I want to add stripe subscriptions to this taking routes rules to it's limits, not sure how yet, will figure it out.
The demo is kind of incredible. It’s the admin ux of an app we built internally over 2ish years.
It’s just… right there :)
Been using Pocketbase for almost all of my projects lately. Its realtime database is especially nice to introduce multiplayer functionality with relative ease.
It plus SvelteKit has been a dream to get up and running using the JS SDK.
I’m curious how you’re integrating it with Sveltekit? Are you using Sveltekit just as a static generator?
Depends upon the project.
For CRUD apps, sveltekits progressive enhancement and form actions make it quick to to add simple function to the page. You can store the pocketbase instance, pb, in locals and reference it all over the application.
For more multiplayer things, sticking a client-side subscription to a collection allows updates of elements that can be worked with/added/moved around etc.
I've been using Pocketbase for several projects. While it's a delightful experience for solo-dev to quickly finish a project from backend to complicated frontend, I wish it has bulk-insert out of the box.
What are realistic bottlenecks to expect from a backend like this? Eg. a web app serving users that write posts simultaneously
More than one server. Sqlite should be thread safe and simple services can scale to thousands of parallal users. If you are OK with some downtime every 6 months when server goes down it will scale well. Deploy/ rollback will be an effort.
Gotcha. And that makes sense for the purpose of the project. Should one have multiple instances of sqlite dbs, what strategies exist to keep them synced?
Downside with separate SQLite databases will be when you want to have statistics over many users.
3 replies →
Very cool. Reminds me of the encore framework, also written in go: https://github.com/encoredev/encore
Need to spend some more time looking into these go based frameworks, they seem great for quick prototyping
Nope encore is horrible to use in comparison. Pocketbase is levels above encore and similar projects.
I've been using Pocketbase for personal projects on the machine I use to self-host services. It's great. You get CRUD and real-time stuff for free and I didn't really have to spend much time learning to start working with it and having it running in an LXC.
It is the first time I see that "hook" pattern in a Go API backend: `hook.Hook` and `hook.TaggedHook`.
Where does it come from?
Why is it useful here?
What are the alternatives? Advantages/Drawbacks?
Is there an article somewhere, outside of the Pocketbase docs, presenting that pattern?
- https://github.com/pocketbase/pocketbase/blob/master/core/ap...
- https://github.com/pocketbase/pocketbase/tree/master/tools/h...
This just looks like the "Event Bus" [1] [2] [3] pattern, this is not the one from the React world if you were thinking about that. Hooks here are just the following, the "Hook" is just a collection of event handlers.
It's very useful when you want to make an easily extensible library/framework/application, as you can see in pocketbase/core/app.go you can register handlers for various things that can happen.
[1]: https://en.wikipedia.org/wiki/Event-driven_programming
[2]: https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_patt...
[3]: https://en.wikipedia.org/wiki/Observer_pattern
Pocketbase seems really well done and useful.
I am building something similar but at a lower level and based on PostgreSQL.
https://github.com/sted/smoothdb
It aims to be compatible with the PostgREST API.
I like the idea, but after using it, the query apis aren't expressive enough. I wish I could write SQL instead of making 2+ api calls to get the data I want.
I'm no expert, but it seems like raw SQL is supported. From the docs:
"It also exposes app.Dao().DB() builder that allows executing various SQL statements (including raw queries)."
Yes, that's correct. In server-side code, you can write SQL queries.
JavaScript API: https://pocketbase.io/docs/js-database/ Go API: https://pocketbase.io/docs/go-database/
Did you try view collections, https://pocketbase.io/docs/collections/#view-collection ?
Looks like what you hope LibreOffice Base will be, when one first years of the existence of those kinds of tools.
Really nice, looks like something I'd love to work with someday!
I'm not sure I understand what exactly is. I like the tips, but I don't understand: is it an app that I can run on my local machine?
It's a binary called "pocketbase" that you can download and run on your machine. When you run it, it starts a localhost web server. That server includes a web based UI tool that lets you create "collections" (effectively database tables) and insert/update/delete data in them.
More importantly, it provides a JSON API (and a client library) for interacting with those collections.
But people build apps on top of it and deploy it to the cloud, too, right? Does it then compete with stuff like AWS RDS?
2 replies →
If you have ever built a web app backend that consists of a database, a REST API for that database, and a web admin interface to the database - well, this gives you all of that for free, just by running an executable.
Ok so essentially an easy to host activeadmin (rails library). I think the single executable that runs on every os makes it very interesting for usecases where data is generated into a static site
So it's the "Supabase of SQLite"?
Aren't there entire classes of problems that shouldn't exist for SQLite because it's intended to be an embedded database, as opposed to a client/server architecture like Postgres/Supabase?
And as such, I'm confused why this exists.
>And as such, I'm confused why this exists.
Beyond the standalone server mode, I'm able to literally import this as a library/framework right into my Go app (https://pocketbase.io/docs/go-overview/). Having a single binary that contains my custom business logic + a very nice DB/Auth/Admin/... is a very compelling option.
PocketBase is trying to be a simple webserver, code-running backend, and database. I believe the author chose SQLite because it is simple. PocketBase isn't trying to have every feature nor be high performance.
Like Althttpd?
That’s the web server created by the SQLite team and also serves sqlite.org
https://sqlite.org/althttpd/doc/trunk/althttpd.md
1 reply →
It's very common to use SQLite within backends, whenever concurrency is not a big issue.
PocketBase is amazing, I can achieve almost all my projects self hosted without any thirdparty on dockers with this
https://github.com/miguelgargallo/docker-pocketbase
I feel like this will be super interesting when pairing with static site generator such as eleventy. Using static site generator is sometimes difficult because of lacking a web backend and ghost is too heavy for me.
Could you explain a bit more this setup? I have been looking for a way to have a tool to fill pages for a static site generator that's local and then just git push in a simplified way.
The idea is to create a website for my mother, without having to deal with hosting at all (static github pages).
Does this combination work that way?
Yes.
Some static site generators have good support for generating pages from a dynamic source, say API, database or anything you can access using programming language.
See eleventy, for instance, has the “Javascript data files” [1], it run some JS code to generate a list of posts, here we can fetch from pocketbase, then, we can generate pages dynamically [2].
Pocketbase in this case just act as a lightweight CMS.
Is this what you’re talking about?
[1]: https://www.11ty.dev/docs/data-js/
[2]: https://www.11ty.dev/docs/pages-from-data/
1 reply →
No. PocketBase runs on a server. It needs a host.
It is simple, so its single program is (1) a webserver, (2) runs server-side code, and (3) hosts a DB. I'm running a $12-per-month server on Vultr and its only service is PocketBase.
You don't need to host the webpages on PocketBase. If you wanted all your webpages to be on Github Pages, you could do that.
1 reply →
I like this for testing and quick/simple database, very useful in concept for building a platform for embedded work, where you don’t need to go down the rabbit hole in the whole full stack tech.
How are database migrations handled in this? Ive never understood how BaaSes are to be used when I need to add a new column to my table and do some inserts into it in the same migration
PocketBase has a pb_migrations/ directory. If you throw a file of a certain format, PocketBase will automatically loaded it and update the DB.
Oh neat, that would absolutely do the job. Just git push and let the gitops do the rest!
A lot of these tools just abstract away migrations. But I do know some like Supabase let you clone a copy locally and manually perform migrations if you see fit
Can this thing be used for a forum type site + a minimal game feature with around 5k daily users? How could you scale this with a single common database?
5k daily users is basically nothing. Pocketbase would probably work well for you.
I mostly know Python. Is there something similar in Python? Or the backend language is not relevant, because you mostly use this from JavaScript anyway?
I have been building a project https://github.com/claceio/clace which aims to make building hypermedia based web applications easier. Clace is implemented in go, it uses Starlark (python syntax subset) for application configuration. With Clace, the apps are implemented using Starlark and (go) html templates, HTMX is used for web interface, app developer does not need to write any JavaScript.
Packaging this as a Python lib that could run under WSGI/ASGI and use all the awesome python libs would be amazing. I wonder if that's possible?
https://github.com/vaphes/pocketbase
Dart SDK, excellent. Just what I'm looking for.
If anyone is interested in extending I have done some work on it and can confirm it is quite easy. I extended it to be able to use stripe check it out below:
https://github.com/mrwyndham/pocketbase-stripe
I am a bit confused, is it the backend's backend? E.g. something that is used by the HTTP server app, like a DBMS would be?
Or is it actually the backend, e.g. the frontend (browser) talks to it directly?
It can be the backend itself if you just need auth (both authentication and authorization) and your SQL tables to be a REST API. This often suits frontend single page applications in JS/TS and Pocketbase also provides a JS SDK to ease this (with realtime updates). It's a similar model to Firebase but without the lock-in.
However if you want to write more logic you can also import Pocketbase as a library and extend it with hooks, custom endpoints etc. all written in Go.
Edit: Added more info about using Pocketbase with a JS SPA frontend.
Every tech/stack is a lock-in, you just pay with different currencies and get different challanges at different stages
You would use it instead of things like Supabase and Appwrite. It gives you a server, a db and easy authentication, authorization with real-time queries like firebase.
Maybe it's not for me, I really don't know what that means. If it only describes itself as "a replacement for <name>" I feel like I'm not the target at all.
1 reply →
This looks too good to be true for a project I had in mind—kudos!
Good Golang anda Svelte code organization, I Will take as example
So it's just auth + files on top of a db, essentially providing auth'd CRUD with extras? So you write the business logic in the frontend?
Didn't know tool like this existed. Thanks for sharing.
It looks really cool! I can imagine using this for small projects. I wonder if it would be possible to also support a GraphQL API in the future?
After ent.io entity framework, that's the other most beautiful piece of software that I have seen in Go!
The simplicity is simply mind boggling!
Going to give it a try!
Its URL is presumably https://entgo.io/ .
this is great. What would be the frontend equivalent? A simple, no bells and whistles frontend to throw something together quickly?
I was happy with Svelte. But it only does single-page apps. But it's simple and the tutorial is delightful.
When I moved to multiple pages, I had to use SvelteKit, which is complicated and not well documented.
When was the last time you used SvelteKit?
1 reply →
Simple is beautiful! I think it could be more than enough for 90% or more use cases, and without over-engineering.
What minimal front-ends are there that one could combine with this minimal back-end to provide a minimal end-to-end?
Depends on what you consider minimal, but I enjoy working with PocketBase and VanJS[1]. However there is no component library built in (if this is what you were asking for).
[1]: https://vanjs.org/
I would say
- htmx (https://htmx.org/)
- Alpine.js (https://alpinejs.dev/)
both are minimal and very easy to get started.
Been enjoying using PocketBase with Astro + htmx + Alpine
4 replies →
are you using one of them or both? I'm using htmx and not sure if I really need alpine.js yet.
If you want a front-end for a single-page webapp, I loved Svelte. It puts all the HTML, JavaScript/TypeScript, and CSS together in the same place. The tutorial is delightful.
BUT, if you need a multi-page webapp, SvelteKit is complicated and not well documented.
Really cool, I'll give it a try
It seems to me that redbean is a much simpler, vastly lighter one-file web server + sqlite DB: https://redbean.dev/
As a bonus, the same file runs on basically any OS without any dependencies on the local system, not even libc.
It's like saying nginx is better than superbase/firebase. Apples to oranges.
You could replicate PocketBase in Readbean, but you would have to implement from scratch: - resources with CRUD API and real time subscriptions - admin UI - authz & authn system
I didn't say it's better. Why are people always misinterperting what they read (it's like you've never had text interpretation classes at school, or logic lessons to undestand how to infer implications from logical statements correctly)? Please read again: I said it's vastly simpler (which may not be better for you!) and lighter (just measure it). The comparison is apt for me because the description "open-source backend in one file" matches both projects well and it's something I'm interested in, with readbean being far closer to my alley.
4 replies →
I think you meant supabase.com instead of superbase.com.
Fruits can be compared
To me it seems as if both tools serve a pretty different purpose.
Redbean doesn't have authentication or the client SDKs at least.
The self-described purpose is "opensource backend in one file". They both offer that.
Wanted to say thanks for the comment because TIL redbean, which in turn led me to learn about Justine Tunney, who appears to be a super-human programmer based on what I've read so far. Lots of inspirational discoveries on HN this weekend for me—Thanks ya'll!
I love redbean, just holding out for ARM support.
It's here! Download the nightly build, which is a fat binary for x86+arm:
Enjoy! I'll get a release out on redbean.dev soon.
1 reply →
How much can the "crud operations page" can be customized?
First time I hear about this... looks absolutely fantastic! Will try.
Cool homepage but I don't even understand what this thing does.
Are you a developer? Because it seems to be geared towards developers. It's something like a all-in-one backend that you can use as a starting point and extend if needed.
Personally, I think the website is clear and concise. Doesn't even have any marketing filler which is a huge plus in my corner.
It is a simple program that (1) hosts a webserver, (2) runs server-side code, and (3) hosts a database. It also has built-in support for logging in and permissions to data.
Thus, if you want to write a simple website that needs permissions, storage, and server-side code, it's a great backend solution. The limitation is that it isn't high performance.
It's like a smaller Supabase, which was an open source alternative of Firebase. So basically a database, authentication, file storage, and backend in one solution.
It's substantially better than Supabase and much easier to host and deploy.
Seems like a JavaScript based version similar to Django (Python)?
It's more a self-hosted alternative to Firebase written in golang
What are the pros/cons of this over firebase?
Pro: - It will be cheaper when scale - You have full control of the data since selfhosted - Easier to extend with custom code
Cons: - you need to take care of all the hosting, backups, etc - cant scale to infinity like firebase (but on the other hand when you reach that scale youe firebase bill will be huge anyway)
Very cool, but this is a security anti-pattern.
Having the auth, db and file server in the same service.. an attacker doesn't even need lateral traversal or privilege escalation once inside..
There’s something to be said about drastically reducing your threat surface too. Locking down 1 server is easier than locking down a fleet. You can still have security in depth inside your server.
Scouring the documentation there's mention of a way to use PocketBase without JavaScript or Dart. Are they the only methods?
TypeScript is support on the frontend for oldtimers like me who have used plain JS for far too long and refuse to accept the torture of unnecessarily untyped languages any longer.
Also as already mentioned by others there exist web APIs.
It seems to be Golang based from what I can tell? And I'm guessing it either exposes a HTTP or WebSocket API, both which are usable from any language.
This is correct. It's golang and it exposes a plentiful API.
[flagged]