(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=41322281

隆重推出 InstantDB,这是一个开源客户端数据库,旨在简化 Notion 和 Figma 等实时协作应用程序的开发。 创始人 Joe 和 Stopa 此前曾在 Facebook 和 Airbnb 等公司担任高级工程师和普通工程师。 他们观察到,创建现代应用程序的过程通常需要多个重复任务,包括设置服务器、集成身份验证、管理权限以及处理后端和前端之间的数据传输。 这些过程可能变得耗时且复杂,使得创建愉快的用户体验变得具有挑战性。 受到 Asana 的 WorldStore 和 Figma 的 LiveGraph 等现有解决方案的启发,InstantDB 为开发人员提供了一个可通过浏览器访问的内置数据库,而无需为每个应用程序提供单独的服务器。 开发人员可以使用自己喜欢的语法编写关系查询来请求和操作数据,而 InstantDB 则自动处理数据检索、权限检查和缓存管理。 在 InstantDB 中处理事务时,乐观更新和回滚已成为标准。 底层技术采用 PostgreSQL 进行存储,并在运行自定义 Datalog 引擎之前以三重格式保存数据,以实现高效的数据访问。 InstantDB 使用 PostgreSQL 的预写日志记录 (WAL) 来跟踪更改并根据“最后写入获胜”原则解决冲突。 此外,由于其 WebSocket 集成和本地数据存储方法,它还支持多人游戏功能和离线模式。 立即提供多种附加功能,例如对身份验证的支持、细化权限以及包含管理工具集合的仪表板。 诸如存在(共享光标)和广播(例如实时反应)之类的临时功能也可用。 有一个免费计划,具有无限的活动应用程序、商业用途零限制,并且项目不会暂停。 付费选项提供可扩展的资源以满足不断增长的需求。 支持自托管部署以增加灵活性。 如果感兴趣,请访问教程页面或下面链接的 GitHub 存储库。 欢迎反馈。 参考: 1. 详细说明为什么开发应用程序的典型工作流程涉及不必要的复杂性的文章 - 。 2. 提议的解决方案大纲侧重于对关系的 Firebase 式数据库支持 -

相关文章

原文
Hey there HN! We’re Joe and Stopa, and today we’re open sourcing InstantDB, a client-side database that makes it easy to build real-time and collaborative apps like Notion and Figma.

Building modern apps these days involves a lot of schleps. For a basic CRUD app you need to spin up servers, wire up endpoints, integrate auth, add permissions, and then marshal data from the backend to the frontend and back again. If you want to deliver a buttery smooth user experience, you’ll need to add optimistic updates and rollbacks. We do these steps over and over for every feature we build, which can make it difficult to build delightful software. Could it be better?

We were senior and staff engineers at Facebook and Airbnb and had been thinking about this problem for years. In 2021, Stopa wrote an essay talking about how these schleps are actually database problems in disguise [1]. In 2022, Stopa wrote another essay sketching out a solution with a Firebase-like database with support for relations [2]. In the last two years we got the backing of James Tamplin (CEO of Firebase), became a team of 5 engineers, pushed almost ~2k commits, and today became open source.

Making a chat app in Instant is as simple as

    function Chat() {
      // 1. Read
      const { isLoading, error, data } = useQuery({
        messages: {},
      });
    
      // 2. Write
      const addMessage = (message) => {
        transact(tx.messages[id()].update(message));
      }
    
      // 3. Render!
      return 
    }
Instant gives you a database you can subscribe to directly in the browser. You write relational queries in the shape of the data you want and we handle all the data fetching, permission checking, and offline caching. When you write transactions, optimistic updates and rollbacks are handled for you as well.

Under the hood we save data to postgres as triples and wrote a datalog engine for fetching data [3]. We don’t expect you to write datalog queries so we wrote a graphql-like query language that doesn’t require any build step.

Taking inspiration from Asana’s WorldStore and Figma’s LiveGraph, we tail postgres’ WAL to detect novelty and use last-write-win semantics to handle conflicts [4][5]. We also handle websocket connections and persist data to IndexDB on web and AsyncStorage for React Native, giving you multiplayer and offline mode for free.

This is the kind of infrastructure Linear uses to power their sync and build better features faster [6]. Instant gives you this infrastructure so you can focus on what’s important: building a great UX for your users, and doing it quickly. We have auth, permissions, and a dashboard with a suite tools for you to explore and manage your data. We also support ephemeral capabilities like presence (e.g. sharing cursors) and broadcast (e.g. live reactions) [7][8].

We have a free hosted solution where we don’t pause projects, we don’t limit the number of active applications, and we have no restrictions for commercial use. We can do this because our architecture doesn’t require spinning up a separate servers for each app. When you’re ready to grow, we have paid plans that scale with you. And of course you can self host both the backend and the dashboard tools on your own.

Give us a spin today at https://instantdb.com/tutorial and see our code at https://github.com/instantdb/instant

We love feedback :)

[1] https://www.instantdb.com/essays/db_browser

[2] https://www.instantdb.com/essays/next_firebase

[3] https://www.instantdb.com/essays/datalogjs

[4] https://asana.com/inside-asana/worldstore-distributed-cachin...

[5] https://www.figma.com/blog/how-figmas-multiplayer-technology...

[6] https://www.youtube.com/live/WxK11RsLqp4?t=2175s

[7] https://www.joewords.com/posts/cursors

[8] https://www.instantdb.com/examples?#5-reactions

联系我们 contact @ memedata.com