Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

382 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

the interactive ofga playground TUI

ofga

A modern CLI & TUI for OpenFGA.

Manage stores, authorization models, relationship tuples, and run checks from your terminal, or explore everything interactively in a full-screen TUI.

Quick start · The TUI · Commands · Configuration · Docs · Contributing

CI CodeQL Go Report Card Release Go version GHCR License: MIT Conventional Commits PRs welcome


📑 Table of contents


✨ What is this?

ofga is a single, dependency-free binary that gives you two ways to work with an OpenFGA server:

  • 🧰 A scriptable CLI: create stores, write and inspect authorization models, manage relationship tuples, run check/list-objects/list-users/list-relations, and run assertion suites. Read commands provide consistent JSON/YAML output, tabular commands support --plain, and failures return meaningful exit codes.
  • 🖥 A full-screen TUI: launch it by running ofga with no arguments. Browse stores, visualize a model as a colored relation graph, edit tuples, run queries and expand their resolution trees, and manage assertions, all with the keyboard or the mouse.

It talks to any OpenFGA-compatible server and reuses your connection profiles so you can switch between local, staging, and production in one flag.

Naming: the official OpenFGA CLI is fga. This is a separate, independent reimagining focused on ergonomics and an interactive TUI, distributed as ofga. It is not affiliated with OpenFGA.


🚀 Quick start

ofga CLI quickstart: create a store, write a model, write a tuple, check access

# 1. Start a local OpenFGA server in another terminal
docker run --rm --name openfga -p 8080:8080 openfga/openfga run

# 2. Point ofga at it (guided; uses http://localhost:8080 by default)
ofga init

# 3. Create a store and make it active
ofga stores create demo --use

# 4. Write an authorization model
cat > model.fga <<'FGA'
model
  schema 1.1

type user

type document
  relations
    define viewer: [user]
FGA
ofga model write --file model.fga
# `.fga` DSL is transformed to JSON for you. `--file` also takes a `.json`
# model, or `-` to read from stdin.

# 5. Add a relationship tuple
ofga tuples write user:anne viewer document:roadmap

# 6. Ask an authorization question
ofga query check user:anne viewer document:roadmap
# ✓ ALLOWED  user:anne viewer document:roadmap

# 7. …or explore everything interactively
ofga

Already have a server? Skip step 1 and pass its URL to ofga init.


📦 Installation

brew install sergiught/tap/ofga
curl -fsSL https://github.com/ghraw/sergiught/openfga-cli/main/install.sh | bash

Full matrix (AUR, go install, Docker, source), upgrade, and uninstall → the installation guide


🖥 The interactive TUI

Run ofga with no arguments to launch the interactive playground, a keyboard- and mouse-driven cockpit covering profiles, stores, the model graph, tuples, queries with resolution trees, and assertions. Press ? at any time for the full, context-aware keybinding overlay.

Icons adapt to your terminal automatically. If they render as ? or boxes, press ctrl+g to cycle to a plainer glyph set — see terminal glyphs.

Full TUI guide & keybinding reference → the TUI guide


📋 Command reference

Every command has a generated reference page with a live demo recording: https://sergiught.github.io/openfga-cli/reference/


📚 Documentation


🏗 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for the build/test/lint workflow and the Conventional Commits convention used for automated releases.

Report bugs and request features through GitHub Issues. Report vulnerabilities privately as described in SECURITY.md.

go build ./...
go test ./...

⚖️ License

MIT © Sergiu Ghitea. Built for the excellent OpenFGA project (not affiliated).

Releases

Packages

Used by

Contributors

Languages