[{"data":1,"prerenderedAt":378},["ShallowReactive",2],{"navigation":3,"\u002Farticles\u002Fworkspace-part-1-building-a-real-time-home-for-team-collaboration":38,"\u002Farticles\u002Fworkspace-part-1-building-a-real-time-home-for-team-collaboration-surround":373},[4],{"title":5,"path":6,"stem":7,"children":8,"page":37},"Articles","\u002Farticles","articles",[9,13,17,21,25,29,33],{"title":10,"path":11,"stem":12},"Automated Deployment using Github Actions","\u002Farticles\u002Fautomated-deployment-using-github-actions","articles\u002Fautomated-deployment-using-github-actions",{"title":14,"path":15,"stem":16},"Automatically Logout All Tab Using VueUse Broadcast Channel with Pinia","\u002Farticles\u002Fautomatically-logout-all-tab-using-vueuse-broadcast-channel-with-pinia","articles\u002Fautomatically-logout-all-tab-using-vueuse-broadcast-channel-with-pinia",{"title":18,"path":19,"stem":20},"Clever but risky Elixir patterns","\u002Farticles\u002Fclever-but-risky-elixir-patterns","articles\u002Fclever-but-risky-elixir-patterns",{"title":22,"path":23,"stem":24},"Hide your NGINX header on Ubuntu","\u002Farticles\u002Fhide-your-nginx-header-on-ubuntu","articles\u002Fhide-your-nginx-header-on-ubuntu",{"title":26,"path":27,"stem":28},"Technical Debt","\u002Farticles\u002Ftechnical-debt","articles\u002Ftechnical-debt",{"title":30,"path":31,"stem":32},"Workspace: Part 1 - Building a real-time collaboration app","\u002Farticles\u002Fworkspace-part-1-building-a-real-time-home-for-team-collaboration","articles\u002Fworkspace-part-1-building-a-real-time-home-for-team-collaboration",{"title":34,"path":35,"stem":36},"Workspace: Part 2 - Bringing video calls into Workspace","\u002Farticles\u002Fworkspace-part-2-adding-video-calls","articles\u002Fworkspace-part-2-adding-video-calls",false,{"id":39,"title":30,"author":40,"body":44,"date":364,"description":365,"extension":366,"image":367,"meta":368,"minRead":369,"navigation":370,"path":31,"seo":371,"stem":32,"__hash__":372},"articles\u002Farticles\u002Fworkspace-part-1-building-a-real-time-home-for-team-collaboration.md",{"name":41,"avatar":42},"Roslan Saidi",{"src":43,"alt":41},"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F13043860?v=4",{"type":45,"value":46,"toc":344},"minimark",[47,51,62,65,68,71,77,82,85,88,95,100,103,106,109,115,119,122,125,128,134,138,146,149,152,156,159,162,165,171,174,177,181,184,191,194,197,200,216,219,223,226,229,232,236,240,243,246,249,253,256,259,262,266,269,272,278,282,285,288,324,328,335,338,341],[48,49,50],"p",{},"Workspace is an app I built where people can write documents, draw on a whiteboard, and manage tasks together. The idea is simple: keep the discussion, the plan, and the tasks in the same place.",[48,52,53,54,61],{},"You can ",[55,56,60],"a",{"href":57,"rel":58},"https:\u002F\u002Fworkspace.roslansaidi.com",[59],"nofollow","try Workspace for yourself",". Invite a friend and see what happens when you both edit at the same time.",[48,63,64],{},"I used Next.js and Tailwind CSS for the frontend, with Elixir\u002FPhoenix for the backend. For the editor and live changes, I used Tiptap and Yjs. PostgreSQL stores the data and Redis handles PubSub and presence.",[48,66,67],{},"There are quite a few parts here. But the main question was pretty simple: what happens when two people change something at the same time? And what happens if one of them loses their connection?",[48,69,70],{},"Those questions are where most of the interesting work came from.",[48,72,73],{},[74,75,76],"em",{},"The screenshots in this article are from the running app, using demo accounts and sample content.",[78,79,81],"h2",{"id":80},"what-can-you-do-in-workspace","What can you do in Workspace?",[48,83,84],{},"There are three main types of spaces: documents, whiteboards, and Kanban boards.",[48,86,87],{},"The home page lists your spaces. There is also Recent to find something you just opened, categories to organise things, and Trash if you need to recover a deleted space.",[48,89,90],{},[91,92],"img",{"alt":93,"src":94},"Workspace Home showing navigation, recent activity, and spaces","\u002Fimages\u002Fworkspace\u002Fhome.png",[96,97,99],"h3",{"id":98},"write-a-document-together","Write a document together",[48,101,102],{},"The editor supports headings, lists, checklists, tables, code blocks, and image attachments. People can edit the same document and leave comments beside it.",[48,104,105],{},"You can also select some text and comment on that part. This helps when someone asks for a change. They can point to the exact sentence instead of saying “the paragraph somewhere near the bottom”.",[48,107,108],{},"Mentions create a notification, and clicking it brings you back to the discussion.",[48,110,111],{},[91,112],{"alt":113,"src":114},"A document in Workspace with a teammate's comment","\u002Fimages\u002Fworkspace\u002Feditor.png",[96,116,118],{"id":117},"sketch-an-idea","Sketch an idea",[48,120,121],{},"Sometimes a document is not enough to explain an idea. The whiteboard lets you add sticky notes, shapes, text, images, drawings, and arrows.",[48,123,124],{},"Arrows stay connected when you move a shape. You can also group items, align them, undo changes, and export the board.",[48,126,127],{},"One detail here: zoom and position belong to each user. If I zoom in to read a sticky note, it should not change your view. But if I move the sticky note itself, everyone should see that change.",[48,129,130],{},[91,131],{"alt":132,"src":133},"A whiteboard with connected shapes and sticky notes","\u002Fimages\u002Fworkspace\u002Fwhiteboard.png",[96,135,137],{"id":136},"keep-track-of-tasks","Keep track of tasks",[48,139,140,141,145],{},"The Kanban board has three columns: ",[142,143,144],"strong",{},"To do, In progress, and Done",". Each card can have a description, an assigned member, a priority, and a due date.",[48,147,148],{},"There are filters and a My tasks view to make the board easier to use when more cards are added. Assigning someone sends them an in-app notification with a link to the card. Assigning yourself does not send an alert.",[48,150,151],{},"I also kept new cards as drafts until they are created. If you open the form and cancel, it should not leave an empty card on the board. Small thing, but it would be annoying otherwise.",[78,153,155],{"id":154},"showing-someone-dragging-a-card","Showing someone dragging a card",[48,157,158],{},"Moving a card sounds straightforward. You drag it, release it, and everyone sees the new position.",[48,160,161],{},"But what does the other person see while you are still holding it?",[48,163,164],{},"If the app only sends the final position, they have no idea you are moving anything until the card suddenly changes place. So I added a live preview. Other users can see your name on the card you are holding, along with a marker showing where you plan to drop it.",[48,166,167],{},[91,168],{"alt":169,"src":170},"Another user's view of Roslan dragging a Kanban card","\u002Fimages\u002Fworkspace\u002Flive-drag.png",[48,172,173],{},"The preview sends small updates at a limited rate. It also sends a regular signal while the card is held, even if the mouse stops moving. If the user disconnects, the preview expires so it does not stay on screen forever.",[48,175,176],{},"This is temporary activity. It does not need to be saved in the document history. The final card position does.",[78,178,180],{"id":179},"how-the-updates-work","How the updates work",[48,182,183],{},"Yjs handles merging changes when people edit at the same time. Phoenix handles the connection, checks permissions, and saves accepted updates to PostgreSQL.",[48,185,186,187,190],{},"The browser also keeps a local copy in ",[142,188,189],{},"IndexedDB",". This lets a user keep their edits locally and reopen a space they have visited before when the connection is down.",[48,192,193],{},"A separate Yjs worker handles things like combining older updates into snapshots and checking task assignment changes. Redis supports PubSub, presence, and rate limiting.",[48,195,196],{},"Each update gets an ID from the browser. That matters when the connection drops at an awkward moment.",[48,198,199],{},"For example:",[201,202,203,207,210,213],"ol",{},[204,205,206],"li",{},"You make a change.",[204,208,209],{},"The server saves it.",[204,211,212],{},"Your connection drops before the server can confirm it.",[204,214,215],{},"Your browser sends the same update again after reconnecting.",[48,217,218],{},"Without a way to recognise that update, the server could save it twice. Using the same ID lets it recognise the retry.",[78,220,222],{"id":221},"what-happens-when-you-go-offline","What happens when you go offline?",[48,224,225],{},"Keeping the page open is only one part of offline support. The harder part is reconnecting without losing what anyone wrote.",[48,227,228],{},"Imagine you edit a document offline while your teammate keeps editing online. When you come back, sending your whole copy over theirs would lose their changes. Workspace uses Yjs to merge the changes instead.",[48,230,231],{},"Local data is kept separately for each user and space. Previously opened spaces can work offline, but opening a space for the first time still needs a connection. Uploads and permission changes also need to be online.",[78,233,235],{"id":234},"a-few-things-that-needed-extra-care","A few things that needed extra care",[96,237,239],{"id":238},"sending-notifications-once","Sending notifications once",[48,241,242],{},"A task assignment should create a notification even if processing fails and needs to retry. But the retry should not send the same alert again.",[48,244,245],{},"When Phoenix accepts an update, it saves a notification job in the same database transaction. The Yjs worker checks the assignment changes and processes the job. The notification and the job's completion are saved together, so a failed attempt can be retried safely.",[48,247,248],{},"There is more going on behind the bell icon than it first seems.",[96,250,252],{"id":251},"restoring-an-older-version","Restoring an older version",[48,254,255],{},"You can preview a saved version before restoring it. But someone else might still be editing the current version while you are looking at the old one.",[48,257,258],{},"The restore checks whether new updates have arrived. If they have, it stops and asks for review. Otherwise, restoring could quietly replace work your teammate just added.",[48,260,261],{},"A successful restore also creates a backup of the previous content. Comments, sharing settings, and the space title are kept separately.",[96,263,265],{"id":264},"checking-access-on-the-server","Checking access on the server",[48,267,268],{},"Workspace has owners, editors, commenters, and viewers. Hiding an edit button is useful for the interface, but the server still needs to check what each person is allowed to do.",[48,270,271],{},"Phoenix checks permissions on channel operations and reconnects. Notifications also check current access, so an old notification does not give someone access to a space they can no longer open.",[48,273,274],{},[91,275],{"alt":276,"src":277},"The sharing dialog with members and their access roles","\u002Fimages\u002Fworkspace\u002Fsharing.png",[78,279,281],{"id":280},"the-interface","The interface",[48,283,284],{},"I used cream backgrounds, purple accents, DM Sans for the interface, and Newsreader for titles. Documents, whiteboards, and task boards share the same navigation and controls, so users do not need to learn everything again when switching spaces.",[48,286,287],{},"There are light and dark themes, plus layouts for smaller screens. Animations also respect the user's reduced-motion setting.",[289,290,291,304],"table",{},[292,293,294],"thead",{},[295,296,297,301],"tr",{},[298,299,300],"th",{},"Dark theme",[298,302,303],{},"Mobile layout",[305,306,307],"tbody",{},[295,308,309,317],{},[310,311,312],"td",{},[91,313],{"src":314,"width":315,"alt":316},"\u002Fimages\u002Fworkspace\u002Fdark-mode.png",640,"Workspace Kanban board in dark mode",[310,318,319],{},[91,320],{"src":321,"width":322,"alt":323},"\u002Fimages\u002Fworkspace\u002Fmobile.png",200,"Workspace Home on mobile",[78,325,327],{"id":326},"what-i-learned","What I learned",[48,329,330,331,334],{},"The backend verification recorded ",[142,332,333],{},"104 passing tests",". The checks cover things like merging edits, replaying offline changes, duplicate updates, permissions, snapshots, and notifications. There are separate browser and multi-node recovery checks too.",[48,336,337],{},"The part that stood out to me was how much happens between making a change and seeing it on another screen. A card can end up in the right place, but the experience still feels confusing if nobody can see who is moving it.",[48,339,340],{},"The same goes for saving. People need their work to survive a disconnect, and reconnecting should not mean choosing whose changes to throw away.",[48,342,343],{},"There are still limits. Kanban has three fixed columns, notifications stay inside the app, and you cannot open a new space offline. But building Workspace gave me a better understanding of how the editor, the connection, and the database need to work together. Even a small action like assigning a task can involve all three.",{"title":345,"searchDepth":346,"depth":346,"links":347},"",2,[348,354,355,356,357,362,363],{"id":80,"depth":346,"text":81,"children":349},[350,352,353],{"id":98,"depth":351,"text":99},3,{"id":117,"depth":351,"text":118},{"id":136,"depth":351,"text":137},{"id":154,"depth":346,"text":155},{"id":179,"depth":346,"text":180},{"id":221,"depth":346,"text":222},{"id":234,"depth":346,"text":235,"children":358},[359,360,361],{"id":238,"depth":351,"text":239},{"id":251,"depth":351,"text":252},{"id":264,"depth":351,"text":265},{"id":280,"depth":346,"text":281},{"id":326,"depth":346,"text":327},"2026-11-08","How I built Workspace with Next.js and Elixir and what I learned about editing together, offline changes, and keeping everyone's work safe.","md","\u002Fimages\u002Fworkspace\u002Fkanban.png",{},6,true,{"title":30,"description":365},"fqELnEQ27JBMZI3O2EY0-u1iPxDN-q3CrDWpi9M4kHM",[374,376],{"title":26,"path":27,"stem":28,"description":375,"children":-1},"A beginner-friendly look at how coding shortcuts today can create bigger problems tomorrow.",{"title":34,"path":35,"stem":36,"description":377,"children":-1},"Talk, share ideas, and work together without leaving your shared space. Here's how I added video calls to Workspace using LiveKit and WebRTC.",1795413958099]