Giter Club home page Giter Club logo

openfga's Introduction

OpenFGA

Go Reference GitHub release (latest SemVer) Container Image Downloads
License Codecov Go Report Snyk Vulnerabilities for GitHub Repo
Discord Server Twitter

A high-performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.

OpenFGA is designed to make it easy for developers to model their application permissions and add and integrate fine-grained authorization into their applications.

Getting Started

The following section aims to help you get started quickly. Please look at our official documentation for in-depth information.

Setup and Installation

ℹī¸ The following sections setup an OpenFGA server using the default configuration values. These are for rapid development and not for a production environment.

For more information on how to configure the OpenFGA server, please take a look at our official documentation on Configuring OpenFGA or our Production Checklist.

Docker

OpenFGA is available on Dockerhub, 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 openfga/openfga run

Docker Compose

docker-compose.yaml provides an example of how to launch OpenFGA using docker compose. It launches PostgreSQL too, but it's not wired up to use it as a datastore yet:

docker compose up openfga

If you haven't cloned the repository you can get the docker-compose.yaml file with the following command:

curl -LO https://openfga.dev/docker-compose.yaml

Pre-compiled Binaries

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

./bin/openfga run

Source

Make sure you have Go 1.18 or later installed. See the Go downloads page.

You can install from source using Go modules (make sure $GOBIN is on your shell $PATH).

export PATH=$PATH:$(go env GOBIN)

Then:

go install github.com/openfga/openfga/cmd/openfga

Or you can build it with the source by cloning the project and then building it.

git clone https://github.com/openfga/openfga.git && cd openfga
go build cmd/openfga/openfga.go

./openfga run

Running with Postgres

This section assumes that you have cloned the repository.

To run OpenFGA with the Postgres datastore engine, simply run the following commands:

docker compose up -d postgres
make run-postgres

This should start a Postgres container, write the database schema, and start the OpenFGA server.

When you are done you can stop the Postgres container with:

docker compose down

## Verifying the Installation

Now that you have [Set up and Installed](#setup-and-installation) OpenFGA, you can test your installation by [creating an OpenFGA Store](https://openfga.dev/docs/getting-started/create-store).

```bash
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"
}

Next Steps

Take a look at examples of how to:

Don't hesitate to browse the official Documentation, API Reference.

Production Readiness

The core OpenFGA service has been in use by Auth0 FGA in production since December 2021.

OpenFGA's PostgreSQL Storage Adapter was purposely built for OpenFGA and does not have production usage yet.

The OpenFGA team will do its best to address all production issues with high priority.

Contributing

See CONTRIBUTING.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.