Thus there are only two postgres operations per message - initial insert, update on streaming complete. This should hopefully scale to the moon.
03.06.2025 15:28 β π 1 π 0 π¬ 0 π 0@marbemac.bsky.social
Founder stoplight.io (acquired). Now building Datanaut. I like talking about ui / ux, agentic patterns, company building, and anything coding related.
Thus there are only two postgres operations per message - initial insert, update on streaming complete. This should hopefully scale to the moon.
03.06.2025 15:28 β π 1 π 0 π¬ 0 π 07. on llm stream complete, update the message in pg with the final message parts, set status to "completed", and close sse connections
8. the message part and status change is sync'd to client via zero - client now uses those parts to render the message instead of the previously streamed parts
5. token stream parts are kept in memory in the durable object, and streamed to connected clients over SSE
6. if a new client connects (or old client re-connects), it is immediately caught up to the present by streaming down the in memory parts on connect
4. we're opening an SSE connection per "streaming" message, not per thread. multiple messages can be streaming at the same time, within the same thread
03.06.2025 15:28 β π 0 π 0 π¬ 1 π 03. on the client, when rendering any message that has status "streaming", open an SSE connection via ORPC to a durable object instance representing the chat thread
03.06.2025 15:28 β π 0 π 0 π¬ 1 π 01. to kick off generating a reply, we insert a new message into postgres with status "streaming" and empty content
2. this new empty message is sync'd to the client via Zero
Streaming every token through pg / zero is not a great option at scale, so we're using SSE and cloudflare durable objects to handle the token streaming, and pg / zero for the durable persistence once streaming is complete.
03.06.2025 15:28 β π 0 π 0 π¬ 1 π 0Type-safe resumable streams and multi-user chat, courtesy of @Cloudflare durable objects, @zero__ms, and @orpc - how does it work?
03.06.2025 15:28 β π 0 π 0 π¬ 1 π 0Humble beginnings - every great product has to start somewhere
02.06.2025 16:08 β π 0 π 0 π¬ 0 π 0I can't wait to share more. Most importantly, I can't wait to start shipping again π.
29.05.2025 16:03 β π 0 π 0 π¬ 0 π 0I'm not much of a sharer, but this go-around I'm committed to building more in public. Expect to see regular posts from me on things like ui / ux design, agentic patterns, running a lean company, and more in the weeds technical stuff.
29.05.2025 16:03 β π 0 π 0 π¬ 1 π 0It's too early to share specifics, I'm excited to work with our small team to re-imagine how we as humans interface with AI, each other, and the treasure trove of data that is fragmented across the apps we use every day.
29.05.2025 16:03 β π 0 π 0 π¬ 1 π 0Finally. It's time. A decade after starting my first company (wow time flies), I'm working on something new!
The new company is Datanaut, more below.
Love it! Where will the code live? Eager to take a look
14.01.2025 16:59 β π 1 π 0 π¬ 0 π 0Hello World
03.12.2024 18:02 β π 2 π 0 π¬ 0 π 0