PocketBase — Dependencies#

Module info#

  • Module: github.com/pocketbase/pocketbase
  • Go version: 1.25.0
  • Direct dependencies: 20
  • Indirect dependencies (go.mod): 18 (listed explicitly in go.mod // indirect)
  • Total go.sum entries: ~71 unique (module, version) pairs (143 lines / 2)

Dependency categories#

Core infrastructure#

DependencyPurpose
github.com/spf13/cobra v1.10.2CLI framework — drives the serve, migrate, admin sub-commands via RootCmd *cobra.Command in the PocketBase launcher
github.com/fatih/color v1.19.0Colored console output for startup banners, JSVM warnings, and the dev-mode logger; the only UI in the terminal
github.com/fsnotify/fsnotify v1.7.0File-system watcher used exclusively by the jsvm plugin to hot-reload JS hook files without restarting the server
golang.org/x/sync v0.20.0errgroup / singleflight used internally for concurrent safe initializations and query batching

Networking/HTTP#

DependencyPurpose
golang.org/x/net v0.52.0Low-level networking utilities (HTTP/2, websocket upgrade helpers) used by the custom router and SSE real-time layer
golang.org/x/oauth2 v0.36.0OAuth2 client used by the 25+ social auth providers in tools/auth/; each provider wraps BaseProvider which calls golang.org/x/oauth2 for the token exchange

Data/Storage#

DependencyPurpose
modernc.org/sqlite v1.48.0Pure Go SQLite driver registered as _ "modernc.org/sqlite" in core/db_connect.go — the single most impactful dependency enabling zero-CGo builds
github.com/pocketbase/dbx v1.12.0First-party query builder (maintained by the same author) used in 69 source files — the primary abstraction over the SQLite database; builds SELECT, INSERT, UPDATE and handles parameter quoting
github.com/ganigeorgiev/fexpr v0.5.0First-party filter expression parser (same author) powering the REST API’s ?filter= parameter — parses a mini query language and converts it into safe dbx.Expression subtrees
github.com/spf13/cast v1.10.0Safe type coercion used in tools/search/filter.go to convert user-supplied filter token values to the right Go type before building SQL
github.com/disintegration/imaging v1.6.2Image resizing and cropping in tools/filesystem/filesystem.go — handles thumbnail generation for uploaded images
golang.org/x/image v0.38.0Extended image format decoding (TIFF, BMP, WebP) required by imaging
github.com/gabriel-vasile/mimetype v1.4.13Content sniffing to detect MIME type from raw bytes — used in file uploads (tools/filesystem/), mailer attachments, and the file field validator

Security / Auth#

DependencyPurpose
github.com/golang-jwt/jwt/v5 v5.3.1JWT signing and parsing in tools/security/jwt.go — used for auth tokens, password-reset links, email-verification links, and impersonation tokens
golang.org/x/crypto v0.49.0bcrypt for password hashing; argon2 for refresh-token generation; TLS helpers
github.com/go-ozzo/ozzo-validation/v4 v4.3.0Declarative struct validation used across 70+ files — defines rules for record fields, settings, forms, and API input; accessed via the validation alias

JS Runtime#

DependencyPurpose
github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3ECMAScript 5.1+ runtime — the heart of the plugins/jsvm package; executes user hook scripts, migrations, and route handlers in-process
github.com/dop251/goja_nodejs v0.0.0-20260212111938-1f56ff5bcf14Node.js compatibility layer for Goja (require(), console, process, buffer modules) enabling Node-style JS idioms in user scripts
github.com/pocketbase/tygoja v0.0.0-20250812183945-97ffe055281fFirst-party TypeScript definition generator used at build time to produce pb_hooks/types.d.ts, giving JS users IDE autocompletion for the PocketBase JS API

Email#

DependencyPurpose
github.com/domodwyer/mailyak/v3 v3.6.2SMTP client with TLS, AUTH LOGIN/PLAIN, and multipart MIME support; used in tools/mailer/smtp.go as the concrete mailer backend

Stdlib reliance#

PocketBase leans heavily on the Go standard library. The net/http package is used directly — PocketBase ships a custom HTTP router in tools/router/ built on net/http rather than adopting a third-party framework like Echo or Gin. Other heavily used stdlib packages:

  • encoding/json — JSON encode/decode throughout
  • net/smtp — SMTP foundation under mailyak
  • crypto/... — Supplemented by golang.org/x/crypto
  • database/sql — The standard DB interface (bridged to SQLite via modernc.org/sqlite)
  • io/fs and embed — Used extensively to embed the Admin UI, JS type definitions, and migration SQL into the binary
  • log/slog — Standard structured logger (Go 1.21+) adopted for the internal batch log handler instead of a third-party logger

The net effect is that PocketBase imports zero general-purpose third-party logging, observability, or middleware libraries. Its dependency graph is intentionally minimal.

Shared dependencies#

Compared to the broader set of 50 analyzed projects, PocketBase shares several high-frequency dependencies:

  • github.com/spf13/cobra — near-universal CLI framework (also: Vault, Nomad, Helm, K3s, Dapr, …)
  • golang.org/x/crypto — ubiquitous for any project handling auth (Vault, Consul, …)
  • golang.org/x/net — baseline for modern Go networking
  • github.com/golang-jwt/jwt/v5 — common JWT library replacing the older dgrijalva/jwt-go
  • github.com/google/uuid (indirect) — UUID generation; present in most web backends

Notably absent compared to its peers: github.com/gorilla/mux, github.com/gin-gonic/gin, github.com/go-chi/chi, go.uber.org/zap, github.com/sirupsen/logrus, any ORMs.

Vendoring#

No vendor directory. PocketBase uses the standard Go module proxy and relies on go.sum checksums for reproducibility. This is typical for a project that is also distributed as a Go library — vendoring would complicate embedding by downstream users.

Notable dependency decisions#

  1. modernc.org/sqlite instead of mattn/go-sqlite3: The single most consequential choice in the dependency graph. mattn/go-sqlite3 requires CGo and a C compiler, breaking cross-compilation and Docker FROM-scratch builds. modernc.org/sqlite is a transpiled pure-Go implementation that enables GOARCH=arm64 GOOS=linux go build without any host toolchain beyond the Go compiler. This is the architectural enabler of the “single portable binary” promise.

  2. First-party pocketbase/dbx instead of an ORM: Rather than pulling in GORM or sqlx, the project uses its own thin query builder (pocketbase/dbx). This keeps the SQL layer predictable, avoids N+1 footguns from ORM magic, and allows the author to add PocketBase-specific features (like JSON field operators) without waiting for upstream.

  3. ganigeorgiev/fexpr instead of raw SQL exposure: Exposing a custom filter DSL rather than a SQL subset prevents SQL injection by construction, and the parser is maintained by the same author — meaning PocketBase controls the entire stack from HTTP request to SQLite query.

  4. dop251/goja for scripting instead of a WASM runtime or subprocess model: Embedding a JS engine in-process gives sub-millisecond hook latency with full access to the Go API surface via JS bindings, at the cost of a heavier binary. The tradeoff is explicitly chosen for developer experience — JS users get native PocketBase objects, not an RPC layer.

  5. No test framework dependency: The entire test suite uses testing from the standard library only. Zero testify, zero gomock. This makes the dependency graph even leaner and demonstrates confidence in table-driven tests with stdlib assertions.