PocketBase for Arizuko

Should arizuko adopt PocketBase? Technical Analysis

TL;DR

Verdict: No — arizuko already implements everything PocketBase offers, optimized for its specific architecture

Key insight: PocketBase = SQLite + auth + real-time + admin UI. Arizuko has custom versions of all four, tightly integrated with routing/channels/agents

Where PocketBase could help: New standalone services (like a metrics dashboard or group management UI) that need quick CRUD + auth

What is PocketBase?

PocketBase is a single-binary Go backend (15MB) that bundles:

Philosophy: Ship as a single executable, extend via Go library (embed PocketBase as a package, add custom routes/hooks)

Arizuko's Current Stack

Let's map arizuko's architecture to PocketBase's features:

FeaturePocketBaseArizukoOverlap?
Database SQLite (WAL mode, embedded) SQLite (WAL mode, store/ package, 5s busy timeout) ✅ Identical
Auth Built-in users table, OAuth (Google/GitHub/Discord), JWT sessions auth/ package: OAuth (Google/GitHub/Discord/Telegram), JWT, auth_users/auth_sessions tables, argon2 hashing ✅ Identical feature set
Real-time SSE subscriptions on collections (create/update/delete events) SSE via proxyd web channel (web: JIDs), poll-based message delivery ⚠️ Different model (arizuko: message-centric, not CRUD-centric)
Admin UI Built-in HTMX dashboard for CRUD dashd/: read-only HTMX portal (status, tasks, activity, groups, memory) ⚠️ Different purpose (arizuko: observability, not CRUD)
File storage Local FS or S3, tied to collection fields Media enricher: attachments → groups/<folder>/media/, Whisper transcription ⚠️ Different model (arizuko: message-attached, not collection-attached)
REST API Auto-generated from schema api/ package: /v1/messages, /v1/channels/register (custom, not auto-generated) ❌ No overlap
Routing N/A router/ + routes table: match expressions, three-layer pipeline (sticky → command → prefix → routing) ❌ Arizuko-specific
Channels N/A chanreg/: HTTP channel protocol, health checks, adapter registry (Telegram/WhatsApp/Discord/etc.) ❌ Arizuko-specific
Agents N/A gateway/ + container/: Docker orchestration, IPC (MCP over unix sockets), grants engine ❌ Arizuko-specific

Analysis: Where PocketBase Would (Not) Fit

❌ Core Gateway (gated)

Why not:

Verdict: No value. Arizuko's store/ is leaner and purpose-built.

❌ Auth (proxyd + auth/)

Why not:

Verdict: No value. Arizuko's auth is already feature-complete and integrated.

⚠️ Dashboard (dashd)

Current state: dashd is read-only HTMX, shows system observability (channels, groups, queue, tasks, routing table)

PocketBase could offer: If dashd ever needs CRUD operations (e.g., edit routes, manage groups, update task schedules), PocketBase's admin UI could accelerate development

But:

Verdict: Marginal value. Custom HTMX forms are probably simpler than PocketBase integration.

✅ New Standalone Services

Where PocketBase shines:

If arizuko needs a **new service** with standard CRUD + auth requirements (not tightly coupled to routing/channels/agents), PocketBase could be a fast MVP path:

Example: Metrics Service

// metrics/main.go
package main

import (
    "github.com/pocketbase/pocketbase"
    "github.com/pocketbase/pocketbase/apis"
)

func main() {
    app := pocketbase.New()

    // Custom route: POST /api/metrics (called by gateway after agent run)
    app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
        e.Router.POST("/api/metrics", func(c echo.Context) error {
            // Store agent metrics: folder, session_id, tokens, latency, cost
            // Auto-generates REST API for querying
        })
        return nil
    })

    app.Start()
}

Benefits:

Verdict: Yes — PocketBase is ideal for ancillary services that don't touch core routing/agent logic.

Technical Deep Dive: Why Arizuko's Stack is Better

1. Message Flow Model

PocketBase: CRUD-centric (create/read/update/delete on collections)

Arizuko: Message-flow-centric (inbound → routing → agent → outbound)

PocketBase's real-time model assumes you're building a typical web app (to-do lists, user profiles, comments). Arizuko's message table has specialized semantics:

PocketBase's collection API wouldn't expose these semantics cleanly. Arizuko's store.NewMessages(), store.MessagesSince(), store.PutMessage() are purpose-built.

2. Routing Complexity

Arizuko's routing is a three-layer pipeline with match expressions:

  1. Sticky layer — Absorbs bare @name/#topic tokens
  2. Command layer — Matches /new, /ping, /stop
  3. Prefix layer — Inspects @name/#topic inline, navigates to child group or topic session
  4. Routing layer — Walks routes table (seq order, match expressions like platform=telegram verb=mention)

PocketBase has no concept of "routing" — it's a CRUD backend. You'd have to reimplement the entire routing logic on top of PocketBase, losing all benefits.

3. Channel Protocol

Arizuko's channel adapters (Telegram, WhatsApp, Discord) register via HTTP, health-check every 30s, and receive outbound messages via POST /send. This bidirectional HTTP protocol is custom to arizuko's architecture.

PocketBase has no concept of "channels" — you'd have to build chanreg/ logic on top, again losing benefits.

4. Grants Engine

Arizuko's grants engine controls which MCP tools/actions a group can use, with rule merging for delegation (NarrowRules). This is tightly coupled to IPC authorization checks.

PocketBase's auth is collection-level (read/write permissions on collections), not action-level. You'd need to bolt on custom middleware, duplicating effort.

5. Single Binary vs Microservices

PocketBase's selling point: Single 15MB binary for rapid prototyping

Arizuko's reality: Already ships as a single Docker image (arizuko:latest) with all daemons (gated, timed, dashd, teled, etc.) compiled into one image. The compose file spawns multiple containers, but they share the same binary.

PocketBase doesn't simplify deployment here — arizuko's compose-based deployment is already streamlined.

Comparison: PocketBase vs Arizuko SQLite

AspectPocketBaseArizukoWinner
SQLite setup Auto-configured (WAL mode, busy timeout) Manual (store/ package, 5s timeout, migration via PRAGMA user_version) PocketBase (less boilerplate)
Schema migrations Built-in migration system with Go API Custom dbmig/ library (keyed by service name, SQL files in migrations/) PocketBase (more polished)
Real-time SSE (unidirectional, collection events) SSE via proxyd (message events, web channel JIDs) Tie (both use SSE, different semantics)
Auth OAuth + JWT + refresh tokens (tied to collections) OAuth + JWT + refresh tokens (decoupled, custom user_groups) Arizuko (more flexible for multi-tenancy)
Admin UI Auto-generated CRUD forms Custom HTMX dashboards (read-only, observability) PocketBase (for generic CRUD), Arizuko (for custom domain)
Extensibility Hooks (~30+ events), embed as Go library No hooks system (direct function calls across packages) PocketBase (cleaner for plugins)
Performance Single-instance SQLite (WAL mode, limited concurrency) Single-instance SQLite (same limits, shared across daemons via WAL) Tie
Deployment Single binary (15MB) Docker image (multi-daemon, shared binary) PocketBase (simpler for solo services)

Appwrite: The Microservices Alternative

What is Appwrite?

Appwrite is an open-source Backend-as-a-Service (BaaS) written in PHP with Go components (Traefik reverse proxy). Unlike PocketBase's single binary, Appwrite runs as 18 Docker containers orchestrated via Docker Compose.

Features:

Architecture: Appwrite vs PocketBase vs Arizuko

AspectAppwritePocketBaseArizuko
Deployment model 18 Docker containers (microservices) Single 15MB binary Single Docker image, multi-daemon (gated, timed, dashd, adapters)
Database MariaDB (separate container) SQLite (embedded) SQLite (shared via WAL mode)
Language PHP (backend) + Go (Traefik) Go Go (backend) + TypeScript (agent + whapd)
Real-time WebSocket (bidirectional) SSE (unidirectional) SSE via proxyd (unidirectional)
Serverless functions ✅ Built-in (Docker-based, multi-runtime) ❌ None (extend with Go hooks) ✅ Agent containers (Claude Code, custom logic)
Resource footprint Heavy (~1GB RAM minimum for 18 containers) Light (~50MB RAM) Medium (~300MB RAM for gated + adapters)
Scalability Horizontal (MariaDB replication, load balancing via Traefik) Vertical only (single SQLite file) Vertical only (single SQLite file)
Admin UI Full-featured web console (teams, permissions, functions, logs) Auto-generated CRUD forms Custom HTMX dashboards (read-only observability)
Auth complexity Full RBAC (teams, roles, permissions per collection) Simple (users + OAuth) Custom (JWT + user_groups table, grants engine for actions)
File storage Advanced (image transformations, compression, S3 backends) Basic (local FS or S3, tied to collections) Custom (media enricher, Whisper transcription, local FS)

When to Use Appwrite vs PocketBase

Choose Appwrite if:

Choose PocketBase if:

Appwrite vs Arizuko: Architecture Comparison

Similarities:

Key Differences:

AspectAppwriteArizuko
Primary use case Generic BaaS (CRUD apps, web/mobile backends) Agent orchestration (routing, channels, LLM containers)
Database model Collections (document-oriented, MariaDB-backed) Messages + routes + groups (SQLite, custom schema)
Serverless model Generic functions (Node, Python, PHP, etc.) Agent containers (Claude Code SDK, TypeScript, MCP tools)
Routing HTTP reverse proxy (Traefik) Message routing (match expressions, three-layer pipeline)
Channel protocol N/A Custom HTTP bidirectional protocol (adapters for Telegram/WhatsApp/Discord)
Auth grants Collection-level permissions (read/write/update/delete per team/role) Action-level grants (MCP tool/action permissions, rule merging for delegation)
Deployment size 18 containers (~1GB RAM) 5-8 containers (~300MB RAM)

Could Arizuko Use Appwrite?

Theoretical fit:

Why it doesn't work:

  1. Wrong data model — Appwrite's collections are CRUD-oriented (to-do lists, user profiles). Arizuko's messages table has specialized semantics (agent_cursor, routed_to, topic, source) that don't map to Appwrite's document model.
  2. No routing concept — Arizuko's three-layer pipeline (sticky → command → prefix → routing) with match expressions is custom. Appwrite has no equivalent — you'd reimplement routing on top of Appwrite's API, losing all benefits.
  3. No channel protocol — Arizuko's bidirectional HTTP channel protocol (adapters register, receive health checks, accept POST /send for outbound) is custom. Appwrite has no concept of "channels."
  4. Wrong serverless model — Appwrite functions are stateless, event-driven (like AWS Lambda). Arizuko's agent containers are stateful (session state, multi-turn conversations, MCP unix sockets). Trying to run Claude Code in Appwrite functions would be a nightmare.
  5. Deployment bloat — Appwrite adds 18 containers. Arizuko currently runs 5-8 containers (gated, timed, dashd, teled, whapd, etc.). Adding Appwrite would triple container count for features arizuko already has.
  6. MariaDB overkill — Arizuko's SQLite works fine (WAL mode, shared across daemons). MariaDB adds operational complexity (replication, backups, connection pooling) without clear benefit for arizuko's scale.

Verdict: ❌ Appwrite is a terrible fit for arizuko core. It's a generic BaaS, not an agent orchestration platform. Using Appwrite would be like using a bulldozer to plant a garden — technically possible, but wildly inappropriate.

Summary: Three-Way Comparison

PlatformBest ForArizuko Fit?
PocketBase Solo devs, MVPs, CRUD-heavy side projects (< 100k users) ✅ Good for new standalone services (metrics, group mgmt UI)
Appwrite Teams building collaborative web/mobile apps (100k-1M users, need RBAC + functions) ❌ Terrible fit (wrong data model, 18 containers, no routing/channels)
Arizuko (custom) Agent orchestration, multi-channel routing, LLM workflows ✅ Already optimal for its domain

When PocketBase is "Better Than Supabase"

You mentioned PocketBase should be "like Supabase but better" — here's the comparison:

FeatureSupabasePocketBaseWhy PocketBase Wins
Deployment Cloud-hosted OR self-host (complex: Postgres + PostgREST + GoTrue + Realtime + Storage, ~12 containers) Single 15MB binary Radically simpler
Database PostgreSQL (requires separate server) SQLite (embedded, no separate server) Zero ops (for small scale)
Real-time WebSocket (bidirectional, Postgres LISTEN/NOTIFY) SSE (unidirectional, simpler) Less complexity (if you only need server→client)
Auth GoTrue (separate service, Postgres-backed) Built-in (SQLite-backed) Unified (one binary, one DB)
Cost Free tier (2 projects, 500MB DB, 1GB file storage) → $25/mo (8GB DB, 100GB storage) Free (self-hosted, unlimited) $0 forever
Scalability Horizontal (Postgres replication, read replicas) Vertical only (single SQLite file, WAL mode = ~10k writes/sec max) Supabase wins (if you need horizontal scale)
Ecosystem Mature (PostgREST, pgvector for embeddings, extensions) Young (limited extensions, SQLite-FTS only) Supabase wins (richer features)

PocketBase is "better" when:

Supabase is better when:

Recommendation for Arizuko

Core System: Don't Use PocketBase

Arizuko's store/, auth/, router/, and gateway/ packages are already optimized for the message-routing-agent architecture. PocketBase would be a step backward:

Ancillary Services: Consider PocketBase

If you build new standalone services (not part of the routing/agent core), PocketBase could save time:

Implementation pattern:

// metrics-service/main.go
package main

import (
    "github.com/pocketbase/pocketbase"
    "github.com/pocketbase/pocketbase/core"
)

func main() {
    app := pocketbase.New()

    // Define "agent_runs" collection: folder, session_id, tokens, latency, cost
    // Auto-generates: GET/POST /api/collections/agent_runs/records

    // Custom webhook: gateway calls POST /api/metrics after each agent run
    app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
        e.Router.POST("/api/metrics", metricsHandler)
        return nil
    })

    app.Start() // Single binary, admin UI at http://localhost:8090/_/
}

Benefits:

Alternative: Encore.ts (from earlier research)

If you're building new TypeScript services for arizuko's ecosystem (not Go), consider Encore.ts instead of PocketBase:

Use case: Build a TypeScript webhook service that listens to agent events (via Pub/Sub) and updates external systems (Discord, Slack, analytics)

Final Verdict

Use CaseRecommendationWhy
Core arizuko (gated, store, router, auth) ❌ Don't use PocketBase Already optimized, PocketBase doesn't fit message-flow model
Dashboard (dashd) ❌ Don't use PocketBase Custom HTMX is simpler for read-only observability
New standalone services (metrics, group mgmt, knowledge base) ✅ Consider PocketBase Fast MVP, zero boilerplate, admin UI included
TypeScript services in arizuko ecosystem ✅ Consider Encore.ts Infrastructure from Code, distributed systems native

Bottom line: PocketBase is great for new CRUD-heavy services, but arizuko's core is already better without it.


Recommendation for Communication-First Engineers

Your context: "My weakness is communication.. leaning heavily to shipping and gaming-shipping not really selling my work."

If your strength is shipping (not marketing), here's how to think about these tools:

Gaming-shipping mindset: Treat documentation like game design — users should "discover" features naturally, not read manuals. PocketBase wins here: its admin UI is self-documenting (click around, see what happens). Appwrite loses: 18 containers require upfront study.

For arizuko: Build "discovery tools" instead of docs:

Ship tools that show instead of docs that tell.

Sources