openfga/openfga

Sponsored OSS

By Cloud Native Computing Foundation

โ€ขUpdated 20 days ago

A high performance and flexible authorization/permission engine built for developers and inspired by

Image
Security
Developer tools
8

10M+

openfga/openfga repository overview

OpenFGA Logo

โ OpenFGA

Join our community DeepWiki Go Reference GitHub release (latest SemVer) Docker Pulls Codecov Go Report CII Best Practices FOSSA Status Artifact HUB OpenSSF Scorecard SLSA 3


OpenFGA is a high-performance, flexible authorization/permission engine inspired by Google Zanzibarโ . It helps developers easily model and enforce fine-grained access control in their applications.

โ Highlights


โ Table of Contents


โ Quickstart

Important

The following steps are meant for quick local setup and evaluation. When using the default **in-memory storage engine**, data is ephemeral and will be discarded once the service stops.

For details on configuringโ  storage backends, tuning performance, and deploying OpenFGA securely in production-ready environments, refer to the documentation: Running in Productionโ .

Run OpenFGA with in-memory storage (โš ๏ธ not for production):

docker run -p 8080:8080 -p 3000:3000 openfga/openfga run

Once running, create a store:

curl -X POST 'localhost:8080/stores' \
  --header 'Content-Type: application/json' \
  --data-raw '{"name": "openfga-demo"}'

โ Installation

โ Docker

OpenFGA is available on Docker Hubโ , so you can quickly start it using the in-memory datastore by running the following commands:

docker pull openfga/openfga
docker run -p 8080:8080 -p 3000:3000 openfga/openfga run

Note

When the HTTP server is enabled, it will attempt to establish an internal client connection to the gRPC server via unix domain socket. When it is not possible to establish a UDS, the client connection automatically falls back to using a TCP socket.

If running the Docker image using the --read-only option, the --tmpfs option must also be set in order to enabled use of the unix domain socket. For example --tmpfs /tmp

โ Docker Compose

docker-compose.yamlโ  provides an example of how to launch OpenFGA with Postgres using docker compose.

curl -LO https://openfga.dev/docker-compose.yaml
docker compose up
โ Homebrew

If you are a Homebrewโ  user, you can install OpenFGAโ  with the following command:

brew install openfga
โ Precompiled Binaries

Download your platform's latest releaseโ  and extract it. Then run the binary with the command:

./openfga run
โ Build from Source

Note

Make sure you have the latest version of Go installed. See the [Go downloads](https://go.dev/dl/) page.
โ go install
export PATH=$PATH:$(go env GOBIN) # make sure $GOBIN is on your $PATH
go install github.com/openfga/openfga/cmd/openfga
openfga run
โ go build
git clone https://github.com/openfga/openfga.git && cd openfga
go build -o ./openfga ./cmd/openfga
./openfga run
โ Verify Installation

Now that you have installedโ  OpenFGA, you can test your installation by creating an OpenFGA Storeโ .

curl -X POST 'localhost:8080/stores' \
  --header 'Content-Type: application/json' \
  --data-raw '{"name": "openfga-demo"}'

If everything is running correctly, you should get a response with information about the newly created store, for example:

{
  "id": "01G3EMTKQRKJ93PFVDA1SJHWD2",
  "name": "openfga-demo",
  "created_at": "2022-05-19T17:11:12.888680Z",
  "updated_at": "2022-05-19T17:11:12.888680Z"
}

โ Playground

The Playground lets you model, visualize, and test authorization setups. By default, itโ€™s available at: http://localhost:3000/playgroundโ 

Note

The Playground is intended for **local development only**. It can currently only be configured to connect to an OpenFGA server running on `localhost`.

Disable it with:

./openfga run --playground-enabled=false

Change port:

./openfga run --playground-enabled --playground-port 3001

Tip

The `OPENFGA_HTTP_ADDR` environment variable can be used to configure the address at which the Playground expects the OpenFGA server to be.

For example:

docker run -e OPENFGA_PLAYGROUND_ENABLED=true \
-e OPENFGA_HTTP_ADDR=0.0.0.0:4000 \
-p 4000:4000 -p 3000:3000 openfga/openfga run

This starts OpenFGA on port 4000 and configures the Playground accordingly.

โ Next Steps

Take a look at examples of how to:

๐Ÿ“š Explore the Documentationโ  and API Referenceโ .

โ Limitations

โ MySQL Storage engine

The MySQL storage engine has stricter length limits on tuple properties than other backends. See docsโ .

๐Ÿ’ก OpenFGAโ€™s MySQL adapter was contributed by @twintag โ€” thank you!

โ Production Readiness

  • โœ… Used in production by Auth0 FGAโ  since December 2021
  • โš ๏ธ Memory storage adapter is for development only
  • ๐Ÿ—„ Supported storage: PostgreSQL 14+, MySQL 8, SQLite (beta)
  • ๐Ÿ“˜ See Running in Productionโ 

The OpenFGA team treats production-impacting issues with highest priority.

See organizations using OpenFGA in production: ADOPTERS.mdโ . If your organization is using OpenFGA, please consider adding it to the list.

โ Contributing & Community

We welcome contributions and community participation.

Tag summary

Content type

Image

Digest

sha256:d735c511aโ€ฆ

Size

12.9 kB

Last updated

20 days ago

docker pull openfga/openfga:sha256-efde89d24487da1a8bc37d85b61341f1fb7024943a1ded65f4b7d51a75666688.att

This week's pulls

Pulls:

597,579

Last week