logo

PocketBase

Database ManagementMay 6, 2025

Alternative to FirebaseFirebase

Visit Website
screenshot

An open source, self-contained backend built with Go.

Information

License: MIT license

46.9k stars

Key Features

  • Embedded Database: Uses SQLite with schema builder, validations, and realtime subscriptions.
  • Realtime API: Subscribe to live updates on database changes.
  • User Authentication: Email/password and OAuth2 (Google, GitHub, GitLab, Facebook) support.
  • File Storage: Store files locally or on S3; supports file attachments and thumbnail generation.
  • Admin Dashboard: Built-in web UI for managing collections, records, users, and files.
  • Stateless Auth Tokens: Lightweight authentication without session storage.
  • Extendable Backend: Customize with Go and JavaScript hooks.
  • Single Binary Deployment: Run the entire backend with one executable file.
  • REST-ish Web API: Simple and consistent HTTP API for frontend integrations.

PocketBase: Realtime Backend in a Single Go File

Building a backend often means stitching together multiple services: a database, authentication, file storage, and realtime data handling. PocketBase offers a refreshing alternative, a full-featured backend in a single Go binary, with no external dependencies.

What is PocketBase?

PocketBase is an open-source backend written in Go. It ships as a single executable file, yet it includes everything you'd expect from a modern backend:

  • An embedded SQLite database with realtime capabilities
  • User and file management
  • A simple REST-ish API
  • A built-in admin dashboard for managing your app

It’s designed to be portable, lightweight, and fast to set up, making it ideal for side projects, internal tools, or even full production apps where simplicity is a priority.

Managing Data with Collections

At the heart of PocketBase is the concept of collections. Think of these as your application's tables, they're automatically backed by SQLite, with each collection corresponding to a database table.

Each individual entry in a collection is called a record. You can create and manage collections and records directly from the web-based admin dashboard. Alternatively, you can automate this process using Go or JavaScript migrations.

Whether you're prototyping a quick idea or building a structured app, this schema-first approach keeps your data clean and your development fast.

Stateless Authentication

PocketBase handles authentication through a stateless token system. When a client sends a valid Authorization: YOUR_AUTH_TOKEN header, it’s considered authenticated. There's no session state or token persistence on the server, everything is handled via local state on the client.

To "log out" a user, you simply discard the token. If you're using one of the SDKs, a single pb.authStore.clear() does the trick. Tokens can be generated through auth collection endpoints or programmatically using Go or JavaScript.

You can configure which auth methods are available for each collection, including email/password and third-party OAuth2 providers like Google, GitHub, GitLab, and Facebook.

Built-in Realtime and File Storage

PocketBase comes with realtime database subscriptions out of the box. Any changes to your data, whether inserts, updates, or deletes, can be instantly pushed to clients who are subscribed to the relevant collection.

File storage is equally seamless. You can store files locally or connect to an S3-compatible service, attach media to records, and even generate thumbnails on the fly. It’s a powerful setup for apps that handle images, documents, or any form of media content.

Extend and Customize

Despite its simplicity, PocketBase is designed to grow with your needs. You can use it as-is, or customize it through Go and JavaScript hooks. This allows you to write business logic, add background jobs, or integrate with other systems, all without giving up the benefits of a single, self-contained binary.

More Open Software Alternatives for Database Management: