Skip to content

API and/or Native SDKs #26

Description

@coopbri

By offering an API (e.g. a thin HTTP layer), developers could write authZ logic in TypeScript (awesome), and be able to use the server in any language/framework (also awesome). Similar use case for SDKs, but I think API is a great fit for this case in particular.

For example, keep the existing workflow of writing authZ logic in TypeScript, expose endpoints over HTTP, treat Permix as a PDP for any TypeScript or non-TypeScript projects like Rust, Go.

Persistence and caching would help here especially for scalability, I'm unsure if there are plans to implement a database or if this library's goal is to stay stateless & in-memory. If planned, I can create a separate issue for this specific task.

All of this is partially paved because of Permix' existing adapters for e.g. Elysia and Hono, that same bridge could be used to offer a native API (or plugin) to simply check authZ from any client

Example snippets (RESTful & GraphQL stubs) -- rough ideas:

// ...
app.get('/permissions/:resource/:id', (req, res) => {
  const { resource, id } = req.params;

  // Permix logic to check perms

  res.json(perms);
});
query {
  check(resource: "post", action: "read", userId: "u1", resourceId: "p1")
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions