123DevOps··7 min read

What is OpenFGA? Fine-grained, relationship-based authorization inspired by Google Zanzibar

Learn what OpenFGA is, how relationship-based access control (ReBAC) works, how to write a model in the DSL, write tuples, and call the check API, and when it's a better fit than OPA.

Kubernetes

“Can Ana view this document?” It sounds simple until you find out Ana was never added to the document: she owns the folder it lives in, and that folder was shared with her team. This kind of permission, which comes from relationships between people, groups, and objects, is what breaks simple role models. OpenFGA exists to solve exactly that, with production-grade performance.

What OpenFGA is

OpenFGA is a fine-grained authorization server, open source under the Apache 2.0 license, inspired by Google Zanzibar, the system Google described in 2019 that centralizes permissions for products such as Drive and YouTube. The project was born at Auth0 (now part of Okta), and the README itself states it has been used in production by Auth0 FGA since December 2021.

In the CNCF, OpenFGA joined the Sandbox in September 2022 and moved to incubating in October 2025, its status as of November 2026 (check the project page). The latest version we saw on the releases page was v1.23.0, from November 2026.

What problem it solves

Classic RBAC answers “who is an admin?” well, but struggles with questions like:

  • who can edit this document, taking folder, team, and organization into account?
  • which projects can user X see? (to filter a listing)
  • if I remove Ana from the team, what does she lose?

Solving this with JOINs scattered across every service’s code leads to duplicated, inconsistent rules. OpenFGA centralizes it: the model describes how permissions derive from relationships, the tuples store which relationships exist, and the application just asks.

How it works

The model is ReBAC (Relationship-Based Access Control). A relationship tuple always has three parts: user, relation, and object, such as user:ana is owner of folder:finance.

Concept What it is Example
Store An isolated space with models and tuples One per product or environment
Authorization model Types, relations, and derivation rules, written in the DSL define viewer: [user] or editor
Tuple A fact: user, relation, object user:ana owner folder:finance
Check “Does user X have relation R with object O?” Returns {"allowed": true}
ListObjects / ListUsers Which objects a user can access, or which users can access an object Filtering a listing screen
Conditions ABAC rules (CEL expressions) on tuples Access only during business hours

The server exposes HTTP and gRPC APIs and stores everything in a datastore: PostgreSQL, MySQL, or SQLite (beta). The default is in-memory, for development only, because the data disappears when the process stops.

Hands-on example

The server and the fga CLI weren’t run in the environment where this article was written: the commands follow the official documentation. The JSON blocks were validated with Python, and the model’s logic was checked with a simple simulation.

The model in the DSL

Folders and documents, where folder permissions flow down to documents:

model
  schema 1.1

type user

type team
  relations
    define member: [user]

type folder
  relations
    define owner: [user]
    define viewer: [user, team#member] or owner

type document
  relations
    define parent: [folder]
    define owner: [user]
    define editor: [user] or owner
    define viewer: [user, team#member] or editor or viewer from parent

How to read it: a document viewer is anyone added directly (a user or the members of a team), or anyone who is an editor, or anyone who is a viewer of the parent folder. Since the folder owner is also a viewer of it, Ana can see the document without any direct tuple.

Starting the server and writing the model

docker run -p 8080:8080 -p 8081:8081 -p 3000:3000 openfga/openfga run

# in another terminal, with the fga CLI
fga store create --name "documents"
fga model write --store-id=$FGA_STORE_ID --file=model.fga

Port 8080 is the HTTP API, 8081 is gRPC, and 3000 is the Playground, a UI for visualizing the model and testing checks.

Tuples and check in JSON

Writing the relationships via POST /stores/{store_id}/write:

{
  "authorization_model_id": "01JD7Z3M8Q4N6P2R5T9V0WXYZA",
  "writes": {
    "tuple_keys": [
      { "user": "user:ana", "relation": "owner", "object": "folder:finance" },
      { "user": "folder:finance", "relation": "parent", "object": "document:budget-2027" },
      { "user": "user:bruno", "relation": "member", "object": "team:audit" },
      { "user": "team:audit#member", "relation": "viewer", "object": "document:budget-2027" }
    ]
  }
}

And asking via POST /stores/{store_id}/check:

{
  "authorization_model_id": "01JD7Z3M8Q4N6P2R5T9V0WXYZA",
  "tuple_key": {
    "user": "user:ana",
    "relation": "viewer",
    "object": "document:budget-2027"
  }
}

The answer is {"allowed": true}: Ana owns the folder, so she is a viewer of the folder, so she is a viewer of the document. Bruno also gets true, through the audit team; asking editor for him returns false.

Testing the model

An authorization model is code and deserves tests in CI. The CLI reads a .fga.yaml file with the model, tuples, and assertions:

model_file: ./model.fga
tuples:
  - user: user:ana
    relation: owner
    object: folder:finance
  - user: folder:finance
    relation: parent
    object: document:budget-2027
tests:
  - name: folder-owner-sees-documents
    check:
      - user: user:ana
        object: document:budget-2027
        assertions:
          viewer: true
          editor: false
fga model test --tests documents.fga.yaml

When to use it (and when not to)

Use it when permissions depend on hierarchies and sharing (folders, organizations, projects, teams), when several applications need the same source of truth for permissions, or when you need to answer “what can this user see?” to filter listings.

Don’t use it when:

  • fixed roles are enough (admin, editor, reader per application): simple RBAC, or Kubernetes’ own RBAC for cluster resources, does the job;
  • the decision depends on request attributes rather than relationships (time, IP, the contents of a manifest): that’s OPA territory;
  • you can’t keep tuples in sync with the source system. A forgotten tuple is unauthorized access.

OpenFGA and OPA: differences

Both are about authorization and both are CNCF projects, but they answer different questions, and it’s common to use them together.

Criterion OpenFGA OPA
Model ReBAC (relationships), with ABAC conditions General policies over any JSON
Language Model DSL + tuples Rego
Where the data lives In OpenFGA itself (datastore) Arrives in input or data (bundles)
Typical question “Can Ana view document X?” “Does this request or manifest break any rule?”
List accessible objects Yes (ListObjects) Not its focus
Use outside applications Uncommon Kubernetes, Terraform, Envoy, CI
CNCF (Nov 2026) Incubating Graduated

If your API is exposed through a gateway, a common pattern is to keep authentication and general rules at the edge and call OpenFGA inside the service for the decision about the specific object. For a refresher on API fundamentals, see what is a REST API.

Summary

  • OpenFGA is a fine-grained, relationship-based authorization server inspired by Google Zanzibar
  • It has been an incubating CNCF project since October 2025; check the current status on the project page
  • The DSL model defines how permissions derive; tuples store the facts
  • The check API answers allowed: true/false for a user, relation, and object
  • Use PostgreSQL or MySQL in production; the in-memory datastore is for development only
  • Test the model in CI with fga model test
  • Combine it with OPA when the decision depends on attributes rather than relationships

Permissions that depend on relationships don’t fit in a role table: model the relationships and let the system derive the rest.

Get updates on new posts and stay in the loop!