Skip to content

Workspaces (multi-user accounts) #12

@Yentec

Description

@Yentec

Context

The current model is single-user: a User owns links and keys directly. Real-world usage (agencies, teams) requires shared ownership.

Goal

Introduce Workspace as the ownership boundary. A user belongs to one or more workspaces with a role (owner, member).

Approach (high-level)

  • New tables: Workspace, WorkspaceMember(userId, workspaceId, role).
  • Link.userId -> Link.workspaceId. Migration with a default workspace per existing user.
  • JWT payload gains a workspaceId (active workspace).
  • POST /v1/workspaces, POST /v1/workspaces/:id/invitations, GET /v1/workspaces.
  • API keys get scoped to a workspace.

Acceptance criteria

  • Data model migrated with zero data loss
  • All /v1/links* endpoints scoped by workspace
  • Invitation flow (email + token) — email sending is optional, token returned in API response is enough for v1
  • Migration tested with seed data

Notes

This is a significant change. Likely split into 3-4 PRs: data model, scoping, invitations, API keys.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions