OpenFGA Sample Stores

June 25, 2026 ยท View on GitHub

Join our community X

This repository contains sample store models for OpenFGA.

Table of Contents

Authorization Patterns

Examples that demonstrate how to model authorization for well-known products and common patterns.

ExampleDescription
Modeling GuideStep-by-step introduction to OpenFGA modeling
Multi-Tenant RBACMulti-tenant role-based access control
GitHubRepository, organization, and team permissions
Google DriveFile, folder, and shared drive permissions
EntitlementsFeature entitlements and plan-based access
SlackWorkspace, channel, and messaging permissions
Role AssignmentsRole assignment patterns for resource-specific roles
Temporal AccessTime-limited access grants with expiration
Super-AdminSuper-admin override patterns

OpenFGA Features

Examples that demonstrate specific OpenFGA features and capabilities.

ExampleDescription
Modeling ABAC with ReBACCombine attribute-based and relationship-based access control
Condition Data TypesCEL condition expressions with different data types
Custom RolesUser-defined roles with dynamic permission assignment
Advanced EntitlementsComplex entitlement and feature-gating patterns
Group Resource AttributesGroup-based access with resource attributes
IP-Based AccessNetwork-based access restrictions using conditions
Modular ModelsSplitting models into modules for team collaboration

Industry Examples

Full authorization models for different verticals and industries. Each includes a model, sample tuples, tests, and a README explaining the use case.

ExampleDescription
AccountingCharts of accounts, invoices, expenses, payments, journal entries
AdvertisingCampaigns, ad groups, ads, creatives, reports
Applicant TrackingJobs, candidates, applications, interviews, offers
BankingAccounts, transactions, and financial operations
CalendarCalendars, events, scheduling links, recordings, webinars
Call CenterCalls, contacts, comments, recordings
Chat & MessagingConversations, messages, groups, membership
CRMAccounts, contacts, leads, opportunities, pipeline
Developer PortalAPI keys, applications, and developer access
E-CommerceStores, products, customers, orders, reviews
ExpensesExpense reports, approvals, and reimbursements
File StorageDrives, folders, files with hierarchical permissions
HealthcarePatients, encounters, diagnoses, treatments, medications
HospitalityHotels, rooms, reservations, guest services
Human ResourcesEmployees, teams, payroll, benefits, time-off
IoTDevice management and telemetry access
Issue TrackingCollections, tickets, comments, attachments
Knowledge BaseContainers, articles, attachments, public content
Knowledge ManagementSpaces, pages, comments with publishing workflow
Learning ManagementCourses, classes, content, activities, grading
ManufacturingProduction lines, machines, work orders, quality reports
PaymentPayments, payouts, refunds, subscriptions
Real EstateProperties, listings, transactions, inspections

Authoring Models using Coding Assistants

AI coding assistants can help you author OpenFGA models. The modeling guidelines are maintained in the OpenFGA Best Practices Skill.

Some prompts you can try:

  • Create an OpenFGA authorization model for an insurance company.
  • Create an OpenFGA authorization model for B2B SaaS project management system.
  • Create an OpenFGA authorization model for <Product Name> (e.g. create a model for Figma).

It will create a model in an .fga file, and a .fga.yaml with tuples/tests, and use the CLI to run the tests.

Claude Code

Install the skill, then prompt Claude Code with a modeling request:

npx skills add openfga/agent-skills

Example prompt: /openfga Create an OpenFGA authorization model for an insurance company.

GitHub Copilot

Guidance is auto-loaded from .github/copilot-instructions.md when you open this repository in VS Code with Copilot enabled.

Other Tools (Cursor, generic LLMs)

Reference the full guidelines from openfga/agent-skills:

You can also use the DeepWiki MCP or the Context7 MCP to provide AI agents with OpenFGA context to help you implement OpenFGA using different SDKs.

Creating your store and loading sample data

To try this out, you need the following tools installed:

  1. Clone this repository
git clone https://github.com/openfga/sample-stores.git openfga-sample-stores && cd $_
  1. Use the fga CLI to test the store you choose (e.g. github, custom-roles, etc..)
SAMPLE_STORE=github
fga model test --tests "stores/${SAMPLE_STORE}/store.fga.yaml"

OpenFGA Models in Open Source Projects

If you are using OpenFGA in your open source project, please let us know by opening a PR to add your model to this list.

Modeling Resources