Getting Started with PocketBase on SonicBit: A Step-by-Step Tutorial for Beginners
Picture this: you want to build a simple app that tracks your movie collection, stores notes, or even powers a small blog — but the moment someone says "database" or "backend," you feel your eyes glaze over. Setting up a server, installing PostgreSQL, writing REST APIs, and configuring authentication usually means hours of terminal work and a crash course in DevOps.
That's where PocketBase changes the game. It's an open-source backend that gives you a database, user authentication, file storage, and a REST API — all in a single executable file. No separate database server, no API framework to wire up, no terminal required if you host it on SonicBit.
In this tutorial, you'll learn how to deploy PocketBase on SonicBit with one click, create your first collection, add authentication, and connect a custom domain — all from the SonicBit web dashboard. By the end, you'll have a fully functional backend you can call from any app or website.
What Exactly Is PocketBase?
PocketBase bundles together everything you normally need to run a backend:
- SQLite database — stores your data in a single file, no separate database server
- User authentication — email/password, OAuth2 (Google, GitHub, etc.), and token-based auth out of the box
- Admin UI — a clean web interface for creating collections, managing records, and configuring rules
- REST API — every collection automatically gets full CRUD endpoints with filtering, pagination, and real-time subscriptions
- File storage — upload and serve files without configuring S3 or another storage service
For comparison, here's what a typical backend setup looks like with and without PocketBase:
| Task | Traditional Setup | PocketBase on SonicBit |
|---|---|---|
| Database server | Install PostgreSQL or MySQL, configure users and permissions | Built in (SQLite) |
| API framework | Write REST endpoints manually or use Express/Django | Auto-generated for every collection |
| Authentication | Implement signup, login, password hashing, JWT tokens | One toggle in the admin UI |
| File uploads | Configure S3, Cloudinary, or local storage logic | Built-in file field type |
| Hosting | Provision a VPS, set up Docker, configure reverse proxy | One-click deploy on SonicBit |
Prerequisites
Before you start, you'll need:
- A SonicBit account (the free plan works for testing, but I recommend at least the Starter plan at $2.45/month if you want enough storage for real data)
- A basic understanding of what a database is (you don't need to write SQL)
- Optional: a domain name if you want to access PocketBase from your own URL
Step 1: Deploy PocketBase from the SonicBit Dashboard
First, log in to your SonicBit dashboard. You'll land on your main overview page.
- In the left sidebar, click on Apps.
- Click the Install New App button.
- Scroll through the app list or search for PocketBase.
- Click the PocketBase card, then hit Install.
!Installing PocketBase from the SonicBit app store
SonicBit will now pull the PocketBase Docker image and spin up a container with all the necessary environment variables pre-configured. This usually takes about 30–60 seconds.
Once the status shows Running, you'll see a URL assigned to your PocketBase instance — something like https://pocketbase-xxxxx.sonicbit.net. Click it to open the PocketBase admin UI.
Important: On the first launch, PocketBase asks you to create an admin account. Use a strong email and password — this is your master key for managing collections and settings. The first registered admin is automatically the superuser.
Step 2: Create Your First Collection
PocketBase organizes data into collections — think of them like spreadsheet tables. Each collection has fields (columns) and records (rows). Let's create a simple collection for tracking a movie watchlist.
- In the PocketBase admin UI, click Collections in the left sidebar.
- Click New Collection.
- Choose Base collection (we'll build it from scratch).
- Name it
movies.
Now add these fields by clicking + Add field:
| Field Name | Field Type | Required | Notes |
|---|---|---|---|
title | Text | Yes | The movie title |
year | Number | No | Release year |
rating | Number | No | Your personal rating (1–10) |
watched | Boolean | No | Whether you've watched it |
notes | Editor | No | Longer text field for thoughts |
!Creating a new collection with fields in PocketBase
Click Create and your collection is live. PocketBase automatically generates REST API endpoints for it — no code required.
Add Some Records
Click on your movies collection, then New Record, and add a few entries:
title: "The Matrix"
year: 1999
rating: 10
watched: true
notes: "Still holds up. That lobby scene."
Add at least 3–4 records so you have data to work with.
Step 3: Test the API Without Writing Code
Here's the fun part. PocketBase exposes your data through a clean REST API. You can test it right in your browser.
Open a new tab and go to:
https://pocketbase-xxxxx.sonicbit.net/api/collections/movies/records
Replace pocketbase-xxxxx with your actual instance URL. You should see a JSON response containing all your movie records.
Want to filter? Try:
https://pocketbase-xxxxx.sonicbit.net/api/collections/movies/records?filter=(watched=true)&sort=-rating
That returns only watched movies, sorted by rating from highest to lowest. This is the same API you'd call from a React app, a mobile app, or even a simple HTML page.
Step 4: Add User Authentication
PocketBase includes authentication out of the box. Let's enable it for your movies collection so only logged-in users can access the data.
- Go to Collections and click your
moviescollection. - Click API Rules (top of the page).
- You'll see rules for
list,view,create,update, anddelete. - For
listandview, change the rule from""(public) to@request.auth.id != ""— this means "only authenticated users can read." - For
create,update, anddelete, use the same rule for now.
!Setting API rules to require authentication
Click Save. Now if you refresh the API URL from Step 3, you'll get a 401 Unauthorized error. That's expected — your data is now protected.
Test Authentication
To access protected data, you first need to authenticate. Open a terminal (or use a tool like Postman) and run:
curl -X POST https://pocketbase-xxxxx.sonicbit.net/api/collections/users/auth-with-password \
-H "Content-Type: application/json" \
-d '{"identity":"your-email@example.com","password":"your-password"}'
The response includes a token. Use it in subsequent requests:
curl https://pocketbase-xxxxx.sonicbit.net/api/collections/movies/records \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Now you get your movie data back. That's token-based auth working with zero custom code.
Step 5: Connect a Custom Domain
If you want to access PocketBase from your own domain (like api.yourdomain.com), SonicBit makes it straightforward.
- First, point your domain's DNS to SonicBit. Add a CNAME record for
api(or whatever subdomain you want) pointing to your SonicBit instance URL, or an A record pointing to the IP address shown in your SonicBit dashboard.
- In your SonicBit dashboard, go to your PocketBase app settings.
- Look for Custom Domain or Domain settings.
- Enter your full domain (e.g.,
api.yourdomain.com) and save.
- Wait a few minutes for DNS propagation and SSL certificate generation.
!Adding a custom domain to your PocketBase instance
Once SSL is provisioned, your PocketBase admin UI and API will be accessible at https://api.yourdomain.com. The _ admin route (for managing collections) is at https://api.yourdomain.com/_/.
Step 6: Build Something With It
Now that your PocketBase backend is live, here are a few quick ideas to test your setup:
- Connect from a simple HTML page: Use PocketBase's JavaScript SDK to list your movies collection in the browser. No build tools needed.
- Use it as a headless CMS: Create a
postscollection withtitle,content, andpublishedfields, then fetch it from a static site. - Power a mobile app prototype: PocketBase has SDKs for JavaScript, Dart (Flutter), and Swift — perfect for quickly building a data-driven app.
- Store form submissions: Create a
contact_messagescollection and point your website's contact form to the PocketBase API.
Why Run PocketBase on SonicBit Instead of Your Own Server?
You might be wondering why you shouldn't just install PocketBase on a VPS. You absolutely can — but here's what SonicBit handles for you:
- No terminal access needed: Everything happens through the web dashboard
- Automatic SSL certificates: SonicBit provisions and renews Let's Encrypt certs for every app
- Reverse proxy configured: Your PocketBase instance gets a clean URL immediately
- Resource isolation: Each app runs in its own Docker container, so PocketBase won't affect other apps
- Backups and snapshots: Managed through the dashboard, not manual cron jobs
If you're already using SonicBit for media apps like Plex or Sonarr, adding PocketBase to the same account keeps everything in one place.
What's Next?
Now that you have PocketBase running, here are some related articles to explore:
- Learn how to deploy Code Server on SonicBit for editing code directly in your browser
- Check out Gitea on SonicBit if you want version control for your projects
- Explore n8n on SonicBit to automate workflows that trigger when new PocketBase records are created
PocketBase is one of those tools that makes you wonder why backends were ever complicated. With SonicBit handling the deployment and infrastructure, you can go from zero to a working database-backed app in under ten minutes.
Sign up free at SonicBit.net and get 4GB storage. Download our app on Android and iOS to access your seedbox on the go.
Put it into practice — cloud storage with one-click apps and a built-in seedbox.
START FREE — 4 GB
