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
- ✨ What is this?
- 🚀 Quick start
- 📦 Installation
- 🖥 The interactive TUI
- 📋 Command reference
- 📚 Documentation
- 🏗 Contributing
- ⚖️ License
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
ofgawith 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 asofga. It is not affiliated with OpenFGA.
# 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
ofgaAlready have a server? Skip step 1 and pass its URL to ofga init.
brew install sergiught/tap/ofgacurl -fsSL https://github.com/ghraw/sergiught/openfga-cli/main/install.sh | bashFull matrix (AUR, go install, Docker, source), upgrade, and uninstall → the installation guide
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
Every command has a generated reference page with a live demo recording: https://sergiught.github.io/openfga-cli/reference/
- Installation: install methods, upgrade, uninstall
- The interactive TUI: playground tour + full keybinding reference
- Command reference: every command and flag
- Testing authorization models: the
model testworkspace, coverage, CI - Configuration: config file, profiles, env vars
- Authentication: auth methods, secret files, keyring
- Scripting & automation: output formats, exit codes, pagination
- Recipes: common end-to-end flows
- Troubleshooting: common issues + shell completion
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 ./...MIT © Sergiu Ghitea. Built for the excellent OpenFGA project (not affiliated).
