Using PocketBase (Firebase Alternative) for your WebApps.

Anele Mbanga
3 min readOct 18, 2022

--

I got to test the “Open Source backend for your next SaaS and Mobile app in 1 file” tech stack today. Its called PocketBase I must say its a very interesting project. Below is a CRUD REST API based TailWindCSS + DaisyUI based Web Application.

Some time last month I started teaching myself TailwindCSS + DaisyUI and I must admit, as much as I did not really like TailwindCSS at first, finding the DaisyUI component library changed my mind.

So I embarked on creating myself a Toolkit, I call it SithasoDaisy, it is inspired by DaisyUI afterall. You can check it out on Netlify.

As I was saying, I downloaded a single file from the PocketBase website, opened my command prompt. Executed “pocketbase serve” where I unzipped the file.

I then copied the “Admin UI” link provided to my browser and an admin panel was available where I created an account and ended up creating a collection to test it out. All this still locally.

After everything was done, creating the schema of my “categories” to capture my “Expense Categories”, I went to my folder…

On the “pb_public” folder you can actually deploy your website. I stopped my laragon dev web server. I use Laragon for most of the WebDev i do. I copied my web project to the “pb_public.” folder.

I then proceeded to open my browser and used the provided link,
http://127.0.0.1:8090/ and my web project came to life.

Interestingly enough, after deploying the same app to Netlify with the PocketBase server still running on my side, the web app on netlify was still able to execute all the CRUD commands to my local database.

One of the nice features about PocketBase is the subscription model on CRUD transactions, indicating creation, updates and deletes, when you activate a subscription via code.

You can use fetch or axios for the REST API and also there is a JavaScript lib that interfaces the REST API nicely for PocketBase. The docs are very simple to follow.

You can see this play here…

Reach me out on Github, https://github.com/Mashiane/SithasoDaisyUI and twitter.

Happy Coding!

--

--