Interactive Product Tour

See how a PM turns a raw idea into specs engineers trust

Follow Sarah, a Technical PM, as she specs out Role-Based Access Control for her team's SaaS app — from plain-language description to architect-grade technical spec, in minutes.

Based on the pain point: "Specs mean different things to different engineers"

Step 1/6Intro

Meet Sarah, a Technical PM

Sarah's team is building a project management SaaS. Customers are asking for role-based permissions, but last time a feature was underspecified, two engineers built conflicting implementations. She needs a spec engineers can trust.

QEEK
SP

RBAC Feature

Started today at 10:15 AM

Qeek10:15 AM
Welcome back! You have 2 active projects. What would you like to work on today?
Describe what you want to build...
QEEK
Session ChatRBAC System
Qeek10:18 AM
I've created the initial product spec and technical spec for the RBAC system. The tech spec covers the data models, Firestore security rules, and the permission checking middleware.
Sarah (PM)10:20 AM
The permissions matrix looks good, but we need to make sure Viewers can still comment on tickets — they just can't create or edit them.
Qeek10:21 AM
Updated! I've added a "comment" permission to the matrix and set it to `true` for all roles including Viewer. I also updated the tech spec's middleware section to show how comment creation checks for `canComment` instead of `canEdit`.
Sarah (PM)10:23 AM
Can you add a section about what happens when an Owner leaves the team? We need a transfer ownership flow.
Qeek10:24 AM
Done! Added a new section to both specs. The product spec now covers the ownership transfer flow (Owner must designate a new Owner before they can leave). The tech spec includes the Firestore transaction that atomically swaps the owner role.
Sarah (PM)10:26 AM
This is looking solid. Let me review the technical spec before we share it with the engineering team.
Qeek10:26 AM
Of course! I've opened the technical spec in the workspace. You can see the full permissions matrix, data models, and the new ownership transfer section. Let me know if anything needs adjusting before you share it.
Ask about this spec...

Qeek has context of all session files

Technical Spectechnical-spec.md

Tech Spec: Role-Based Access Control

1. System Architecture

1.1 High-Level Overview

RBAC is implemented as a cross-cutting concern across three layers: Firestore data model, backend middleware, and frontend UI gating.

RBAC System
├── Data Layer (Firestore)
│   ├── teams/{teamId}/members/{userId}
│   └── invitations/{inviteId}
├── Enforcement Layer
│   ├── Firestore Security Rules
│   └── API Middleware (checkPermission)
└── UI Layer
    ├── Role-gated components
    └── Permission hooks (usePermission)

2. Data Models

2.1 Team Member Document

Stored at teams/{teamId}/members/{userId}

typescript
interface TeamMember {
  userId: string;
  email: string;
  displayName: string;
  role: 'owner' | 'admin' | 'member' | 'viewer';
  joinedAt: Timestamp;
  invitedBy: string;
}

2.2 Invitation Document

Stored at invitations/{inviteId}

typescript
interface Invitation {
  id: string;
  teamId: string;
  email: string;
  role: 'admin' | 'member' | 'viewer';
  status: 'pending' | 'accepted' | 'expired';
  createdBy: string;
  createdAt: Timestamp;
  expiresAt: Timestamp; // 7 days from creation
}

2.3 Permissions Map

typescript
const PERMISSIONS: Record<Role, Permission[]> = {
  owner:  ['view', 'create', 'edit', 'delete', 'comment', 'manage_members', 'billing', 'transfer_ownership'],
  admin:  ['view', 'create', 'edit', 'delete', 'comment', 'manage_members'],
  member: ['view', 'create', 'edit', 'comment'],
  viewer: ['view', 'comment'],
};

3. Enforcement Layer

3.1 Firestore Security Rules

match /teams/{teamId}/tickets/{ticketId} {
  allow read: if isTeamMember(teamId);
  allow create, update: if hasPermission(teamId, 'edit');
  allow delete: if hasPermission(teamId, 'delete');
}

function isTeamMember(teamId) {
  return exists(/databases/$(database)/documents/teams/$(teamId)/members/$(request.auth.uid));
}

function hasPermission(teamId, permission) {
  let member = get(/databases/$(database)/documents/teams/$(teamId)/members/$(request.auth.uid));
  return permission in PERMISSIONS[member.data.role];
}

3.2 Frontend Permission Hook

typescript
function usePermission(permission: Permission): boolean {
  const { currentTeamMember } = useTeamContext();
  if (!currentTeamMember) return false;
  return PERMISSIONS[currentTeamMember.role].includes(permission);
}

// Usage in components:
function DeleteTicketButton({ ticketId }: { ticketId: string }) {
  const canDelete = usePermission('delete');
  if (!canDelete) return null;
  return <Button onClick={() => deleteTicket(ticketId)}>Delete</Button>;
}

4. Key Workflows

4.1 Invite Flow

  1. Admin calls POST /api/teams/{teamId}/invitations
  2. Backend validates admin has manage_members permission
  3. Creates invitation document with 7-day expiry
  4. Sends email via Resend with magic link
  5. On click: validates invite → creates team member → marks invite accepted

4.2 Ownership Transfer

  1. Owner calls POST /api/teams/{teamId}/transfer-ownership
  2. Backend runs Firestore transaction:
  • Verify caller is current owner
  • Set target user's role to owner
  • Set caller's role to admin
  • Both writes are atomic

5. API Endpoints

EndpointMethodPermission Required
/api/teams/{id}/membersGETview
/api/teams/{id}/invitationsPOSTmanage_members
/api/teams/{id}/members/{uid}/rolePATCHmanage_members
/api/teams/{id}/transfer-ownershipPOSTtransfer_ownership

6. Migration Strategy

6.1 Existing Teams

All existing team members will be migrated to the member role. The team creator will be set as owner. This migration runs as a one-time Cloud Function.

6.2 Rollout

  • Week 1: Deploy with feature flag, internal testing
  • Week 2: Enable for beta teams, gather feedback
  • Week 3: GA rollout with in-app announcement
Session
RBAC System
New file
acme/project-mgmt

What Sarah's team got

In 10 minutes, Sarah went from a rough idea to a complete specification package — shareable with the whole team.

Product Spec

Roles matrix, user flows, success metrics, and non-goals — all in one document the whole team can reference.

Technical Spec

Exact data models, Firestore security rules, API endpoints, permission hooks, and a migration strategy — grounded in the real repo.

UI Mockups

Team management page, invite modal, and role picker — engineers see exactly what to build.

Ready to try it with your next feature?

No more "specs mean different things to different engineers." Every engineer reads the same data models, the same API contracts, the same rules.

Free to start
No credit card required
Works with your repo