from Hacker News

Pocketbase: Open-source back end in one file

by dgudkov on 1/7/24, 6:08 AM with 149 comments

  • by rijavecb on 1/7/24, 12:41 PM

    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/

  • by mdnahas on 1/7/24, 9:07 PM

    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. :)

  • by jddj on 1/7/24, 12:17 PM

    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.

  • by BilalBudhani on 1/7/24, 9:03 AM

    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

  • by melicerte on 1/7/24, 4:30 PM

    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 :-)

  • by karencarits on 1/7/24, 12:12 PM

    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/

  • by notyoutube on 1/7/24, 1:06 PM

    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.

  • by ilrwbwrkhv on 1/7/24, 4:15 PM

    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.
  • by sonovice on 1/7/24, 9:48 AM

    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.)
  • by fayazara on 1/8/24, 5:22 AM

    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.

  • by efields on 1/7/24, 8:06 PM

    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 :)

  • by Ilasky on 1/7/24, 12:01 PM

    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.

  • by thangngoc89 on 1/7/24, 10:38 AM

    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.
  • by WM6v on 1/7/24, 11:41 AM

    What are realistic bottlenecks to expect from a backend like this? Eg. a web app serving users that write posts simultaneously
  • by fullstackchris on 1/7/24, 3:39 PM

    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

  • by rbosinger on 1/7/24, 5:44 PM

    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.
  • by jadayesnaamsi on 1/7/24, 4:36 PM

    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...

  • by twsted on 1/7/24, 1:28 PM

    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.

  • by turtlebits on 1/7/24, 6:40 PM

    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.
  • by eternityforest on 1/7/24, 11:47 AM

    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!

  • by Fire-Dragon-DoL on 1/7/24, 7:50 PM

    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?
  • by tiffanyh on 1/7/24, 6:54 PM

    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.

  • by miguelgargallo on 1/13/24, 5:25 PM

    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

  • by chazeon on 1/7/24, 3:25 PM

    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.
  • by tamimio on 1/7/24, 4:51 PM

    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.
  • by tommica on 1/7/24, 8:23 PM

    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
  • by mihalycsaba on 1/8/24, 9:36 AM

    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?
  • by rolisz on 1/7/24, 11:10 AM

    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?
  • by account-5 on 1/7/24, 11:35 AM

    Dart SDK, excellent. Just what I'm looking for.
  • by mrwyndham on 1/8/24, 2:52 AM

    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

  • by remram on 1/7/24, 3:24 PM

    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?

  • by imperialdrive on 1/7/24, 7:48 PM

    This looks too good to be true for a project I had in mind—kudos!
  • by igtztorrero on 1/7/24, 2:50 PM

    Good Golang anda Svelte code organization, I Will take as example
  • by RamblingCTO on 1/8/24, 1:18 PM

    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?
  • by xsumirx on 1/7/24, 12:33 PM

    Didn't know tool like this existed. Thanks for sharing.
  • by Humphrey on 1/8/24, 12:06 AM

    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?
  • by wg0 on 1/7/24, 7:53 PM

    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!

  • by air7 on 1/7/24, 4:34 PM

    this is great. What would be the frontend equivalent? A simple, no bells and whistles frontend to throw something together quickly?
  • by jarekceborski on 1/7/24, 9:04 PM

    Simple is beautiful! I think it could be more than enough for 90% or more use cases, and without over-engineering.
  • by 082349872349872 on 1/7/24, 11:15 AM

    What minimal front-ends are there that one could combine with this minimal back-end to provide a minimal end-to-end?
  • by oschvr on 1/7/24, 9:05 AM

    Really cool, I'll give it a try
  • by brabel on 1/7/24, 10:58 AM

    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.

  • by Fire-Dragon-DoL on 1/7/24, 11:56 PM

    How much can the "crud operations page" can be customized?
  • by bambax on 1/7/24, 12:19 PM

    First time I hear about this... looks absolutely fantastic! Will try.
  • by saasjosh on 1/7/24, 12:01 PM

    Cool homepage but I don't even understand what this thing does.
  • by punnerud on 1/7/24, 1:24 PM

    Seems like a JavaScript based version similar to Django (Python)?
  • by zffr on 1/7/24, 3:44 PM

    What are the pros/cons of this over firebase?
  • by TruthWillHurt on 1/7/24, 1:23 PM

    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..

  • by doublerabbit on 1/7/24, 12:02 PM

    Scouring the documentation there's mention of a way to use PocketBase without JavaScript or Dart. Are they the only methods?