openfga / roadmap

OpenFGA Public Roadmap
2 stars 0 forks source link

Open Source play.fga.dev #7

Open aaguiarz opened 2 years ago

aaguiarz commented 2 years ago

We haven't open sourced the FGA Playground. We believe it should be part of the OpenFGA project and we'll open source it.

seandlg commented 1 year ago

This is great news! Currently, the playground unfortunately cannot be put behind a reverse proxy at a domain other than localhost (e.g. playground.localhost), due to its restrictive CSP.

Content Security Policy directive: "frame-ancestors http://localhost:*"

aaguiarz commented 1 year ago

Hi @seandlg

It's not likely that we'll be prioritizing this soon. Meanwhile, we recommend using the FGA CLI + the VS code integration to interact with OpenFGA in those case.

Let me know if that helps.

seandlg commented 1 year ago

Hi @aaguiarz

Thanks for reaching out! I'll try out your suggestion next weeks, sounds fantastic!

josxha commented 5 months ago

An alternative workaround is to forward both ports via ssh to the local machine.

  1. If running in a docker container, expose both ports locally:
    services:
    openfga:
    ...
    ports:
      - "127.0.0.1:8080:8080"
      - "127.0.0.1:3000:3000"
  2. And open a ssh connection with port forwarding:
    ssh user@your-server.com -L 3000:127.0.0.1:3000 -L 8080:127.0.0.1:8080

After that you can open the playground on http://localhost:3000/playground

SamTV12345 commented 2 months ago

We haven't open sourced the FGA Playground. We believe it should be part of the OpenFGA project and we'll open source it.

Is it possible that I can work on this task so that OpenFGA bundles everything locally without reaching to play.fga.dev?

aaguiarz commented 2 months ago

@SamTV12345 it's hard, as we'll need to rewrite most of it to make it open source as it's using internal libraries :(

SamTV12345 commented 2 months ago

@SamTV12345 it's hard, as we'll need to rewrite most of it to make it open source as it's using internal libraries :(

Oh okay. I'm currently introducing OpenFGA at our company but we use OAuth2.0 as our auth type. I could put some time into this and come up with a solution. I guess moving from Next to Client side React shouldn't be hopefully too hard.

aaguiarz commented 2 months ago

How do you envision using the Playground? We've seen most companies ending up using VS Code/Jetbrains IDE + CLI for development purposes

SamTV12345 commented 2 months ago

How do you envision using the Playground? We've seen most companies ending up using VS Code/Jetbrains IDE + CLI for development purposes

The idea was that I can login to the Playground, check the auth model, change it etc. Just like you can do it in development mode. How would you edit the model once it's deployed on a production system and there is no plaground available?

aaguiarz commented 2 months ago

The model can be stored in your source control system. You can see some examples of production models in Github here.

You can edit models/tests files with any editor, but OpenFGA has coloring/validation for VSCode and JetBrains IDEs.

You can use the CLI / https://openfga.dev/docs/getting-started/cli, or the Github action to deploy the model to production.

Does that help?

SamTV12345 commented 2 months ago

The model can be stored in your source control system. You can see some examples of production models in Github here.

You can edit models/tests files with any editor, but OpenFGA has coloring/validation for VSCode and JetBrains IDEs.

You can use the CLI / https://openfga.dev/docs/getting-started/cli, or the Github action to deploy the model to production.

Does that help?

Thanks. That really helps. A web UI would be easier but for the time being that is enough to get started :)

aaguiarz commented 2 months ago

You can actually use the test files / CLI for the same purpose of the Playground without requiring an OpenFGA server, as the CLI can evaluate model/queries without calling the server. That's the way I test models myself.

The test files have support for list-objects, list-users and conditions, which the Playground does not have yet.