Margin

A review room for copy, specs and policies. Each document is shared with the people who should see it, as editor or commenter, and that share is the database's access rule: someone it isn't shared with can't read the document, its comments or its live room. Reviewers comment on a paragraph, reply, react and resolve; every comment, reaction and resolve reaches everyone on the document live, avatars show who is reading it now, and readers see when someone is replying or editing the draft.

Members invited by the team. Each document has its owner, editors and commenters.

Margin on desktopMargin on a phone

What's inside

Documents shared with you, by status. Paragraph comments with replies, reactions and resolve. Who is viewing now, who is replying, who is editing. Edits and status changes that appear live. New document and share dialogs.

Tables

  • member name, email, title, avatar
  • doc title, body, review, kind, owner_id, due_on, share_with
  • doc_access doc_id, member_id, role, joined_via
  • thread doc_id, paragraph, quote, author_id, resolved, resolved_by
  • comment thread_id, doc_id, author_id, body, edited_at
  • reaction comment_id, doc_id, member_id, emoji

Roles

  • member Member, staff

Pages

  • /docs Documents (member)
  • /access People (member)

Components

  • MarginLogin Sign-in for Margin: email and password, Google, reset, beside a document with live margin comments
  • MarginDocs Document review: the documents shared with you, paragraph comments in the margin with replies, reactions and resolve, who is viewing, live edits by editors, status and sharing

Rules on every write

  • doc Give the document a title of 3 to 120 characters.
  • doc Keep a document under 50,000 characters.
  • doc You create documents as yourself.
  • doc A document keeps its owner.
  • doc_access A document has one owner: share as editor or commenter.
  • doc_access A share stays with its document and person.
  • thread You start threads as yourself.
  • thread Only whether a thread is resolved changes after it's posted.
  • thread Quote the passage you're commenting on (up to 300 characters).
  • comment Write something before you post.
  • comment You comment as yourself.
  • comment A comment belongs to its thread's document.
  • and 3 more

Realtime

  • doc Live: each change reaches whoever can read the row
  • doc_access Live: each change reaches whoever can read the row
  • thread Live: each change reaches whoever can read the row
  • comment Live: each change reaches whoever can read the row
  • reaction Live: each change reaches whoever can read the row
  • doc_room:<doc> Channel. Join: member (and can read the doc). Send: members. Shows who is here

How its workflows run

Each one is a server workflow in your project: it runs on its trigger, with retries, and its runs show in the builder's log.

  1. Make the creator a new document's owner and share it with the people picked

    When a row changes: doc created. Then: Create doc_access, then Look up member, then Notify.

  2. Tell the people in a thread about a new reply

    When a row changes: comment created. Then: Look up member, then Notify.

  3. Tell a thread's author when it's resolved

    When a row changes: thread updated. Then: Look up member, then Notify.

  4. Tell everyone on a document when it's approved

    When a row changes: doc updated. Then: Look up doc_access, then Notify.

Set it up

It starts a new project, with its data, roles and sign-in ready.

  1. Start the project

    Use the button above, or ask your coding agent with the Appbricx MCP server connected (quickstart).

  2. Sign in as each role

    The demo logins open each role's home. Change what you like in plain words or in the contract.

  3. Deploy

    When dev looks right, deploy. Production gets a snapshot first, so you can roll back.

Use it with your coding agent

The agent creates the project, builds it and signs in as each role.

Prompt
Start a new Appbricx project from the Margin template (slug "margin") with use_template. Call it "My Margin", then sign in as each role, verify it and tell me what to change first.
MCP call
{
  "tool": "use_template",
  "arguments": {
    "slug": "margin",
    "name": "My Margin"
  }
}
CLI
appbricx templates use margin --name "My Margin"

Make it yours in plain words.