Company
Date Published
Author
Andrés Ortiz Corrales
Word count
2721
Language
English
Hacker News points
None

Summary

We built a demo of r/place using GraphQL subscriptions with Neo4j Graph Database. We created a collaborative 30x30 canvas where users can paint and their changes are shared in real-time across all connected users through WebSockets. The demo showcases how to create a production-ready real-time service with GraphQL, including scalability and performance considerations. We used Apollo Server, graphql-ws, urql, and CloudAMQP for the server-side implementation. The client-side implementation was built using HTML5 Canvas, JavaScript, and Puppeteer headless browser. We demonstrated how to scale the demo horizontally by using AMQP as a message broker and Neo4jGraphQLSubscriptionsAMQPPlugin. The demo can handle roughly 500 concurrent users painting at the same time, with one bot equivalent to 10 concurrent users in terms of load to the system.