Every collaboration on DraftKit is a single row in one table. That decision made everything else easier.
The collab_requests table is the core entity, and every feature, from guest access to workspace permissions to metrics, flows through it.
Here is exactly how I designed it and why.
Why One Table Handles the Whole Lifecycle
When I started designing the schema, the obvious instinct was to split things up. A workspaces table, a separate collaborations table, a drafts table. That would have been three tables to keep in sync, three places for a status to get out of sync, and three surfaces for an RLS policy to go wrong.
I chose a different approach. Every collaboration, whether it is an inbound guest post request, an outgoing proposal, or a solo draft someone created with the “Start Writing” button, is a row in collab_requests. The status field does all the state management: pending when someone submits a request, approved when the host accepts, published when the collab goes live, and cancelled when it falls through.
The shared workspace editor content lives directly in collab_requests.shared_content as sanitized HTML. There is no separate drafts table. The workspace is not a separate entity. It is a view into the state of a single row.
The Fields That Drive the Core Product
The table has fields most collaboration tools would put in three separate tables. Here is what matters most and why each field exists:
✅
is_solo(boolean) — when a creator hits “Start Writing” and opens a blank workspace with no collaborator, it creates acollab_requestwithis_solo: trueandstatus: 'approved'. Solo drafts use the exact same workspace, the same editor, the same RLS policies. No special-casing anywhere.✅
shared_content(HTML) — the live draft text. DOMPurify-sanitized on every save, with a tag whitelist that allows tables, images, and sticky highlights but blocks everything else. No base64 images, ever: the sanitizer strips them.✅
ai_draft(JSON) — the SMART-generated first draft, stored separately from the live content. Hosts can generate it, preview it, and apply it to the workspace. A re-apply guard checks for manual edits before overwriting.✅
editing_sessions(JSON array) — tracks who edited, when, and for how long. Not for billing. For product intelligence: which workspaces are actually being used versus opened once and abandoned.✅
content_last_edited_by/content_last_edited_at— presence-aware fields that power the “someone else is editing” indicator without needing a separate real-time table.
The Credit Model Lives in the Schema
DraftKit runs on a Host-Pays credit model. The host spends one credit when they approve a collaboration or create a solo workspace. Guests never pay.
That logic is enforced at the database level, not just the application layer. The creators table has a credits column defaulting to 3. The get_host_capacity() RPC returns the current available balance including referral bonuses. When a host approves a request, the credit deduction happens server-side before the status update.
Pro users bypass this entirely. is_pro_user(user_id) checks three conditions: the user_roles table for a pro role, the creators.subscription_tier column, and an active trial window. If any of those is true, no credit is deducted. A Founding Member who cancels their Stripe subscription still has the pro role in user_roles, so their access survives the cancellation.
The RLS Architecture
Row-Level Security is the enforcement layer for every permission decision in DraftKit. Here is the actual policy logic, not a simplified summary:
Anonymous users can INSERT a collab_request with status = 'pending'. That is what makes the public booking page work without auth. But they cannot SELECT anything. A guest filling out a booking form on draftkit.app/elena has zero read access to the database.
Once a collaboration is approved, access opens up through a single helper function: has_workspace_access(user_id, request_id). This function checks three conditions: is the user the host creator, is the user the original requester, or is the user listed in workspace_collaborators for that request. If any of those is true, the user gets full read and write access to the workspace.
The host-only restriction on Writer’s Room invitations is also enforced at the RLS level. Only the request owner can INSERT into workspace_collaborators. A collaborator who has been invited cannot invite additional people. That is “Host Home Court Advantage” and it is a policy, not a UI constraint.
The Permanent Access Rule
One of the most important schema decisions I made was around access persistence. Once a host spends a credit to unlock a workspace, that access is permanent. Downgrading from Pro to free does not lock anyone out of past work. Cancelling a subscription does not revoke access to approved collaborations.
This is intentional. Credits are an entry toll, not a recurring subscription. The has_workspace_access() function does not check current plan status. It checks whether the workspace was ever properly unlocked. That is a one-time event recorded in the collab_requests row itself.
The practical implication: if you approved a collaboration six months ago and then downgraded to free, you and your collaborator still have full access to that workspace. The credit was spent. The workspace is yours.
What the Supporting Tables Do
The core collab_requests table is not the whole picture. A few supporting tables handle the pieces that would otherwise bloat the main row:
✅
workspace_collaborators— multi-guest support (the Writer’s Room). Stores email, user_id, role, and join timestamp per invited collaborator. RLS-gated so only the host can insert.✅
workspace_presence— real-time presence indicators. Heartbeat polling updateslast_active_atper user. Shows the green dot in the Writer’s Room sidebar.✅
collab_metrics— post-publication engagement snapshots. After a collaboration is marked “Published”, both parties enter their Substack post URLs and the metrics edge function pulls likes, comments, and subscriber counts. Stored as snapshots so the data is preserved even if the Substack post is later edited.✅
collaboration_messages— the threaded conversation feed inside the workspace. Free users see the most recent message; older messages are gated behind Pro. The blurring is applied client-side but the data access is controlled server-side.
The Decision I Would Make the Same Way Again
Some product decisions feel uncertain for a long time. This one does not. Treating the workspace as a state on the collaboration row, rather than a separate entity, is the right architecture for this product.
It means every historical collaboration is fully queryable from a single table. It means the analytics RPC is straightforward. It means there is one source of truth for status, access, content, and metrics.
If you are building a collaboration product and you are debating whether to separate the “workspace” from the “collaboration,” my answer is: do not, until you have a specific technical reason that forces the separation.
Try DraftKit
The full collaboration infrastructure is live at draftkit.app.
If you are building a similar product and want a technical review of your data model and access architecture, book a product audit at promptledproduct.com/audits.


