This documentation is mirrored from the OpenFGA CLI repository. For the most up-to-date version, please refer to the CLI documentation.
.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
- 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
- YAML (
.yaml,.yml) - JSON (
.json) - CSV (
.csv)
4. Tests
Thetests array contains test cases to validate your authorization model and tuples.
Test Structure
Each test can include:name(required): Test identifierdescription(optional): Human-readable test descriptiontuple_fileortuples: Test-specific relationship tuples (appended to global tuples)check: Authorization check testslist_objects: List objects API testslist_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_fileandtuplescan 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
- Use descriptive names: Make store and test names clear and meaningful
- Organize with external files: For complex models, use separate
.fgafiles for models and.yamlfiles for tuples - Comprehensive testing: Include check, list_objects, and list_users tests to validate all API behaviors
- Context testing: When using ABAC, test both positive and negative cases with different context values
- Modular tuples: Use both global and test-specific tuples to avoid repetition
- 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
.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