https://github.com/instantdb/instant Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development + View all Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} instantdb / instant Public * Notifications You must be signed in to change notification settings * Fork 53 * Star 3.3k The realtime client-side database instantdb.com License Apache-2.0 license 3.3k stars 53 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 8 * Pull requests 4 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights instantdb/instant This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit message Last commit date Latest commit History 20 Commits .github .github client client server server .gitignore .gitignore LICENSE.md LICENSE.md README.md README.md View all files Repository files navigation * README * Apache-2.0 license Shows the Instant logo [6874747073] stars Get Started * Examples * Try the Demo * Docs * Discord Instant is a client-side database that makes it easy to build real-time and collaborative apps like Notion or Figma. You write relational queries in the shape of the data you want and Instant handles all the data fetching, permission checking, and offline caching. When you change data, optimistic updates and rollbacks are handled for you as well. Plus, every query is multiplayer by default. We also support ephemeral updates, like cursors, or who's online. Currently we have SDKs for Javascript, React, and React Native. How does it look? Here's a barebones chat app in about 12 lines: // [[ tsu *_* ]]tsu Real-time Chat // ---------------------------------- // * Updates instantly // * Multiplayer // * Works offline import { init, tx, id } from "@instantdb/react"; const db = init({ appId: process.env.NEXT_PUBLIC_APP_ID, }); function Chat() { // 1. Read const { isLoading, error, data } = db.useQuery({ messages: {}, }); // 2. Write const addMessage = (message) => { db.transact(tx.messages[id()].update(message)); }; // 3. Render! return ; } Want to see for yourself? try a demo in your browser. Motivation Writing modern apps are full of schleps. Most of the time you start with the server: stand up databases, caches, ORMs, and endpoints. Then you write client-side code: stores, selectors, mutators. Finally you paint a screen. If you add multiplayer you need to think about stateful servers, and if you support offline mode, you need to think about IndexedDB and transaction queues. To make things worse, whenever you add a new feature, you go through the same song and dance over and over again: add models, write endpoints, stores, selectors, and finally the UI. Could it be better? In 2021, we realized that most of the schleps we face as UI engineers are actually database problems in disguise. (We got into greater detail in this essay) Shows how Instant compresses schleps If you had a database on the client, you wouldn't need to think about stores, selectors, endpoints, or local caches: just write queries. If these queries were multiplayer by default, you wouldn't have to worry about stateful servers. And if your database supported rollback, you'd get optimistic updates for free. So we built Instant. Instant gives you a database you can use in the client, so you can focus on what's important: building a great UX for your users, and doing it quickly. Architectural Overview Here's how Instant works at a high level: Shows how Instant compresses schleps Under the hood, we store all user data as triples in one big Postgres database. A multi-tenant setup lets us offer a free tier that never pauses. A sync server written in Clojure talks to Postgres. We wrote a query engine that understands datalog and InstaQL, a relational language that looks a lot like GraphQL: // give me all users, their posts and comments { users: { posts: { comments: { } } } } Taking inspiration from Asana's WorldStore and Figma's LiveGraph, we tail postgres' WAL to detect novelty and invalidate relevant queries. For the frontend, we wrote a client-side triple store. The SDK handles persisting a cache of recent queries to IndexedDB on web, and AsyncStorage in React Native. All data goes through a permission system powered by Google's CEL library. Getting Started The easiest way to get started with Instant is by signing up on instantdb.com. You can create a functional app in 5 minutes or less. If you have any questions, you can jump in on our discord. Contributing You can start by joining our discord and introducing yourself. Even if you don't contribute code, we always love feedback. If you want to make changes, start by reading the client and server READMEs. There you'll find instructions to start Instant locally. About The realtime client-side database instantdb.com Resources Readme License Apache-2.0 license Activity Custom properties Stars 3.3k stars Watchers 15 watching Forks 53 forks Report repository Releases No releases published Packages 0 No packages published Contributors 9 * * * * * * * * * Languages * Clojure 52.4% * TypeScript 33.7% * JavaScript 12.8% * CSS 0.4% * PLpgSQL 0.2% * Makefile 0.2% * Other 0.3% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.