Introduction
Authentication and authorization are often confused, but they solve different problems. Authentication verifies who a user is, while authorization determines what that user is allowed to do.
As applications grow, authorization becomes increasingly complex. A simple role-based approach may work for small applications, but enterprise systems often require more granular control. For example:
A user can edit documents they own.
Managers can view reports for their department.
Project members can access specific resources.
Administrators can manage permissions across the system.
Implementing these rules directly in application code quickly becomes difficult to maintain and scale.
This is where SpiceDB comes in.
SpiceDB is an open-source authorization database designed to manage fine-grained permissions at scale. Inspired by Google's Zanzibar authorization system, SpiceDB provides a centralized way to define, store, and evaluate permissions across applications.
In this article, we'll explore what SpiceDB is, how it works, and how organizations can use it to build scalable authorization systems.
What Is SpiceDB?
SpiceDB is a dedicated authorization system that allows developers to manage access control independently from application logic.
Instead of embedding permission checks throughout your codebase, SpiceDB centralizes authorization decisions.
Key capabilities include:
Fine-grained access control
Relationship-based permissions
Centralized authorization
Scalable permission evaluation
Multi-tenant support
API-driven architecture
Flexible permission modeling
SpiceDB is particularly useful for applications where permissions change frequently or involve complex relationships between users and resources.
Why Traditional Authorization Becomes Difficult
Many applications begin with Role-Based Access Control (RBAC).
Example:
Admin
Editor
Viewer
This works well initially but often becomes difficult to manage as requirements evolve.
Consider a project management platform:
Alice can edit Project A.
Bob can view Project B.
Carol manages Team X.
Team X owns Project A.
Authorization logic becomes more complicated when permissions depend on ownership, team membership, resource hierarchy, or organizational structure.
Embedding these rules in application code often leads to:
Duplicate permission checks
Complex maintenance
Security risks
Inconsistent behavior
A centralized authorization system helps solve these challenges.
Understanding Relationship-Based Access Control
SpiceDB uses a relationship-based authorization model.
Instead of assigning permissions directly, it stores relationships between users and resources.
Example:
Alice --> owner --> Document1
Bob --> viewer --> Document1
Carol --> editor --> Document1
Permissions are derived from these relationships.
This approach provides significantly more flexibility than traditional role-based systems.
How SpiceDB Works
A simplified SpiceDB architecture looks like this:
Application
|
v
SpiceDB
|
+---- Users
+---- Resources
+---- Relationships
|
v
Authorization Decision
When an application needs to verify access:
The application sends an authorization request.
SpiceDB evaluates relationships.
Permission rules are processed.
A decision is returned.
The application simply consumes the result.
Core Concepts in SpiceDB
Understanding a few core concepts is essential.
Objects
Objects represent resources within the system.
Examples:
document:123
project:456
repository:789
These are the entities being protected.
Subjects
Subjects represent actors.
Examples:
user:alice
user:bob
group:engineering
Subjects perform actions on resources.
Relationships
Relationships connect subjects and objects.
Example:
document:123#owner@user:alice
This means Alice owns Document 123.
Permissions
Permissions define what actions are allowed.
Examples:
view
edit
delete
share
Permissions are typically derived from relationships.
Defining an Authorization Schema
SpiceDB uses schemas to define authorization models.
Example:
definition user {}
definition document {
relation owner: user
relation viewer: user
permission view = owner + viewer
}
In this model:
Owners can view documents.
Viewers can view documents.
Permissions are expressed declaratively rather than through application code.
Creating Relationships
After defining a schema, relationships can be stored.

Join the conversation! Your thoughts help the community grow.