Summary
Directus has been my default backend on a lot of projects. But every so often I want a backend that is one binary and one file on disk, with no Postgres to babysit, and that is where PocketBase earns its place.
You download an executable, run it, and you have a REST API, an embedded SQLite database, file storage, realtime subscriptions, OAuth2, and a genuinely good admin dashboard. No containers required, no external services, nothing to wire together. It is the smallest pile of infrastructure I know of that still counts as a real backend.
This guide goes wide on the platform first: collections and schema, the API rules engine that is the entire security model, auth as stateless tokens instead of sessions, files, realtime, migrations, JavaScript hooks, and how to harden the thing before it faces the internet. Then we build something real on top of it, a small CMS with posts and pages, in Astro and Datastar, with login handled server side so the browser never holds a token.
One honest note up front: PocketBase is still pre-1.0, and its own documentation says so out loud. I cover what that actually costs you in practice, and where I would still reach for Directus instead.
This is a living document and will be updated as PocketBase updates.
What PocketBase Actually Is
I've reached for Directus on a lot of projects, and I have written a whole guide about why. But there is a shape of project where Directus is more machine than the job needs: an internal dashboard, a side tool, a prototype that might become a product, something that has to run on a cheap box and stop being my problem in six months. For those, I reach for PocketBase.
The pitch is refreshingly small. You download one executable. You run it. That is the install.
./pocketbase serveThere is no database to provision, no container to compose, no environment file with nine required values. The database is SQLite, embedded in the process. The admin dashboard is compiled into the same binary. When you back it up, you are copying a directory.
What you actually get
For that one file, you get a REST-ish API over every collection you define, an embedded SQLite database, a real auth system with OAuth2 and multi-factor support, file storage with on-the-fly thumbnails, realtime subscriptions over server-sent events, scheduled jobs, and an admin UI that is genuinely pleasant to use. You can extend it with JavaScript hooks dropped in a folder, or compile it into your own Go program and treat it as a framework.
That list would be unremarkable for a platform that needs Postgres, Redis, and a worker tier. Getting it from a single process is the interesting part.
The honest caveat, up front
PocketBase is at v0.40 as I write this (v0.40.6, November 2026), and it has not hit 1.0. Its own documentation says, in plain language, that it is not recommended for production-critical applications unless you are comfortable reading the changelog and applying manual migration steps from time to time.
I want that on the table in chapter one rather than buried in a footnote, because it is the single fact that should shape whether you use it. Minor versions have moved things. The admin concept got renamed to superusers in v0.23. The rate limiter arrived in v0.23, superuser IP restrictions in v0.38, and v0.40 moved to Go's new JSON package, which its release notes tell you to test locally before you ship. None of that is chaotic, and the changelogs are good, but you are signing up to read them.
What this means in practice: pin your version, read release notes before you upgrade, and do not point a business-critical billing system at it and walk away for a year. For everything else, I have found it far more solid than the version number suggests.
Where it fits next to Directus
I am not going to pretend I have switched. Directus is still where I start when there are non-technical editors, when the data belongs in Postgres, when a team needs granular roles, or when the project will outlive my involvement.
PocketBase wins when the ops budget is close to zero. One binary on one box, one directory to back up, no connection strings. It wins when you want the whole backend to be a build artifact you can scp. It wins for prototypes that need real auth on day one instead of day thirty.
The last toolkit chapter takes the comparison head on, with a table and an actual recommendation. Until then I will note the differences where they come up rather than relitigating them every chapter.
How this guide is shaped
Two acts.
Act one goes wide on the platform: getting it running, modeling collections, the API rules engine that is the security model, auth as stateless tokens, files and realtime, migrations, extending it with JavaScript, and hardening it for the internet. This is the part you will come back to.
Act two builds something real on top: a small CMS with posts and pages, in Astro and Datastar, with login handled entirely server side. It exists to prove the reference act is true, and to surface the interesting friction you only hit when you build the thing.
Where this series already covers a topic properly, I will point you at it rather than repeat myself. Datastar has its own guide. So does auth as a discipline.
Let's get it running.
Ten Minutes to a Running Backend
Before we talk about collections or rules, get the thing running. PocketBase is one of the few backends where doing this first actually makes sense, because there is nothing to configure before you can poke at it.
The binary
Grab the release for your platform from the GitHub releases page, unzip it, and run it:
./pocketbase serveYou get two URLs on stdout. One is the REST API, the other is the admin dashboard at /_/. Open the dashboard and it walks you through creating the first superuser account.
That account is not a row in a normal table. It lives in _superusers, a built-in auth collection with one defining property: superusers bypass every API rule you will ever write. They see everything and can change everything. Treat those credentials the way you would treat database root.
Or Docker, if you prefer
There is no official image, but the Dockerfile is about six lines and the community ones are fine. The only thing that genuinely matters is the volume:
services:
pocketbase:
image: ghcr.io/muchobien/pocketbase:latest
ports:
- "8090:8090"
volumes:
- ./pb_data:/pb/pb_data
- ./pb_hooks:/pb/pb_hooks
- ./pb_migrations:/pb/pb_migrationspb_data is the whole application: the SQLite files, uploaded files, settings, logs. Lose it and you have lost the app. Mount it, back it up, and never let it live only inside a container layer.
I use the binary directly on a VPS and Docker on my laptop, mostly because the binary plus a systemd unit is less machinery than a container runtime for something that has no dependencies to isolate.
The directories
After the first run you will have:
pocketbase # the executable
pb_data/ # database, files, settings, logs
pb_migrations/ # schema history as JS files
pb_hooks/ # optional JS extensionsFour things, and two of them are optional. This is most of why I like it.
A tour of the dashboard
The dashboard is worth ten minutes of clicking, because a lot of PocketBase's surface is only discoverable there.
Collections is where you define your data. There is a schema editor, and next to it a rules panel that controls access. Those two live side by side deliberately, which tells you something about how the product thinks.
Logs shows real requests with status codes and timing, filterable. It is more useful than it sounds when a rule is silently filtering your results and you cannot work out why.
Settings holds SMTP config, S3 storage, backups, rate limiting, OAuth2 providers, and the token secrets. Most of the hardening chapter is a guided tour of this screen.
Under Settings you will also find Backups, which produces a ZIP of pb_data on demand or on a schedule, to local disk or S3. It has been there since v0.16 and it is the single best reason to not hand-roll your own backup script, at least until your data crosses a couple of gigabytes.
Prove the API works
Create a collection called notes with a text field, set its List rule to an empty string (which means public, and which we will unpack properly in a moment), add a record in the dashboard, then:
curl http://127.0.0.1:8090/api/collections/notes/recordsYou should get JSON with your record, pagination metadata, and no configuration on your part. That endpoint appeared the moment the collection did.
That is the loop that makes PocketBase pleasant: define a collection, get an API. The rest of act one is about controlling that API, and the very next thing to understand is how collections are actually shaped.
Collections and Schema
A collection is a table plus an API plus a set of access rules. PocketBase does not really separate those ideas, and once you stop expecting it to, the model gets simple.
There are three kinds, and picking the right one is most of the design work.
Base collections
The default. A normal table with the fields you define, full CRUD over the API, and a set of rules. Your posts, your invoices, your telemetry. Most of what you build is base collections.
Every one gets id, created, and updated for free. The id is a 15-character random string rather than an integer, which is a small gift the first time you need to expose a record in a URL without leaking how many customers you have.
Auth collections
A base collection with authentication bolted on: email, password, verification state, token handling, OAuth2 providers, and the login endpoints. The stock one is users, and you can create more.
That last part is worth pausing on. If you have customers and staff and they genuinely have different fields and different login flows, they can be two separate auth collections with independent providers and rules. That is a cleaner answer than one users table with a role field and a lot of conditional logic. It is also a decision that is annoying to reverse, so think about it before you have ten thousand rows.
Auth collections get a sixth access rule the others do not have, manageRule, which lets one authenticated user administer another's account. It is how you build "an org owner can reset their team member's password" without handing out superuser access.
View collections
A saved SQL query exposed as a read-only collection.
SELECT
p.id,
p.title,
p.author,
COUNT(c.id) AS comment_count
FROM posts p
LEFT JOIN comments c ON c.post = p.id
GROUP BY p.idThis is the escape hatch for anything the relation system cannot express: aggregates, unions, reporting shapes. They are read-only, they get API rules like anything else, and they are recalculated on read. Do not reach for one until a base collection has genuinely failed you, but be glad it is there when that happens.
Fields
The field types are the ones you would guess: text, editor, number, bool, email, url, date, select, json, file, relation, autodate, and geoPoint. A few notes from having been bitten.
Relation fields carry a max-select. Set it to one and you have a many-to-one. Leave it unbounded and you have many-to-many. The distinction matters enormously later, because filtering an array-valued relation needs different operators than filtering a single one, and forgetting that is the most common rule bug I see.
File fields store on disk under pb_data by default, or S3 if you configure it. Images get thumbnails generated on request through a query parameter, no build step.
Select fields are stored as text with a constraint, and single versus multiple has the same array consequence as relations.
JSON is there and it works. It is also a place data goes to become unqueryable, so use it for genuinely unstructured payloads rather than as a way to avoid designing a schema.
Indexes and uniqueness
Uniqueness in PocketBase is an index, not a field property. In the collection editor, add a unique index on the field. This trips people up because the field editor has no "unique" checkbox where you expect one.
You will want this immediately for slugs:
CREATE UNIQUE INDEX idx_posts_slug ON posts (slug)Add indexes for anything you filter or sort on regularly. It is SQLite underneath, and SQLite is fast right up until it is doing a full scan on every request.
Relations, expanded
Fetching related records is a query parameter rather than a join you write:
curl "http://127.0.0.1:8090/api/collections/posts/records?expand=author,tags"Expanded records land under expand in the response, and you can nest one level deep with dot notation. Two things to know: expansion respects the related collection's view rule, so a user who cannot see authors gets a post with no author expanded rather than an error, and every expand costs another query.
Now that you can shape data, the next chapter covers the part that decides who gets to see any of it. In PocketBase, that is not a separate permissions system bolted on the side. It is a small expression on each collection, and it is the whole ballgame.
API Rules: The Whole Security Model
Most backends give you a permissions system: roles, policies, grants, some matrix you fill in. PocketBase gives you five text boxes per collection. That is the entire model, and it is better than it sounds once you understand one thing that trips up almost everybody.
The five rules, and a sixth
Every collection has:
listRulefor listing recordsviewRulefor fetching one recordcreateRulefor creatingupdateRulefor modifyingdeleteRulefor deleting
Auth collections add options.manageRule, covered in the last chapter.
Each is either empty, locked, or an expression. Those three states are the first thing to get straight, because the difference between two of them is invisible in the UI and enormous in production.
Locked, empty, expression
Locked is the default, shown as a null or a padlock in the dashboard. Only superusers can perform the action. Everyone else gets a 403. This is the safe default and it is why a fresh collection appears broken over the API: it is not broken, it is closed.
Empty string means anyone. Not "any logged-in user", but anyone at all, including an anonymous request from the open internet. An empty rule is a public rule.
Read that twice, because "locked" and "empty" sound like synonyms in English and mean opposite things here. A padlock is closed to the world. An empty box is open to it.
An expression means the request must satisfy the filter.
// only the owner, and only if they are logged in
@request.auth.id != "" && author = @request.auth.idThe thing that actually matters: rules are filters
Here is the idea that makes PocketBase's model click, and the reason I like it more than a conventional grant matrix.
An API rule is not evaluated once as allow-or-deny. It is appended to the query as a WHERE clause.
So a listRule of status = "published" does not reject requests for draft posts. It makes draft posts not exist as far as that request is concerned. The list endpoint returns published records and says nothing about the others. There is no leak, because there was never a second query to leak from.
This has a consequence worth internalizing: you very rarely need a separate "public" endpoint. You need one collection whose rules describe who sees what, and the same endpoint serves an anonymous reader, a logged-in author, and an editor, each getting a different result set from identical code.
It also means a filtering bug and a security bug are the same bug. That is a fair trade, but it does mean the rules deserve real attention rather than a quick pass before launch.
The status codes are not consistent, on purpose
When a rule is not satisfied, what comes back depends on which rule it was:
Rule | Unsatisfied response |
|---|---|
| 200 with an empty list |
| 400 |
| 404 |
any rule, when locked | 403 |
The 404s are deliberate. Returning 403 for a record you are not allowed to view would confirm the record exists, which is an information leak on any resource with guessable identifiers. A 404 says nothing.
The practical annoyance is that during development, a rule bug and a genuine typo in a record id look identical. When a request 404s and you are certain the record is there, suspect the rule before you suspect yourself. The Logs screen in the dashboard is the fastest way to confirm it.
A worked set
For the CMS we build in act two, the posts collection ends up close to this:
// listRule and viewRule: published posts are public,
// and authors can always see their own drafts
status = "published" || author = @request.auth.id
// createRule: any logged-in user, and they cannot forge authorship
@request.auth.id != "" && @request.body.author = @request.auth.id
// updateRule and deleteRule: owner only
@request.auth.id != "" && author = @request.auth.idFour short expressions, and the whole editorial permission model falls out of them. An anonymous reader sees published posts. An author sees those plus their own drafts. An author can't write a post under someone else's name, because the create rule checks the submitted body rather than trusting it.
That @request.body.author check is the kind of thing that is easy to forget and expensive to miss. The next chapter is about the filter language those expressions are written in, including the operators that exist specifically to stop you making that mistake.
Filters in Anger
The same little expression language runs your API rules and your query filters. Learn it once and you have learned both. It looks like SQL's cousin, it is not SQL, and the places it differs are exactly the places people get hurt.
The shape
Everything is OPERAND OPERATOR OPERAND, combined with &&, ||, and parentheses. Comments with // are allowed, which is more useful than it sounds when a rule grows past one line.
Operands come from three places: your own schema fields (including dotted paths through relations, like author.role), @request.* for the current request, and @collection.* for reaching into a collection you are not related to.
The @request namespace
This is where the request lives:
@request.auth.*is the authenticated record.@request.auth.id != ""is the idiomatic "is somebody logged in".@request.body.*is the submitted data, and it is how you validate a write before it lands.@request.query.*and@request.headers.*are what you would expect. Headers are lowercased with dashes turned into underscores, soX-Api-Keyis@request.headers.x_api_key.@request.methodis the HTTP verb.@request.contexttells you how the request arrived:default,oauth2,otp,password,realtime, orprotectedFile. Useful for rules that should behave differently over a realtime subscription than over a normal fetch.
Operators, including the one everybody forgets
The comparisons are ordinary: =, !=, >, >=, <, <=, plus ~ for contains and !~ for does not contain.
Then there is the prefix ?, and this is the one that matters.
When a field holds multiple values (a multi-relation, a multi-select, a file field), a plain operator applies to all of them. Prefixing with ? makes it "at least one".
// every tag must be "astro". almost certainly not what you meant
tags.name = "astro"
// at least one tag is "astro". this is what you meant
tags.name ?= "astro"I have written the first one and spent twenty minutes wondering why a correct-looking rule returned nothing. If a rule touches a field that can hold more than one value, stop and decide which you want.
Modifiers
These attach to a field with a colon and do most of the heavy lifting in real rules:
:issetasks whether a key was submitted at all.@request.body.role:isset = falseis how you stop a user setting a field they should never touch.:changedasks whether a submitted value actually differs from what is stored. Good for "the slug may not be edited after publish".:lengthcounts array items.tags:length <= 5.:eachapplies a condition to every element of an array.:lowergives you case-insensitive comparison.
:isset and :changed are the two that turn a permissive update rule into a safe one, and they are the two people do not know exist. A rule like this is worth more than a paragraph of documentation:
// owners can update their post, but cannot reassign it
@request.auth.id != "" &&
author = @request.auth.id &&
@request.body.author:changed = falseDates
There are macros: @now, @yesterday, @tomorrow, @todayStart, @todayEnd, @monthStart, @yearEnd, and friends, down to @second.
// scheduled publishing, entirely in a rule
status = "published" && published <= @nowEvery one of them is UTC. If your app cares about "today" in a user's local timezone, these macros will be wrong for somebody by up to a day, and it will be the kind of bug that only shows up for the user in Auckland. Compute the boundary in application code and pass it as a filter parameter when the timezone genuinely matters.
There is also geoDistance() for haversine distance in kilometres, and strftime() if you need SQLite date formatting.
The traps
Five things that have cost me time:
- Empty rule means public. Said in the last chapter, repeated here because it is the one that leaks data.
- Array fields need `?`. See above.
- Uploaded files are not in `@request.body`. File uploads bypass body-based field checks entirely, so a rule that guards a field cannot guard an upload. Validate file constraints on the field (size, MIME type) and in a hook if you need more.
- Superusers ignore everything. Testing a rule while logged into the dashboard as a superuser proves nothing. Test with a real user token, or an incognito window.
- `@collection.*` joins can leak. Reaching into an unrelated collection is powerful and it does not inherit that collection's rules the way an
expanddoes. Be specific about the join condition.
You can now describe who sees what. The next chapter is about how PocketBase decides who somebody is, and it works differently from nearly every auth system you have used.
Auth: Tokens, Not Sessions
PocketBase has no sessions. There is no session table, no server-side store, nothing to invalidate. A client is authenticated for exactly as long as it sends a valid token, and the server decides validity by checking a signature.
If you have built auth the traditional way, this inverts a couple of assumptions worth spelling out. If you want the fundamentals of auth as a discipline, passwords, cookie flags, attack surface, I wrote a separate guide about it. This chapter is specifically how PocketBase does it.
The token
Log in and you get a JSON Web Token, signed HS256, with an expiry claim. Send it on subsequent requests:
Authorization: YOUR_AUTH_TOKENNote there is no Bearer prefix required. PocketBase accepts the raw token.
The server keeps no record of having issued it. Validity is a signature check plus an expiry comparison, which is why the whole thing scales to a lot of concurrent clients on a small box, and why the next section is the important one.
There is no logout
Because nothing is stored, nothing can be revoked. Logging out is authStore.clear() on the client: you throw the token away.
If somebody else already has that token, it keeps working until it expires. There is no endpoint you can call to kill it.
This is the single most important consequence of the design, and it drives real decisions:
- Keep token lifetimes short enough that a leaked token stops mattering reasonably soon.
- Do not put the token anywhere a script can read it, which is the whole argument for the httpOnly cookie approach we take in act two.
- When you genuinely must invalidate everything, change the collection's auth token secret in Settings. That rotates the signing key and every token signed with the old one dies at once. It is a sledgehammer, it logs out every user, and it is the only revocation there is.
authRefresh
authRefresh takes a valid token and hands back a new one with a later expiry, along with the current record.
const pb = new PocketBase('https://pb.mysite.com')
pb.authStore.loadFromCookie(cookieHeader)
if (pb.authStore.isValid) {
await pb.collection('users').authRefresh()
}It does not invalidate the old token. Both work until the original expires. That is fine, and it is worth knowing before you assume refreshing is a rotation.
Two useful side effects: it confirms the record still exists and is not disabled, and it gives you fresh field values. Calling it once per request is the pattern act two uses.
Superusers
_superusers is its own auth collection with one special property: its members bypass every API rule. No filtering, no restrictions, full read and write on everything.
Some consequences:
- Never test rules as a superuser. You will conclude everything works.
- Superusers cannot log in with OAuth2. Password and OTP only.
- v0.38 added the ability to restrict superuser access to specific IPs or subnets, and you should use it on anything public.
API keys, sort of
PocketBase has no API key feature. What it has is impersonation.
A superuser can mint a token that authenticates as a given record, with a duration you choose:
curl -X POST \
"https://pb.mysite.com/api/collections/users/impersonate/USER_ID" \
-H "Authorization: SUPERUSER_TOKEN" \
-d '{"duration": 31536000}'That token is non-renewable and long-lived, which makes it a serviceable API key for a server-to-server integration. Create a dedicated service user, scope it with rules like any other user, and impersonate it once.
The catch is revocation, again. You cannot cancel one. Killing an impersonate token means changing the superuser password or rotating the collection's token secret, which takes out everything else too. Treat these as credentials you rotate on a schedule rather than mint casually.
Verification and password resets
Both work out of the box and both send email, which means neither works until SMTP is configured. The default is the local sendmail, and mail from a random VPS lands in spam essentially always. Configure a real SMTP provider in Settings before you test these flows, or you will debug a mail problem while thinking you have an auth problem.
Password auth is the boring path and it is solid. The interesting flows, social login, one-time codes, and second factors, are next.
OAuth2, OTP, and MFA
Everything in this chapter is a checkbox in the dashboard plus a small amount of client work. That is genuinely the appeal: features that are a two-week project on a hand-rolled stack are an afternoon here.
OAuth2
Enable a provider on the auth collection, paste in a client id and secret, and PocketBase handles the dance. Google, GitHub, Microsoft, Discord, Apple, GitLab, and a long tail of others ship built in.
One detail causes most of the setup failures. The redirect URL you register with the provider must be:
https://pb.mysite.com/api/oauth2-redirectNot a route in your app. PocketBase's own endpoint, on the PocketBase host. Your application never sees the callback directly. Get this wrong and the provider will reject the flow with a redirect_uri mismatch, which is at least an honest error message.
From there you have two options.
The all-in-one flow opens a popup, handles the exchange, and resolves with an authenticated store:
const authData = await pb.collection('users').authWithOAuth2({ provider: 'github' })Convenient, and it assumes a browser with popups and client-side token storage. If you are doing server-side auth with httpOnly cookies, as we will in act two, this is not the one you want.
The manual flow gives you the pieces: list the providers, build the authorization URL yourself, receive the code on your own route, and exchange it server side with authWithOAuth2Code. More work, and it keeps the token out of the browser entirely.
A wrinkle worth knowing: when a user signs in with a provider whose email matches an existing account, PocketBase links them by email. That is usually what you want and occasionally is not, so decide deliberately whether you require verified email before linking.
One-time passwords
OTP is passwordless login by emailed code. Enable it, then:
const req = await pb.collection('users').requestOTP('reader@mysite.com')
// req.otpId, plus an email on its way
await pb.collection('users').authWithOTP(req.otpId, '123456')Note what the first call returns: an otpId, and it returns one whether or not that email belongs to a real account. That is deliberate enumeration protection. An attacker cannot use the OTP endpoint to discover which addresses are registered, because every request looks identical.
Do not undo that by being helpful in your own UI. "No account with that email" on the screen defeats the whole mechanism.
A nice side effect: successfully completing an OTP login marks the address verified, since the user demonstrably received mail there.
Multi-factor
Turning on MFA changes the shape of the login response, and this is the part that surprises people.
With MFA enabled, a successful first-factor login returns 401 with an mfaId in the body. That is not a failure. It means "correct so far, now prove it a second way".
try {
await pb.collection('users').authWithPassword(email, password)
} catch (err) {
const mfaId = err.response?.mfaId
if (!mfaId) throw err
// second factor: an emailed code
const req = await pb.collection('users').requestOTP(email)
await pb.collection('users').authWithOTP(req.otpId, code, { mfaId })
}The rule is that the two factors must be different methods. Password then OTP works. Password then password does not.
Writing the happy path as a catch block feels wrong the first time. It is how the API is shaped, so handle 401 with an mfaId as a distinct state in your login flow rather than lumping it in with bad credentials, or your users will be told their password is wrong when it is not.
What I would actually turn on
For a small CMS with a handful of authors: password login, verification on, and MFA required for anything with elevated privileges. OAuth2 if the authors already live in a Google or GitHub org, because it removes a password from the world.
For a public app with a consumer audience: OAuth2 as the primary path and OTP as the fallback, so most people never create a password at all.
For superusers, always MFA, plus the IP restriction from the last chapter. That account bypasses every rule you wrote.
Auth is handled. Next up, the three features that make PocketBase feel like more than a database with a REST wrapper: files, realtime, and the backup system.
Files, Realtime, and Backups
Three features that arrive free with the binary. Individually none is remarkable. Together they are most of the reason you do not need four other services.
Files
Add a file field to a collection and you have uploads. Storage is the local filesystem under pb_data/storage by default, or S3-compatible object storage if you fill in Settings.
Upload with multipart form data, the same as any HTML form:
const form = new FormData()
form.append('title', 'Hello')
form.append('cover', fileInput.files[0])
await pb.collection('posts').create(form)The record then stores a filename, and you build URLs from it:
https://pb.mysite.com/api/files/posts/RECORD_ID/FILENAMEImages get transformations on the query string, generated on request and cached:
.../FILENAME?thumb=600x400Formats are WxH for crop-to-fit, WxHt to keep the top, WxHb for bottom, WxHf to fit inside without cropping, and 0xH or Wx0 to constrain one dimension. No build step, no image pipeline, no separate service.
Two things to plan for. First, file fields are not covered by body rules, which we hit in the filters chapter: an API rule cannot inspect an upload. Constrain size and MIME type on the field definition itself, and reach for a hook if you need real validation. Second, protected files. Flag a file field as protected and its URLs stop being public; fetching one then requires a short-lived file token, and the collection's view rule governs access. That is how you do paid or private downloads without building a proxy.
Realtime
PocketBase pushes changes over server-sent events. Subscribe to a collection, or to one record:
pb.collection('posts').subscribe('*', (e) => {
// e.action is 'create', 'update', or 'delete'
// e.record is the row
})
pb.collection('posts').subscribe(RECORD_ID, (e) => { /* ... */ })Subscriptions respect API rules. A client only receives events for records its list rule would have shown it, which means realtime does not become a side channel around your permissions. Rules are evaluated with @request.context = "realtime", so you can treat subscription traffic differently if you need to.
There is a catch that shapes act two, and I want to flag it now rather than spring it later. Realtime is a client-side subscription authenticated by a token in the browser. If you have deliberately kept the token out of the browser by putting it in an httpOnly cookie, the browser has nothing to authenticate a subscription with. Those two good ideas are in direct tension, and chapter eighteen is about resolving it.
If you are building a client-side app with the SDK holding the token, none of this applies and realtime just works.
Backups
Settings has a Backups screen. It produces a ZIP of the entire pb_data directory, on demand or on a cron schedule, stored locally or pushed to S3. It has been there since v0.16.
Restore is the same screen in reverse, and it does what you would hope.
Use it. It is the single highest-value ten minutes of setup on a new PocketBase install, because "the app" and "a directory" are the same thing here and a full snapshot is genuinely a full snapshot.
The honest limitation: the docs warn that once pb_data gets large, past a couple of gigabytes, the built-in backup gets slow, because it is zipping everything every time. If you cross that line, the usual answer is SQLite's own .backup command for the database plus rsync for the storage directory, on a schedule you control.
One improvement worth knowing: since v0.40, generating a backup no longer holds a transaction lock on the database, so a scheduled backup doesn't stall writes while it runs. The size limitation above still applies.
For most projects that day never arrives, and if it does, it arrives with plenty of warning.
What this buys you
Look at what we have not installed: no S3 client library, no image resizing service, no websocket tier, no Redis for pub/sub, no backup tool. One process on one box.
That is the case for PocketBase in a nutshell, and it is worth holding onto when we get to the comparison chapter, because the argument against it is equally concrete.
So far every change we have made has been by clicking around a dashboard. That is fine for one machine and untenable for two. Next: how schema changes travel from your laptop to a server.
Migrations and Schema as Code
Everything so far has been clicking around a dashboard. That works beautifully on one machine and falls apart the moment there are two, because "the schema" now lives in a SQLite file on a server where no pull request can ever show it.
PocketBase's answer is a migrations directory, and it is better than I expected.
It records what you do
Make a schema change in the dashboard, and PocketBase writes a migration file for you into pb_migrations/.
pb_migrations/
1755300000_created_posts.js
1755300420_updated_posts.jsThe filename is a unix timestamp plus a description, which gives you ordering for free. Each file exports an up and a down:
migrate((app) => {
// up: apply the change
const collection = new Collection({
name: 'posts',
type: 'base',
fields: [
{ name: 'title', type: 'text', required: true },
{ name: 'slug', type: 'text', required: true },
],
indexes: ['CREATE UNIQUE INDEX idx_posts_slug ON posts (slug)'],
listRule: 'status = "published"',
})
app.save(collection)
}, (app) => {
// down: undo it
app.delete(app.findCollectionByNameOrId('posts'))
})So the workflow is: change things in the dashboard locally, commit the generated files, and on deploy PocketBase applies any migrations it has not run yet. Schema changes go through code review like everything else.
This is auto-generated by default. You can turn it off in Settings if you would rather write them by hand, but I leave it on. Getting a reviewable artifact for free in exchange for zero discipline is a good trade.
The rule that keeps this sane
Make schema changes in one place.
Pick development. Change things there, let PocketBase generate the migration, commit it, deploy, let it apply.
The failure mode is editing schema directly in the production dashboard. Production now generates its own migration file inside a container you are probably not persisting, your local history diverges, and the next deploy tries to apply a change to a collection that already changed underneath it. Untangling that is a bad afternoon.
Superuser access to production is for reading logs and looking at data. Schema comes from git.
Data migrations
The same mechanism moves data, not just structure. Backfill a column, normalise something, seed reference rows:
migrate((app) => {
const posts = app.findRecordsByFilter('posts', 'slug = ""', '', 0, 0)
for (const post of posts) {
post.set('slug', slugify(post.get('title')))
app.save(post)
}
}, (app) => {
// usually nothing sensible to undo
})Two cautions from experience. This runs at boot, so a migration that walks a large table delays startup, and on a platform with a health-check timeout that can read as a failed deploy. And there is frequently no meaningful down for a data migration, which is fine as long as you have a backup from before you ran it.
Version pinning, and why it matters here
PocketBase is pre-1.0, and this is the chapter where that stops being abstract.
Migration files are executed by the binary. A file generated by v0.40 is not guaranteed to be understood by some future version whose collection API has shifted. That is the "manual migration steps from time to time" the docs warn about, and this is where it lands.
Practical defence, and it is not onerous:
- Pin an exact version in your Dockerfile or deploy script. Never
latest. - Read the release notes before bumping. They are good and they call out breaking changes.
- Upgrade on a copy of production data first. Copy
pb_data, run the new binary against it, see whether it boots. - Take a backup immediately before upgrading in production.
That is a normal amount of care for a dependency this central. It is more than you would spend on a 1.0 product, and it is the price of the single-binary convenience.
What to commit
pb_migrations/ belongs in git. So does pb_hooks/ if you use it, which is the next chapter.
pb_data/ does not. It is the running state: your database, uploaded files, logs, and the settings that include secrets. Put it in .gitignore on day one, before you accidentally commit somebody's uploaded PDF and a signing key.
Schema is portable now. Next, the part where PocketBase stops being a database with an API and starts being something you can program.
Extending: JS Hooks, and When to Reach for Go
At some point rules are not enough. You need to send a webhook when a post publishes, or add an endpoint that is not CRUD, or compute a field on save. PocketBase gives you two ways in, and the cheap one covers most of it.
Drop a file in a folder
Create pb_hooks/ next to the binary and put a file in it ending in .pb.js:
// pb_hooks/main.pb.js
onRecordAfterUpdateSuccess((e) => {
if (e.record.get('status') === 'published') {
$http.send({
url: 'https://hooks.mysite.com/post-published',
method: 'POST',
body: JSON.stringify({ id: e.record.id }),
})
}
e.next()
}, 'posts')That is the whole deployment story. Files load in filename sort order and hot-reload on change on Unix, so editing a hook and hitting save is the entire feedback loop.
The globals you get are $app (the running application), $apis (routing helpers), $os, $http, and $security. Go method names become camelCase, so FindRecordById is findRecordById.
Custom routes
Anything the CRUD API does not cover:
routerAdd('GET', '/api/mysite/stats', (e) => {
const total = $app.countRecords('posts', $dbx.exp('status = "published"'))
return e.json(200, { published: total })
}, $apis.requireAuth())Middleware comes from $apis: requireAuth(), requireSuperuserAuth(), and friends. Your custom routes get the same auth story as the built-in ones rather than a parallel one you maintain.
The gotcha that will get you
Each handler runs in its own isolated context and cannot see outer-scope variables.
This looks like it should work. It does not:
// BROKEN
const WEBHOOK = 'https://hooks.mysite.com/post-published'
onRecordAfterUpdateSuccess((e) => {
$http.send({ url: WEBHOOK }) // WEBHOOK is not defined in here
e.next()
}, 'posts')Every handler is compiled and executed as a separate program. Module-level constants, imported helpers, closures, none of it crosses the boundary. Put what you need inside the handler, or load it from within:
onRecordAfterUpdateSuccess((e) => {
const { WEBHOOK } = require(`${__hooks}/config.js`)
$http.send({ url: WEBHOOK })
e.next()
}, 'posts')I lost a genuinely embarrassing amount of time to this before reading the sentence in the docs that explains it. The error message tells you the truth, it just sounds like a typo.
Two smaller ones: there is no setTimeout or setInterval, because there is no event loop to schedule on. Use cronAdd() for anything periodic. And it is ES6-ish rather than Node, so npm packages are not available.
Calling e.next()
Hooks are middleware. Forgetting e.next() silently halts the chain and the request hangs or the record never saves. When a hook makes everything stop, check for the missing next() first.
When to use Go instead
You can also import PocketBase as a Go package and build your own binary with it. That is the framework mode, and the JavaScript hooks are a wrapper over the same hook points.
Reach for Go when:
- You are doing real computation. Image processing, cryptography, parsing something large. The JS VM is fine for glue and slow for work.
- You need a library that only exists in Go.
- You want compile-time checking across a codebase that has grown past a few hundred lines of hooks.
- You are embedding PocketBase inside a larger application rather than extending it.
Stay in JavaScript when the hook is short, mostly IO, and would take four lines. Which, in my experience, is nearly all of them. The CMS in act two needs exactly one hook, and it is six lines.
The honest framing is that JS hooks are the 90% case and Go is the escape hatch. Starting in Go because it feels more serious is a way to turn a four-line hook into a build pipeline.
You can now shape data, control access, authenticate users, store files, version the schema, and add behaviour. The last piece of act one is making it survive contact with the open internet.
Self-Hosting and Hardening
Everything so far has run on your laptop, where the only client is you. This chapter is the list I work through before a PocketBase instance gets a public DNS record.
Getting it online
There are two shapes, and the first one surprises people.
PocketBase can terminate TLS itself. Point a domain at the box and:
./pocketbase serve pb.mysite.comIt provisions a Let's Encrypt certificate and renews it. No nginx, no Caddy, no certbot. For a single-purpose box this is genuinely the whole deployment, and it is hard to argue with.
Behind a reverse proxy is the other option, and it is what you want if the box runs other things, or you need finer control over headers, caching, or routing.
If you proxy, configure the user IP proxy headers in Settings, typically X-Forwarded-For or X-Real-IP. Skip this and every request appears to come from the proxy, which quietly breaks rate limiting and makes your logs useless. It is a one-line setting and a genuinely annoying thing to debug later.
The boring stack argument applies here in full. For long-running services I use a systemd unit around the binary. It restarts on failure, starts on boot, and there is nothing else to supervise.
The hardening list
Work through these in Settings. Most take under a minute.
Rate limiting. Built in since v0.23, off by default. Turn it on. A public auth endpoint without a rate limit is a credential-stuffing target, and this is the cheapest defence you will ever deploy.
Superuser IP restrictions. Since v0.38 you can limit superuser access to specific IPs or subnets. If you have a static address or a VPN, use it. Superusers bypass every rule you wrote, so narrowing who can even attempt that login is worth more than any individual rule.
PocketBase also sends a set of default security headers, and v0.40 added Cross-Origin-Opener-Policy: same-origin to them. If you put a reverse proxy in front, check it passes those headers through rather than replacing them with its own.
MFA on superusers. Same reasoning. See chapter seven.
Real SMTP. The default is local sendmail and mail from an unknown VPS goes to spam essentially always. Verification and password reset are auth flows, so a mail problem is an auth outage. Configure a provider before launch, not after the first support ticket.
Settings encryption. Set a 32-character encryption key via environment variable and PocketBase encrypts sensitive settings at rest, including your SMTP and S3 credentials. Without it they sit in plain text inside pb_data.
Backups, to somewhere else. You turned these on in chapter eight. Point them at S3 rather than the same disk. A backup that lives on the machine you are protecting against is not a backup.
Audit your rules. Every collection, every rule. You are looking for two things: rules that are empty when they should be expressions, and collections you forgot about entirely. An empty rule is a public rule, and a collection created during a debugging session two months ago will still be there.
Test as a real user in a private window. Superuser bypasses everything, so testing while logged into the dashboard proves nothing.
Tuning, if you need it
Two environment knobs matter, and only under load.
ulimit -n raises the file descriptor limit. Each realtime subscription holds a connection, so a few hundred concurrent subscribers will hit the default ceiling on some systems.
GOMEMLIMIT gives the Go runtime a soft memory target. On a small VPS this is the difference between the garbage collector being relaxed and the kernel's OOM killer making decisions for you.
Neither is worth touching until you have a reason.
The part that is genuinely different
The whole application is one directory. Backups are a file copy, migration between hosts is rsync, and disaster recovery is unzipping something.
The flip side, and I would rather say it than let you find it: it is one process on one machine. There is no read replica, no failover, no rolling deploy. Restarting drops every realtime connection. Vertical scaling is the scaling story, and vertical scaling on a modern box with SQLite goes a lot further than people expect, right up until it does not.
If your answer to "what happens when this box dies" is "we restore the backup and lose a few minutes", PocketBase is a fine fit. If that answer is unacceptable, you want the other guide.
That is act one. You can run PocketBase properly, lock it down, and extend it. Now let's build something on it and find out where the sharp edges actually are.
What We're Building
Act one was the manual. This act is the build, and it exists for a reason beyond being a nice payoff: a reference chapter can tell you an API rule filters results, but you do not really believe it until a draft post fails to appear in your own list endpoint and you realise no code made that decision.
The app
A small CMS. Posts and pages, an author login, a public site that renders what is published, and an admin area for writing.
Deliberately unglamorous. Every application I have built on a backend like this needs the same bones: authenticate somebody, let them create things, control who sees what, upload an image. If those work, the rest is domain detail.
The stack is Astro with server-side rendering, Datastar for interactivity, and PocketBase behind it. That is the same shape as this site, which is not a coincidence: it is the stack I keep coming back to for anything that is mostly content with pockets of interaction.
Why Astro and Datastar
Astro gives us server-rendered HTML and API routes in one project, which is exactly what we want when the backend is doing the thinking.
Datastar is the interactivity layer. If you have not used it, I wrote a full guide on Datastar with Astro and another on the hypermedia stack generally, so I am not going to reteach the attributes here. The short version: you put data-* attributes on HTML, the backend sends HTML back, and Datastar morphs it into the DOM. There is no client-side store to keep in sync, because the server already has the state.
That matters more than usual here. PocketBase is a REST API, so the obvious move is to call it from the browser with the JavaScript SDK. We are deliberately not going to do that, and the next section is why.
The one architectural decision
The browser never holds a PocketBase token.
The auth token lives in an httpOnly cookie. JavaScript cannot read it. Every PocketBase call happens server side, from Astro, using a client built fresh for that request.
The flow is: Datastar posts to an Astro endpoint, Astro talks to PocketBase, Astro returns HTML, Datastar patches it in.
The reasoning goes straight back to chapter six. PocketBase tokens cannot be revoked. There is no logout endpoint, no session to destroy, no server-side record to delete. A token that leaks stays valid until it expires. Given that, keeping it out of reach of every script on the page (including anything that sneaks in through a dependency) is worth real effort.
There is a cost, and I would rather name it now than have it feel like a bait and switch in chapter eighteen: a browser with no token cannot open a PocketBase realtime subscription. Two good decisions, in genuine conflict. We build the app first, hit the wall properly, and then deal with it.
What we will not build
No comments, no search, no pagination beyond the basics, no media library, no roles beyond author and superuser. Each is a fine exercise and none teaches anything new about PocketBase.
I am also not building a rich text editor. Content is markdown in a textarea, rendered on the server. Editors are their own universe of pain and have nothing to do with the backend.
The order
Six chapters. Model the data and write the rules. Wire Astro to PocketBase with the cookie cycle. Build login and protected routes. Build posts CRUD with Datastar. Add pages, publishing, and image uploads. Then confront the realtime problem honestly.
Every one of those leans on something from act one, and I will say which as we go, because the point of the build is to make the reference concrete.
Data model first. This is where the rules from chapter four stop being examples.
Modeling Posts and Pages
Two collections, one relation, and a set of API rules that turn out to be most of the application's logic. This chapter is short because PocketBase makes it short, which is rather the point.
Posts
A base collection called posts:
Field | Type | Notes |
|---|---|---|
| text | required |
| text | required, unique index |
| editor | markdown |
| text | optional |
| select |
|
| date | when it goes live |
| file | single image, optional |
| relation | to |
Two details worth saying out loud, because both bit me in chapter three.
Uniqueness on slug is an index, not a field checkbox:
CREATE UNIQUE INDEX idx_posts_slug ON posts (slug)And author must have max-select set to 1. Leave it unbounded and you have an array, and every rule you write against it needs the ?= operators from chapter five. One-to-many by accident is a genuinely irritating thing to discover three chapters later.
Pages
Nearly identical, minus the editorial furniture: title, slug (unique index), content, status, cover. No author, no published date. Pages are the about page and the contact page. They exist or they do not.
The rules
Here is where the model stops being a spreadsheet.
Posts, list and view:
status = "published" || author = @request.auth.idAnonymous readers see published posts. Authors see those plus their own drafts. One expression, two audiences, and no second endpoint.
Remember from chapter four that this is a filter, not a gate. A draft belonging to somebody else does not 403, it does not appear. There is no code path in our app that could accidentally leak it, because the query never returned it.
Posts, create:
@request.auth.id != "" && @request.body.author = @request.auth.idLogged in, and the author field in the submitted body must be you. Without that second clause a user could create a post attributed to somebody else by sending a different id. The rule checks what was submitted rather than trusting the application to have set it correctly.
Posts, update and delete:
@request.auth.id != "" &&
author = @request.auth.id &&
@request.body.author:changed = falseOwner only, and the :changed modifier from chapter five stops an author handing their post to somebody else on update. Three lines and the ownership model is closed.
Pages get the simpler treatment: status = "published" for read, and locked for write, so only superusers manage them. Not every collection needs a self-service permission model, and pages genuinely do not.
Test it like an attacker
Superusers bypass all of this, so testing in the dashboard proves nothing. Get a real user token and try to break your own rules:
TOKEN=$(curl -s -X POST \
https://pb.mysite.com/api/collections/users/auth-with-password \
-H 'Content-Type: application/json' \
-d '{"identity":"author@mysite.com","password":"..."}' | jq -r .token)
# should return published posts plus only my drafts
curl -s https://pb.mysite.com/api/collections/posts/records \
-H "Authorization: $TOKEN" | jq '.items[] | {title, status, author}'
# should fail: creating a post attributed to somebody else
curl -s -X POST https://pb.mysite.com/api/collections/posts/records \
-H "Authorization: $TOKEN" -H 'Content-Type: application/json' \
-d '{"title":"Forged","slug":"forged","author":"SOME_OTHER_ID"}'The second one should give you a 400. If it gives you a record, your create rule is wrong, and you would much rather learn that from curl than from a customer.
I run these three commands against every collection I ship. It takes two minutes and it has caught real mistakes.
The backend now enforces the whole editorial model on its own. Time to put a UI on it, starting with the part that decides who anybody is.
Wiring Astro to PocketBase
This is the chapter that decides the character of the whole app. Twenty-odd lines of middleware, and everything after it follows.
One client per request
The instinct from client-side work is a shared PocketBase instance imported everywhere. On a server that is a bug waiting to happen, because the SDK's auth store is stateful. A module-level singleton means one user's token is visible to every concurrent request, and the failure mode is users seeing each other's data under load.
Build a fresh client per request and hang it on locals:
// src/middleware.ts
import PocketBase from 'pocketbase'
import { defineMiddleware } from 'astro:middleware'
export const onRequest = defineMiddleware(async (context, next) => {
const pb = new PocketBase(import.meta.env.POCKETBASE_URL)
// 1. restore auth state from the incoming cookie
pb.authStore.loadFromCookie(context.request.headers.get('cookie') || '')
// 2. verify it is still good, and get fresh user fields
try {
if (pb.authStore.isValid) {
await pb.collection('users').authRefresh()
}
} catch {
pb.authStore.clear()
}
context.locals.pb = pb
context.locals.user = pb.authStore.record
const response = await next()
// 3. write the (possibly refreshed) token back out
response.headers.append(
'set-cookie',
pb.authStore.exportToCookie({
httpOnly: true,
secure: import.meta.env.PROD,
sameSite: 'Lax',
path: '/',
}),
)
return response
})Load, refresh, export. That three-step cycle is the SDK's own documented pattern for server-side rendering, and it is worth understanding each step rather than pasting it.
Load parses the pb_auth cookie into the store. Nothing hits the network.
Refresh does hit the network, and it is doing two jobs: confirming the token is still valid and the account still exists, and giving us current field values so a user whose role changed does not keep the old one until their token expires. The try/catch is not decoration. A revoked or expired token throws, and clearing the store on failure is what turns a hard error into a clean logged-out state.
Export serialises the store back to a Set-Cookie header. Because authRefresh issues a new token with a later expiry, this is also what keeps an active user logged in. Stop exporting and sessions expire mid-use.
The cookie flags
httpOnly: true is the entire point. Without it a script can read the token and we have gained nothing over localStorage.
secure in production only, so local development over http still works.
sameSite: 'Lax' allows top-level navigations from other sites (a link to your post) while blocking the cookie on cross-site form posts. Strict breaks inbound links from email in ways users experience as random logouts.
path: '/' so the cookie is sent everywhere in the app.
Types
Astro will not know what locals.pb is unless you tell it:
// src/env.d.ts
declare namespace App {
interface Locals {
pb: import('pocketbase').default
user: import('pocketbase').RecordModel | null
}
}Small thing, large quality-of-life difference for the next six chapters.
Using it
Every page and endpoint now has an authenticated client, with no imports and no token handling:
---
// src/pages/blog/index.astro
const posts = await Astro.locals.pb.collection('posts').getList(1, 20, {
sort: '-published',
})
---
<ul>
{posts.items.map((p) => <li><a href={`/blog/${p.slug}`}>{p.title}</a></li>)}
</ul>Note what is absent: any filter on status. The API rule from the last chapter already decided what this request may see. An anonymous visitor gets published posts. A logged-in author gets those plus their own drafts, from identical code.
That is the payoff of rules-as-filters, and it is why I find this stack pleasant. Authorisation lives in one place, and the application code is just asking for records.
One caution
authRefresh is a network call on every request that has a cookie. On a page that also fetches records you are making two round trips to PocketBase, so keep them on the same network. Co-located on one box this is sub-millisecond. With PocketBase in another region it is the slowest thing your app does.
The plumbing is in. Now let's let somebody log in.
The Login Flow
With the middleware in place, login is smaller than you would expect. Most of the work happens in two endpoints and one guard.
The form
A plain Astro page. Datastar binds the inputs to signals and posts them:
<form
data-signals="{email: '', password: '', error: ''}"
data-on:submit="@post('/api/login')"
>
<input type="email" data-bind:email required />
<input type="password" data-bind:password required />
<p data-show="$error != ''" data-text="$error"></p>
<button type="submit">Sign in</button>
</form>No fetch code, no token handling, no client-side state beyond what is on the screen. The full attribute reference is in the Datastar guide.
The login endpoint
// src/pages/api/login.ts
import type { APIRoute } from 'astro'
export const POST: APIRoute = async ({ request, locals, redirect }) => {
const { email, password } = await request.json()
try {
await locals.pb.collection('users').authWithPassword(email, password)
} catch {
return new Response(
`event: datastar-patch-signals\ndata: signals {"error": "Invalid email or password"}\n\n`,
{ headers: { 'content-type': 'text/event-stream' } },
)
}
return redirect('/admin', 303)
}Two things are doing quiet work here.
We never touch a cookie. authWithPassword populates the auth store on locals.pb, and the middleware's export step serialises it on the way out. The endpoint's only job is to authenticate.
And the error message is deliberately vague. "Invalid email or password" rather than "no such user" keeps the endpoint from confirming which addresses are registered, the same reasoning behind PocketBase returning an otpId for unknown emails in chapter seven.
Logout, and what it actually does
// src/pages/api/logout.ts
export const POST: APIRoute = async ({ locals, redirect }) => {
locals.pb.authStore.clear()
return redirect('/', 303)
}Clearing the store means the middleware exports an empty cookie, which deletes it. The browser is logged out.
The token itself is still valid. This is chapter six arriving in production code. There is no server-side session to destroy and no revocation endpoint. If that token were captured before logout, it keeps working until it expires.
This is precisely why we put it in an httpOnly cookie. The realistic way a token leaks is a script reading it, and no script can read this one. Logout deletes the only copy that existed.
If you need genuine revocation, the options from chapter six still stand: short token lifetimes, or rotating the collection's auth secret to invalidate every token at once. For a small CMS, a short expiry and an httpOnly cookie is a proportionate answer.
Guarding the admin
// src/middleware.ts, after locals are set
if (context.url.pathname.startsWith('/admin') && !pb.authStore.isValid) {
return context.redirect('/login', 303)
}One check, and everything under /admin is behind auth.
Worth being clear about what this is and is not. It is a user-experience guard: it sends anonymous visitors to a login page instead of a broken screen. It is not the security boundary. That lives in the API rules from chapter thirteen, which the database enforces whether or not this line exists.
Delete this check and an anonymous visitor reaching /admin sees an admin shell with an empty list, because the rules gave them nothing. That is the right failure mode, and it is only true because we pushed authorisation down into PocketBase rather than into route guards.
Signup
If you want open registration, it is create on the users collection:
await locals.pb.collection('users').create({
email, password, passwordConfirm: password,
})
await locals.pb.collection('users').requestVerification(email)
await locals.pb.collection('users').authWithPassword(email, password)For a CMS with a handful of authors I leave the users collection's create rule locked and add people from the dashboard. Open signup on a system where every account can publish is a decision, not a default.
Somebody can log in and reach the admin. Now let's give them something to do there.
Posts CRUD with Datastar
The admin screen. A list of posts, a form to write one, and the ability to edit and delete. This is where the server-driven approach either feels good or feels like a lot of ceremony, and I think it feels good.
The pattern
Every interaction is the same three steps: Datastar posts to an Astro endpoint, the endpoint talks to PocketBase, the endpoint returns HTML that Datastar morphs into place.
One useful shortcut before we start. If a response has a content type of text/html, Datastar morphs the top-level elements into the DOM by their id. You only need the SSE event format when you want to send several patches or update signals. Most endpoints in this chapter just return HTML.
The list
---
// src/pages/admin/index.astro
const posts = await Astro.locals.pb.collection('posts').getList(1, 50, {
sort: '-created',
expand: 'author',
})
---
<div id="post-list">
{posts.items.map((post) => (
<article id={`post-${post.id}`}>
<h3>{post.title}</h3>
<span>{post.status}</span>
<button data-on:click={`@get('/api/posts/${post.id}/edit')`}>Edit</button>
<button data-on:click={`@delete('/api/posts/${post.id}')`}>Delete</button>
</article>
))}
</div>Still no status filter. The rules decide, so an author sees their drafts and somebody else's drafts are simply not in the result. Every time I write one of these lists I notice the absence of the where clause I would have written on a different stack.
Create
// src/pages/api/posts/index.ts
export const POST: APIRoute = async ({ request, locals }) => {
const user = locals.user
if (!user) return new Response('Unauthorized', { status: 401 })
const body = await request.json()
const post = await locals.pb.collection('posts').create({
title: body.title,
slug: slugify(body.title),
content: body.content,
status: 'draft',
author: user.id,
})
const html = await renderPostRow(post)
return new Response(
`<div id="post-list">${html}${await renderExistingRows(locals)}</div>`,
{ headers: { 'content-type': 'text/html' } },
)
}We set author from locals.user, not from the request body. Chapter thirteen's create rule would reject a forged author anyway, which is the point of defence at the data layer, but there is no reason to send something the server already knows.
Handling the errors that matter
Two failures will happen in normal use and both deserve better than a stack trace.
A duplicate slug violates the unique index and PocketBase returns a 400 with a field-level message. An update by someone who does not own the post returns 404, not 403, because of the status-code semantics from chapter four.
try {
await locals.pb.collection('posts').update(id, data)
} catch (err) {
if (err.status === 404) {
return patchSignals({ error: 'That post no longer exists, or is not yours' })
}
if (err.status === 400) {
const fields = Object.keys(err.response?.data ?? {})
return patchSignals({ error: `Check these fields: ${fields.join(', ')}` })
}
throw err
}That 404 is worth a comment in your codebase, because six months later it looks like a bug. It is a permission failure wearing a not-found costume, deliberately, so the API does not confirm the record exists.
Sending signals back
When you need to update state rather than markup, use the signals event:
function patchSignals(signals: Record<string, unknown>) {
return new Response(
`event: datastar-patch-signals\ndata: signals ${JSON.stringify(signals)}\n\n`,
{ headers: { 'content-type': 'text/event-stream' } },
)
}That is the whole helper. Errors, loading flags, counts, anything the UI reacts to.
Delete
export const DELETE: APIRoute = async ({ params, locals }) => {
await locals.pb.collection('posts').delete(params.id)
return new Response(
`<div id="post-${params.id} remove></div>`,
{ headers: { 'content-type': 'text/html' } },
)
}If a user tries to delete a post that is not theirs, the rule turns it into a 404 and nothing is deleted. The guard is in the database, not in this handler.
What we did not write
No client-side store. No optimistic update logic. No cache invalidation. No serialiser keeping a JavaScript object in sync with the server.
The server has the state. It renders HTML. Datastar puts the HTML on the screen. For a CMS, where nearly every interaction is a round trip anyway, that is a lot of removed complexity.
Posts work. Pages are nearly the same, so the next chapter spends its time on the genuinely different part: getting an image off a disk and into a record.
Pages, Publishing, and File Uploads
Pages are posts with fewer fields, so this chapter spends most of its length on the two things that are actually new: getting files uploaded through a server-side proxy, and making publishing a data decision rather than a UI one.
Pages, briefly
Same CRUD as the last chapter against the pages collection. The write rules are locked, so only superusers manage pages, and the admin routes for them sit behind the same middleware guard.
Rendering is a catch-all route:
---
// src/pages/[...slug].astro
const { slug } = Astro.params
let page
try {
page = await Astro.locals.pb
.collection('pages')
.getFirstListItem(`slug = "${slug}"`)
} catch {
return Astro.rewrite('/404')
}
---
<article set:html={renderMarkdown(page.content)} />A draft page throws here rather than rendering, because the list rule filtered it out and getFirstListItem found nothing. Unpublished content 404s without a single line of status checking. Note the rewrite rather than a redirect, so the URL stays put and the status code is honest.
Publishing is a rule, not a button
The temptation is a publish button that flips a flag, and then remembering to check that flag in every query.
Do it the other way. Publishing sets data, and chapter thirteen's rules already decide visibility:
await locals.pb.collection('posts').update(id, {
status: 'published',
published: new Date().toISOString(),
})Scheduled publishing needs no scheduler at all. Change the list rule to consult the date:
(status = "published" && published <= @now) || author = @request.auth.idA post with a future published date is invisible to the public until that moment passes, and then it appears. No cron job, no queue, no worker. The macro from chapter five is doing the work, and it is UTC, which is exactly the caveat I flagged there: if your authors think in local time, convert before you store.
File uploads through a proxy
Here is the genuinely new problem. The browser has no PocketBase token, so it cannot upload directly. The file has to travel through Astro.
Client side, this is an ordinary multipart form:
<form
id="cover-form"
enctype="multipart/form-data"
data-on:submit="@post('/api/posts/cover', {contentType: 'form'})"
>
<input type="file" name="cover" accept="image/*" />
<button type="submit">Upload</button>
</form>The contentType: 'form' option matters. By default Datastar sends signals as JSON, and a file cannot be a signal. This tells it to submit the form as multipart instead.
Server side, take the FormData and hand it straight to the SDK:
export const POST: APIRoute = async ({ request, locals }) => {
const incoming = await request.formData()
const file = incoming.get('cover') as File
const postId = incoming.get('postId') as string
if (!file || file.size === 0) {
return patchSignals({ error: 'Choose a file first' })
}
if (file.size > 5 * 1024 * 1024) {
return patchSignals({ error: 'Images must be under 5MB' })
}
const form = new FormData()
form.append('cover', file)
const post = await locals.pb.collection('posts').update(postId, form)
const url = locals.pb.files.getURL(post, post.cover, { thumb: '600x400' })
return new Response(
`<img id="cover-preview" src="${url}" alt="" />`,
{ headers: { 'content-type': 'text/html' } },
)
}The size check is not belt and braces. Chapter five's fourth trap was that uploaded files are not part of `@request.body`, so an API rule genuinely cannot inspect them. Your options are the field's own constraints (set max size and allowed MIME types on the field, always) and a check like this one. A rule will not save you here.
Thumbnails for free
getURL with a thumb option produces a transformed image on request:
locals.pb.files.getURL(post, post.cover, { thumb: '1200x630' }) // og image
locals.pb.files.getURL(post, post.cover, { thumb: '300x200' }) // list
locals.pb.files.getURL(post, post.cover, { thumb: '0x400' }) // fixed heightNo image pipeline, no build step, no third service. PocketBase generates and caches on first request. For a CMS this removes an entire category of infrastructure, and it is one of the features I miss most when I am not using it.
The app works end to end: auth, posts, pages, publishing, uploads. Which brings us to the thing I promised in chapter twelve and have been deferring ever since.
Two SSE Streams
Time to pay the bill. Back in chapter twelve I made a decision, and in chapter eight I flagged what it would cost. Here it is, in full.
The collision
PocketBase has realtime. Subscribe to a collection and you get server-sent events when records change, filtered by your API rules, so each subscriber only receives records they could have queried. It is one of the best things about the product.
The client-side call looks like this:
pb.collection('posts').subscribe('*', (e) => { /* ... */ })That runs in the browser. It opens an EventSource against PocketBase, and it authenticates with the token in the SDK's auth store.
Our browser does not have a token. We put it in an httpOnly cookie precisely so no script could reach it. The subscription cannot authenticate, so it connects as an anonymous visitor and receives only what the public can see.
Both decisions are right. They are also mutually exclusive in the browser. Datastar is fed by an SSE stream from Astro. PocketBase wants to feed an SSE stream to the browser. Two streams, and the credential for the second one is deliberately unreachable.
Option one: do not
Start here, because most applications should.
Ask what realtime is actually for. In our CMS, the user's own changes already update the screen: they post to an endpoint, it returns HTML, Datastar patches it in. That is instant and it needs no subscription.
Realtime only adds something when somebody else's change should appear on your screen without a refresh. For a CMS with three authors who each own their posts, that is close to worthless. For a shared kanban board, a chat, or a live dashboard, it is the whole product.
If your users have not asked for it, do not build it. The best resolution to an architectural tension is often noticing you do not need one side of it.
Option two: put a token back in the browser
Give the browser a PocketBase token and use realtime as designed. Client-side reads and subscriptions, server-side writes.
I do not like it, and I want to be fair about why. A token in JavaScript is readable by any script on the page, including anything that arrives through a dependency you did not audit. Chapter six is why that stings more here than elsewhere: PocketBase tokens cannot be revoked. A leak is live until expiry.
If you go this way, mint a separate, minimal token rather than reusing the session. Create a dedicated read-only user, scope it by rules to exactly the collections the UI subscribes to, and have the server impersonate it with a short duration:
// server side, with a superuser client
const viewer = await adminPb.collection('users').impersonate(VIEWER_ID, 900)
const token = viewer.authStore.token // 15 minutes, cannot be refreshedThen a leak costs you a public-ish read feed for fifteen minutes rather than an account.
Option three: proxy it
Keep the token server side and have Astro subscribe on the browser's behalf, translating PocketBase events into Datastar patches. I tested this against PocketBase v0.40.6, the 0.29 JS SDK and Astro 7 on the Node adapter. The obvious version crashes the server in two different ways, so here is the version that holds up.
First, Node has no EventSource, and the SDK's realtime client is built on it. Without a polyfill, subscribe() throws and takes the whole process down. Install one:
npm install eventsourceThen register it once:
// src/lib/realtime.ts
import { EventSource } from 'eventsource'
globalThis.EventSource ??= EventSource as typeof globalThis.EventSourceThen the endpoint:
// src/pages/api/stream.ts
import type { APIRoute } from 'astro'
import '../../lib/realtime'
// The same markup the posts list renders, as a string. Escape anything
// an author typed: this HTML goes straight into every viewer's page.
const esc = (s: string) =>
s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"')
const renderPostRow = (post: { id: string; title: string; status: string }) =>
`<li id="post-${post.id}">${esc(post.title)} <small>${esc(post.status)}</small></li>`
// Datastar wants a prefix on every line of the HTML.
const patch = (html: string) =>
'event: datastar-patch-elements\n' +
html.split('\n').map((line) => `data: elements ${line}`).join('\n') +
'\n\n'
export const GET: APIRoute = async ({ locals }) => {
const encoder = new TextEncoder()
let unsubscribe: (() => Promise<void>) | undefined
let open = true
const stream = new ReadableStream({
async start(controller) {
try {
unsubscribe = await locals.pb.collection('posts').subscribe('*', (e) => {
if (!open) return
controller.enqueue(encoder.encode(patch(renderPostRow(e.record))))
})
} catch (err) {
// PocketBase unreachable: end this stream instead of the process.
open = false
controller.error(err)
}
},
// Runs when the browser disconnects.
async cancel() {
open = false
await unsubscribe?.()
},
})
return new Response(stream, {
headers: { 'content-type': 'text/event-stream', 'cache-control': 'no-cache' },
})
}The browser opens one stream to Astro. Astro holds the PocketBase subscription. The token never leaves the server, and Datastar gets patches in exactly the format it wants.
Filtering comes along for free. locals.pb carries the viewer's own token, so PocketBase still applies the API rules per subscriber. In testing, a logged-in author saw published posts plus their own drafts, an anonymous stream saw only published posts, and neither saw another author's draft.
It is not free in other ways:
- Two connections per viewer. Browser to Astro, Astro to PocketBase. A serverless host that bills by request duration will hate you. This wants a long-lived Node process.
- Cleanup is on you. Astro does not hand the endpoint an abort signal, so
cancel()is the hook. Skip it and the subscription outlives the viewer, and the next event callsenqueue()on a closed stream. In Node that throws outside any request and kills the server. - Multi-line HTML needs every line prefixed. Send it on one
data:line and Datastar only sees the first.
At scale you would keep one shared subscription per collection and multiplex it to connected clients rather than opening one per viewer. That shared subscription runs as one identity, so at that point you are re-implementing the filtering PocketBase was doing per viewer, and getting it wrong means broadcasting a draft to everyone watching. That is a real piece of infrastructure, and it is the point at which I would ask whether the feature is worth it.
What I would ship
For this CMS: option one. No realtime.
For something genuinely collaborative where the token must stay server side: option three, per-viewer subscriptions while the numbers are small, on a host that can hold connections open.
For a read-heavy dashboard where the data is not sensitive: option two with a scoped, minimal, short-lived token.
The thing I would not do is pick the architecture first and discover the constraint later. httpOnly cookies and client-side realtime are both good ideas, and they do not compose. Knowing that before you start is worth more than any of the three workarounds.
That is the build. Three toolkit chapters follow: a production checklist, a copy-paste starter, and an honest answer to the question you have probably been asking since chapter one.
Toolkit: The Production Readiness Checklist
The list I actually work through before a PocketBase instance gets a public DNS record. Print it, argue with it, adapt it.
Access and rules
- [ ] Every collection reviewed, rule by rule. There are five per collection, six on auth collections.
- [ ] No rule is an empty string unless you meant "the entire internet". Empty means public, locked means superuser-only, and they look similar in a hurry.
- [ ] Collections you created while experimenting are deleted, not left with open rules.
- [ ] Every rule touching a multi-value field uses the
?operators. - [ ] Update rules that must not allow reassignment use
:changed = falseon the ownership field. - [ ] Create rules validate
@request.body.*rather than trusting the client to send the right owner. - [ ] Rules tested with a real user token in a private window, never as a superuser. Superusers bypass everything.
Superusers
- [ ] MFA enabled on every superuser account.
- [ ] Superuser access restricted by IP or subnet (v0.38+) if you have a static address or VPN.
- [ ] The number of superusers is as small as it can be.
- [ ] Any impersonate tokens issued as API keys are written down somewhere, because rotating one means rotating the secret that kills them all.
Network
- [ ] TLS, either PocketBase's own Let's Encrypt or a reverse proxy.
- [ ] If proxied, user IP proxy headers configured in Settings. Skip this and rate limiting silently protects nothing.
- [ ] Rate limiting turned on (v0.23+). It is off by default.
- [ ] Only the ports you need are open on the host firewall.
Data
- [ ] Backups enabled, on a schedule, to S3 or another host. A backup on the same disk is not a backup.
- [ ] A restore actually tested once. An untested backup is a hypothesis.
- [ ]
pb_datais in.gitignore. - [ ]
pb_migrationsis committed and in code review. - [ ] If
pb_datais heading past a couple of gigabytes, a plan beyond the built-in ZIP backup.
Configuration
- [ ] Real SMTP configured. The default
sendmailgoes to spam, and mail failures present as auth failures. - [ ] Verification and password reset flows tested end to end with a real mailbox.
- [ ] Settings encryption key set, so SMTP and S3 credentials are not plain text in
pb_data. - [ ] Version pinned to an exact release. Never
latest. - [ ] Release notes read for every version between yours and the one you are upgrading to.
Application
- [ ] One PocketBase client per request, never a module-level singleton.
- [ ] Auth cookie is
httpOnly,securein production, andsameSiteset deliberately. - [ ]
authRefreshwrapped in a try/catch that clears the store on failure. - [ ] 404s from write endpoints handled as permission failures, with a comment explaining why they are not 403s.
- [ ] File size and MIME constraints set on the field, plus a check in the upload handler. API rules cannot see uploads.
- [ ] Route guards understood as user experience, with the real boundary in the rules.
Before you upgrade
- [ ] Take a backup.
- [ ] Copy
pb_dataand boot the new binary against the copy first. - [ ] Read the changelog for breaking changes to the collection or migration APIs.
That last section is the one people skip, and it is the one the pre-1.0 warning is actually about. Ten minutes of care per upgrade is the whole cost of the single-binary convenience.
Toolkit: A Copy-Paste Starter
Everything from act two in one place, genericised. Change the domain and go.
Compose
services:
pocketbase:
image: ghcr.io/muchobien/pocketbase:0.39.11 # pin it, never latest
restart: unless-stopped
ports:
- "127.0.0.1:8090:8090" # loopback only; terminate TLS at the proxy
environment:
- PB_ENCRYPTION_KEY=${PB_ENCRYPTION_KEY} # 32 chars, encrypts settings at rest
volumes:
- ./pb_data:/pb/pb_data
- ./pb_hooks:/pb/pb_hooks
- ./pb_migrations:/pb/pb_migrationsFor a single-purpose box, skip all of this and run the binary with ./pocketbase serve pb.mysite.com, which handles its own certificate.
Astro middleware
// src/middleware.ts
import PocketBase from 'pocketbase'
import { defineMiddleware } from 'astro:middleware'
export const onRequest = defineMiddleware(async (context, next) => {
const pb = new PocketBase(import.meta.env.POCKETBASE_URL)
pb.authStore.loadFromCookie(context.request.headers.get('cookie') || '')
try {
if (pb.authStore.isValid) await pb.collection('users').authRefresh()
} catch {
pb.authStore.clear()
}
context.locals.pb = pb
context.locals.user = pb.authStore.record
if (context.url.pathname.startsWith('/admin') && !pb.authStore.isValid) {
return context.redirect('/login', 303)
}
const response = await next()
response.headers.append(
'set-cookie',
pb.authStore.exportToCookie({
httpOnly: true,
secure: import.meta.env.PROD,
sameSite: 'Lax',
path: '/',
}),
)
return response
})// src/env.d.ts
declare namespace App {
interface Locals {
pb: import('pocketbase').default
user: import('pocketbase').RecordModel | null
}
}The rules
Posts, list and view:
status = "published" || author = @request.auth.idPosts, with scheduled publishing:
(status = "published" && published <= @now) || author = @request.auth.idPosts, create:
@request.auth.id != "" && @request.body.author = @request.auth.idPosts, update and delete:
@request.auth.id != "" && author = @request.auth.id && @request.body.author:changed = falsePages, list and view:
status = "published"Pages, write: locked.
Indexes
CREATE UNIQUE INDEX idx_posts_slug ON posts (slug);
CREATE UNIQUE INDEX idx_pages_slug ON pages (slug);
CREATE INDEX idx_posts_status_published ON posts (status, published);A hook
// pb_hooks/main.pb.js
onRecordAfterUpdateSuccess((e) => {
if (e.record.get('status') === 'published') {
// remember: no outer-scope access, require config from inside
const { WEBHOOK } = require(`${__hooks}/config.js`)
$http.send({
url: WEBHOOK,
method: 'POST',
body: JSON.stringify({ id: e.record.id, slug: e.record.get('slug') }),
})
}
e.next()
}, 'posts')The Datastar signals helper
export function patchSignals(signals: Record<string, unknown>) {
return new Response(
`event: datastar-patch-signals\ndata: signals ${JSON.stringify(signals)}\n\n`,
{ headers: { 'content-type': 'text/event-stream' } },
)
}Returning plain HTML with a text/html content type is enough for element patches. Reach for the SSE format when you need signals, or several patches in one response.
Smoke test
TOKEN=$(curl -s -X POST \
https://pb.mysite.com/api/collections/users/auth-with-password \
-H 'Content-Type: application/json' \
-d '{"identity":"author@mysite.com","password":"..."}' | jq -r .token)
# published posts plus only my drafts
curl -s https://pb.mysite.com/api/collections/posts/records \
-H "Authorization: $TOKEN" | jq '.items[] | {title, status}'
# must 400: forged author
curl -s -X POST https://pb.mysite.com/api/collections/posts/records \
-H "Authorization: $TOKEN" -H 'Content-Type: application/json' \
-d '{"title":"Forged","slug":"forged","author":"SOME_OTHER_ID"}'
# must return nothing: anonymous request for drafts
curl -s 'https://pb.mysite.com/api/collections/posts/records?filter=status="draft"' | jq '.items | length'That last command is the one to run after every rule change. It should print 0, forever.
Toolkit: PocketBase or Directus?
I have written a guide on each (Directus here), and I use both. Here is the honest comparison, which is mostly a question about your constraints rather than about the products.
The table
PocketBase | Directus | |
|---|---|---|
Database | SQLite, embedded | Postgres, MySQL, and others |
Install | One binary | Container plus a database |
Ops surface | One process, one directory | App, database, usually cache and storage |
API | REST-ish | REST and GraphQL |
Realtime | Built in, SSE | Built in, websockets |
Admin UI | Good, developer-flavoured | Excellent, genuinely non-technical |
Extending | JS hooks or Go framework | Extensions, hooks, Flows |
Automation |
| Flows, a visual builder |
Scaling | Vertical, one box | Horizontal, standard web tier |
Maturity | Pre-1.0 | Mature, stable API |
Backup | Zip the data directory | Standard database tooling |
Pick PocketBase when
Ops budget is close to zero. One binary, one directory, one systemd unit. Nothing to orchestrate. If the project has no one who wants to be a database administrator, this is a real argument.
The whole backend should be a build artifact. You can scp it. You can commit a copy. You can hand somebody a zip and they have your backend.
You are prototyping and need real auth immediately. OAuth2, verification, MFA, and password reset on day one rather than day thirty is a genuine head start.
The data is naturally single-tenant and modest. SQLite on a decent box goes much further than people expect, particularly for read-heavy workloads.
You want to embed a backend inside a Go program. The framework mode has no real equivalent on the other side.
Pick Directus when
Non-technical people will use the admin daily. This is the big one. Directus's admin app is something you can hand to an editor or a client without an apology. PocketBase's dashboard is good, and it is clearly built for developers.
The data belongs in Postgres. Because it is relational and will be queried by other things, because there is an existing database, because your analytics stack expects it. Directus points at a database you already have rather than owning one.
The team needs granular roles. PocketBase's rules are elegant and they are per-collection expressions. Once you have five roles with overlapping permissions across thirty collections, a real policy system earns its complexity.
Uptime requirements are strict. Replicas, failover, and rolling deploys are ordinary here and are not really available there.
The project will outlive your involvement. A stable API and a large community matter more than they feel like they do when you are the one holding it.
The pre-1.0 question
This deserves a straight answer rather than a shrug.
PocketBase is at v0.40 and has not shipped 1.0. The docs say plainly it is not recommended for production-critical applications unless you are willing to read changelogs and apply occasional manual migration steps. Things have moved: admins became superusers in v0.23, and the collection API has shifted more than once.
In practice I have found it more stable than that framing suggests, and the changelogs are unusually good. But "more stable than it says" is not a promise, and I would not build a company's billing system on it today.
Where I do use it: internal tools, prototypes that need real auth, side projects, anything where the recovery plan is "restore last night's backup" and everyone is fine with that. That is a large slice of the software I write.
The dodge that is actually true
They cover different failure modes, and for a lot of teams the answer is both. I have used PocketBase for an internal tool sitting alongside a Directus-backed product, and neither knew about the other.
If you want a single rule: if a non-developer will touch the admin daily, or the data belongs in Postgres, use Directus. Otherwise start with PocketBase and be pleasantly surprised how long it lasts.
The migration path, if you outgrow it, is real but not free. Your data exports cleanly, and your API rules do not translate to Directus policies. Budget a week and do it deliberately rather than in a panic.
About Roger
I'm Roger Stringer. I build things, break them, and write up what I learned so you don't have to learn it the hard way. These Field Guides come straight out of that work.
Working on something bigger? I take on a handful of fractional CTO engagements, helping founders and teams set technical direction, build AI-powered workflows, and actually ship the hard parts. If you're wrestling with the kind of problem this guide covers and want someone in your corner who's done it before, that's exactly what I help with. Drop me a line.
And if a guide helped, got something wrong, or you just want to compare notes, I'd love to hear from you:
- Email: roger.stringer@hey.com
- X: @freekrai
- GitHub: github.com/freekrai
- LinkedIn: linkedin.com/in/rogerstringer
New guides go up as I hit problems worth documenting. Follow along wherever suits you.



