https://github.com/aspen-cloud/triplit 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 Resources + 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 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 }} aspen-cloud / triplit Public * Notifications You must be signed in to change notification settings * Fork 36 * Star 1.1k A full-stack, syncing database that runs on both server and client. Pluggable storage (indexeddb, sqlite, durable objects), syncs over websockets, and works with your favorite framework (React, Solid, Vue, Svelte). triplit.dev License AGPL-3.0 license 1.1k stars 36 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 5 * Pull requests 0 * Discussions * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights aspen-cloud/triplit 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 Last commit message date Latest commit History 1,604 Commits .changeset .changeset .github/workflows .github/workflows .yarn .yarn packages packages scripts scripts templates templates .gitignore .gitignore .prettierrc .prettierrc .yarnrc.yml .yarnrc.yml LICENSE LICENSE README.md README.md package.json package.json tsconfig.base.json tsconfig.base.json tsconfig.build.json tsconfig.build.json tsconfig.json tsconfig.json turbo.json turbo.json typedoc.base.json typedoc.base.json yarn.lock yarn.lock View all files Repository files navigation * README * AGPL-3.0 license Triplit banner Overview Triplit is an open-source database that syncs data between server and browser in real-time. Triplit provides a real-time syncing datastore that you can drop into your app as a Typescript package. Triplit handles storing your data on the server and intelligently syncs your queries to your clients. We call this type of system a "full stack database"--you can watch our presentation to the Local First community on this new paradigm here. Triplit brings together: Real-time sync with incremental updates and conflict resolution at the property level Local caching powered by a full-fledged client-side database Durable server-side storage with an admin dashboard Pluggable storage providers like SQLite, IndexedDB, LevelDB, Memory, etc Optimistic updates to make every interaction feel fast Relational querying for complex data models Offline-mode with automatic reconnection and consistency guarantees Rollback and retry management on failed updates [?] Schemas for data safety and Typescript autocompletion Authorization that's enforced on the server for both read and writes Collaboration/Multiplayer powered by CRDTs [?] Low latency with minimal network traffic using delta patches Simple API for querying and mutating data in both vanilla Javascript and React Fully open-source! Monorepo Overview In triplit/packages you can find the various projects that power Triplit: * TriplitDB - Designed to run in any JS environment (browser, node, deno, React Native, etc) and provide expressive, fast, and live updating queries while maintaining consistency with many writers over a network. * Client - Browser library to interact with local and remote TriplitDBs. * CLI - CLI tool with commands to scaffold a project, run the full-stack development environment, migrate a server, and more. * React - React bindings for @triplit/client. * Svelte - Svelte bindings for @triplit/client. * Console - App for viewing and mutating data in Triplit projects and managing their schemas. * Server - Node server for syncing data between Triplit clients. * Server-core - Protocol agnostic library for building servers running Triplit. * Docs - Triplit docs, built with Nextra. * Types - Shared types for various Triplit projects. * UI - Shared UI components for Triplit frontend projects, built with shadcn. Quick Start Start a new project. npm create triplit-app@latest my-app Or add the dependencies to an existing project. npm install --save-dev @triplit/cli npm run triplit init Define a schema in my-app/triplit/schema.ts. import { Schema as S, ClientSchema } from '@triplit/client'; export const schema = { todos: { schema: S.Schema({ id: S.Id(), text: S.String(), completed: S.Boolean({ default: false }), }), }, } satisfies ClientSchema; Start the Triplit development sync server. npm run triplit dev This will output some important environmental variables that your app will need to sync with the server. Add them to your .env file (Vite example below). VITE_TRIPLIT_SERVER_URL=http://localhost:6543 VITE_TRIPLIT_TOKEN=copied-in-from-triplit-dev Define a query in your App (React example below). import { TriplitClient } from '@triplit/client'; import { useQuery } from '@triplit/react'; import { schema } from '../triplit/schema'; const client = new TriplitClient({ schema, serverUrl: import.meta.env.VITE_TRIPLIT_SERVER_URL, token: import.meta.env.VITE_TRIPLIT_TOKEN, }); function App() { const { results: todos } = useQuery(client.query('todos')); return (
{Array.from(todos.values()).map((todo) => (
client.update('todos', todo.id, (todo) => ({ todo.completed = !todo.completed, }) } /> {todo.text}
))}
); } Start your app, open another browser tab, and watch the data sync in real-time. Read the full getting started guide here. For an even more detailed and explanatory tutorial, check out this step-by-step guide to building a real-time todo app with Triplit, Vite, and React. Contact us If you're interested in getting early access to Triplit Cloud (currently in developer preview), sign up here to join the waitlist. The best way to get in touch is to join our Discord! We're here to answer questions, help developers get started with Triplit and preview new features. You can follow us on Twitter/X to see our latest announcements. About A full-stack, syncing database that runs on both server and client. Pluggable storage (indexeddb, sqlite, durable objects), syncs over websockets, and works with your favorite framework (React, Solid, Vue, Svelte). triplit.dev Topics react firebase database pwa multiplayer sqlite nextjs leveldb websockets indexeddb crdt fullstack rxdb bun firestore deno cloudflare-workers supabase durable-objects Resources Readme License AGPL-3.0 license Activity Custom properties Stars 1.1k stars Watchers 5 watching Forks 36 forks Report repository Releases 547 @triplit/svelte@0.1.34 Latest Jun 25, 2024 + 546 releases Packages 0 No packages published Contributors 10 * @wernst * @pbohlman * @matlin * @github-actions[bot] * @MentalGear * @WonderPanda * @armincerf * @honeymaro * @simonbukin * @i-am-henri Languages * TypeScript 88.5% * MDX 8.5% * JavaScript 2.0% * CSS 0.6% * Svelte 0.2% * HTML 0.2% 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.