API

Workspaces, members and invites

51 files3 packages1 dependency

This pack adds workspaces to your API as JSON endpoints, so your users can work together with their team in shared spaces.

  • Workspaces with members and roles, powered by the Permissions package.
  • A personal workspace for every new user, created at signup.
  • Users can belong to as many workspaces as they need.
  • Every route and query scoped to the current workspace.
  • Email invites. New users accept them by signing up, and existing users by signing in.
  • Member management. Owners can change roles and remove members, and any member can leave.
  • Workspace settings, where owners can rename the workspace.

Depends on Auth

This pack builds on the Auth pack's User model, login, signup and email setup, so apply the Auth pack first.

Apply the workspaces pack with Flow. Start a new session in your selected coding agent and execute the following slash command inside it.

$ npx @adonisplus/flow apply --pack=workspaces --agent=claude

After applying, Flow will make the following changes to your app.

  • Find the guard your app uses to log users in: access tokens or sessions.
  • Add an endpoint that tells your frontend which workspace to open after login: the first one the user joined.
  • Install the packages the pack needs.
  • Add the workspace tables, models and roles, and the authorization checks that decide who can do what.
  • Add the workspace, member and invite endpoints, plus the invite email.
  • Create a personal workspace at signup, and let users accept an invite after they sign up or log in.
  • Run the tests, call each endpoint, and give you a brief your frontend can build against.