PocketBase — A unopinionated backend-as-a-service solution
PocketBase — A unopinionated backend-as-a-service solution
If you aren’t familiar with PocketBase… its an open-source backend as a service solution which comprises of just one single executable file.
I saw this project being featured in Fireship’s video. It looked really interesting to me and decided to give it a shot. Fast forward a couple of months, and I am now using PocketBase as my backend in many of my production side-projects. It has been an absolutely wonderful experience.
Let’s talk about why I think PocketBase is a perfect choice for a backend for small to medium scale projects (sometimes, even for large scale production apps!)
The Premise
PocketBase is marketed as a…
Open Source backend for your next SaaS and Mobile app in 1 file
And I think it gets that right. It’s a simple, no-nonsense solution which is extremely developer-friendly. The setup process of PocketBase is as simple as downloading the executable on your machine and… running it. Yep, it’s that simple.
Instead of writing schemas for your database, you can simply use their Admin dashboard and create the tables by a UI based workflow. They managed to make integration simpler for devs while still keeping the whole system simple enough for a non-dev to understand.
A Swiss Knife
If the whole “open-source free backend” wasn’t enough to convince you to use this amazing solution, let me also include that PocketBase manages user authentication, file storage, logging, & backups!
It does all of the above and then some, out of the box! All you need to do is configure stuff you want and don’t want. It supports OAuth authentication flows with major providers like Google, Microsoft, GitHub, Facebook, etc. It manages file uploads, thumb-size based recreation, protected file tokens, it performs logging for all requests and also has ability to take backups periodically.
And if you still need more custom functionality, you can completely extend PocketBase using either Go or JavaScript. It gives you access to APIs for database, email, file storage, OS-level actions, etc.
That’s an insane amount of features for a open-source solution.
Have your cake and eat it too
Another one of PocketBase’s great features is closed nature of data. When you use PocketBase, all data in the database is stored directly on your machine/server. Nothing goes out into the vast cloud. This makes it a perfect solution to use for building internal applications.
But during the whole development lifecycle, there comes a point where we need to go to a third-party, cloud-based solution for stuff like file storage, sending emails, etc. Now instead of writing a whole new system to adapt, you can simply extend PocketBase’s functionality.
If you are running low on disk space, PocketBase allows you to save your files to any S3-compatible object storage service (S3, DigitalOcean Spaces, Vultr, etc), out of the box! Configuring it is as simple as entering the bucket credentials.
Use external third-party S3-compatible storage options
The same can be done for email. You can configure your SMTP settings with some external service and it’s ready to go.
All this is completely optional to opt-in. This way, you can keep your data, secure on your servers, and still use fancy third-party technology to improve your application.
I think this is an absolute W for all devs who need to pick and choose outside services.
Lightning-fast hosting
Since PocketBase only comprises of a single executable file, hosting it on any internal server or on popular services like DigitalOcean, AWS, Linode, etc is as simple as uploading the executable and… running it. Yep. Again, it’s that simple.
It takes less than 5 minutes to setup PocketBase on a DigitalOcean Droplet. If you want to setup PocketBase on your own server, check out this tutorial I wrote some time back.
Besides, you can configure the IP it runs on, the port, domain name, CORS origins. Heck, it even generates a free SSL certificate for your domain using Let’s Encrypt.
Is it really production-ready?
By the time I am writing this, PocketBase is still at version 0.22.2. But according to this GitHub announcement, the creator is hoping to complete v1 alpha by the end of the year.
If you are building a weekend project, a hackathon project, or just a side-hustle, I can wholeheartedly endorse using PocketBase as your backend. It will fast-track your entire development, and your app will be done before you know it. It’s an awesome experience.
My take on whether PocketBase is ready for production or not is that, try it out yourselves. If the shoe fits…
I have seen many companies and developers use PocketBase in production for their different types of applications from blogs to primary databases. There’s a good chance that PocketBase will solve 90% of your problems. And if your problem lies within the 10%, maybe next time…
That has been my experience using PocketBase for the last couple of months. The reason I call it unopinionated, is because it doesn’t restrict you on developing in a certain manner. You are free to mix and match things till you get it right.
I am super duper hyped that PocketBase’s creator is doing all of this for open-source technology. It simplifies an individual developer’s life by a huge margin. Thank you ganigeorgiev
And now that PocketBase is slowly reaching v1, I might just stop using Firebase or Supabase.
Tags: Web Development, Backend As A Service, JavaScript, Go, Backend