Skip to main content
This documentation is mirrored from the OpenFGA CLI repository. For the most up-to-date version, please refer to the CLI documentation.
The store file is a YAML configuration file (.fga.yaml) that defines a complete OpenFGA store setup, including the authorization model, relationship tuples, and test cases. This file format enables easy management, testing, and deployment of OpenFGA configurations.

File Structure

The store file uses YAML syntax and supports the following top-level properties:

Core Components

1. Store Metadata

  • name (required): The display name for the store
  • This name is used when creating a new store via import

2. Authorization Model

You can specify the authorization model in two ways:

Option A: External File Reference

Option B: Inline Model Definition

The model defines the authorization schema including:
  • Types (user, document, folder, etc.)
  • Relations (viewer, editor, owner, etc.)
  • Authorization rules and conditions

3. Relationship Tuples

Tuples define the actual relationships between users and objects. You can specify them in two ways:

Option A: External File Reference

Option B: Inline Tuple Definition

Supported tuple file formats:
  • YAML (.yaml, .yml)
  • JSON (.json)
  • CSV (.csv)

4. Tests

The tests array contains test cases to validate your authorization model and tuples.

Test Structure

Each test can include:
  • name (required): Test identifier
  • description (optional): Human-readable test description
  • tuple_file or tuples: Test-specific relationship tuples (appended to global tuples)
  • check: Authorization check tests
  • list_objects: List objects API tests
  • list_users: List users API tests

Check Tests

Validate whether a user has specific relations to an object:

List Objects Tests

Validate which objects a user can access:

List Users Tests

Validate which users have access to an object:

Context Support (ABAC)

The store file supports Attribute-Based Access Control (ABAC) through contextual information:

File Composition

The store file supports flexible composition:

Global + Test-Specific Data

  • Global tuples: Applied to all tests
  • Test-specific tuples: Appended to global tuples for individual tests
  • Both tuple_file and tuples can be used together

Mixed Inline and File References

CLI Commands Using Store Files

Store Import

Import a complete store configuration:

Model Testing

Run tests against an authorization model:

Store Export

Export store configuration to file:

Examples

Basic Store File

Advanced Store with ABAC

Multi-Test Store File

Best Practices

  1. Use descriptive names: Make store and test names clear and meaningful
  2. Organize with external files: For complex models, use separate .fga files for models and .yaml files for tuples
  3. Comprehensive testing: Include check, list_objects, and list_users tests to validate all API behaviors
  4. Context testing: When using ABAC, test both positive and negative cases with different context values
  5. Modular tuples: Use both global and test-specific tuples to avoid repetition
  6. Version control: Store files work well with Git for tracking authorization changes over time

File Extensions

  • Store files: .fga.yaml (recommended) or .yaml
  • Model files: .fga (recommended) or .mod
  • Tuple files: .yaml, .json, or .csv
The .fga.yaml extension is the conventional naming pattern that makes store files easily identifiable and helps with tooling integration. Learn more about testing models

Testing Models

Learn how to test your authorization models
Last modified on September 28, 2026