# electric-sql/pglite

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/electric-sql-pglite).**

14,707 stars · 354 forks · TypeScript · apache-2.0

## Links

- GitHub: https://github.com/electric-sql/pglite
- Homepage: https://pglite.dev
- awesome-repositories: https://awesome-repositories.com/repository/electric-sql-pglite.md

## Topics

`database` `postgres` `wasm`

## Description

Pglite is a client-side relational database engine that runs a full-featured PostgreSQL instance directly within browser and Node.js environments. By leveraging WebAssembly, it provides a persistent SQL storage solution that enables complex data management and querying without requiring an external database server.

The project distinguishes itself through a reactive SQL data layer that automatically synchronizes user interface components with live query results. It manages database operations using worker threads to prevent main-thread blocking and coordinates access across multiple browser tabs to ensure consistent data views. For performance, it supports binary-snapshot-based initialization, allowing applications to load pre-built database states instantly.

The platform includes a comprehensive suite of tools for local-first development, such as virtual file system persistence, transaction management, and support for custom engine extensions. It also provides developer-focused utilities including an interactive SQL terminal, schema inspection, and automated database lifecycle management for testing and development workflows.

The project integrates with modern build tools to resolve binary dependencies and provides type-safe query builders and ORM support to bridge application logic with the database.

## Tags

### Data & Databases

- [Browser Databases](https://awesome-repositories.com/f/data-databases/browser-databases.md) — Runs a full-featured Postgres engine directly in the browser to enable local data persistence and complex querying.
- [Client-Side Databases](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/client-side-databases.md) — Provides a persistent SQL storage solution that enables complex data management without an external database server.
- [SQL Query Execution](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/database-operations/sql-query-execution.md) — Runs standard SQL commands and parameterized queries directly within browser or server environments. ([source](https://pglite.dev/docs/))
- [In-Browser Database Engines](https://awesome-repositories.com/f/data-databases/in-browser-database-engines.md) — Runs a full-featured relational database engine compiled to WebAssembly directly within browser and Node.js environments.
- [WebAssembly Engines](https://awesome-repositories.com/f/data-databases/relational-database-engines/webassembly-engines.md) — Runs a full-featured relational database engine compiled to WebAssembly for client-side SQL execution.
- [Database Execution Engines](https://awesome-repositories.com/f/data-databases/database-execution-engines.md) — Provides a full-featured relational database runtime environment for browser and Node.js applications. ([source](https://pglite.dev/docs/multi-tab-worker))
- [Reactive Data Queries](https://awesome-repositories.com/f/data-databases/reactive-data-queries.md) — Triggers automatic interface updates whenever the underlying database state changes by subscribing to live query results. ([source](https://pglite.dev/docs/))
- [Multi-Tab Database Coordinators](https://awesome-repositories.com/f/data-databases/multi-tab-database-coordinators.md) — Manages leader election across multiple browser tabs to ensure consistent database access and state. ([source](https://pglite.dev/docs/multi-tab-worker))
- [Object-Relational Mapping](https://awesome-repositories.com/f/data-databases/object-relational-mapping.md) — Provides ORM integration to map application objects to relational database records and manage complex data models. ([source](https://pglite.dev/docs/orm-support))
- [Browser Storage Managers](https://awesome-repositories.com/f/data-databases/browser-storage-managers.md) — Manages database persistence using browser storage and virtual file systems to ensure data availability. ([source](https://pglite.dev/docs/))
- [Atomic Transactions](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/connection-transaction-management/atomic-transactions.md) — Groups multiple operations into atomic units that commit upon success or automatically roll back on failure. ([source](https://pglite.dev/docs/api))
- [Type-Safe Query Builders](https://awesome-repositories.com/f/data-databases/type-safe-query-builders.md) — Offers type-safe query builders that translate application logic into SQL, ensuring compile-time validation. ([source](https://pglite.dev/docs/orm-support))
- [Shared Worker Storage](https://awesome-repositories.com/f/data-databases/browser-storage-managers/shared-worker-storage.md) — Coordinates shared database access across multiple browser tabs using background workers. ([source](https://pglite.dev/docs/))
- [Database Change Subscriptions](https://awesome-repositories.com/f/data-databases/database-change-subscriptions.md) — Subscribes to asynchronous database events to trigger application updates when data changes occur. ([source](https://pglite.dev/docs/api))
- [Virtualized Filesystem Layers](https://awesome-repositories.com/f/data-databases/storage-abstraction/local-filesystem-storage/virtualized-filesystem-layers.md) — Interacts with internal storage layers to import or export data using standard file operations and streaming protocols. ([source](https://pglite.dev/docs/api))
- [Virtual File Systems](https://awesome-repositories.com/f/data-databases/virtual-file-systems.md) — Maps database storage to virtual file systems to ensure persistence across browser sessions.
- [Incremental Syncing](https://awesome-repositories.com/f/data-databases/data-modification-apis/incremental-syncing.md) — Tracks changes to query results using keyed diff algorithms to efficiently update component state as data evolves. ([source](https://pglite.dev/docs/framework-hooks/react))
- [Database Export Utilities](https://awesome-repositories.com/f/data-databases/database-export-utilities.md) — Generates SQL scripts and compressed archives for database backups, restoration, and migration. ([source](https://pglite.dev/docs/pglite-tools))
- [Database Extensions](https://awesome-repositories.com/f/data-databases/database-extensions.md) — Supports custom engine extensions and plugins to add specialized features to the database system. ([source](https://pglite.dev/docs/))
- [Database Migrations](https://awesome-repositories.com/f/data-databases/database-migrations.md) — Facilitates database migrations by exporting and importing data between instances for version transitions. ([source](https://pglite.dev/docs/upgrade))

### User Interface & Experience

- [Reactive Data Bindings](https://awesome-repositories.com/f/user-interface-experience/reactive-data-bindings.md) — Automatically updates user interface components in real time whenever underlying database query results change.
- [Database Context Providers](https://awesome-repositories.com/f/user-interface-experience/component-child-utilities/instance-references/instance-references/database-context-providers.md) — Injects database instances into the component tree for accessible data management across the application lifecycle. ([source](https://pglite.dev/docs/framework-hooks/react))

### Programming Languages & Runtimes

- [WebAssembly](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/webassembly.md) — Provides a high-performance execution environment for relational data using binary compilation for native-speed SQL operations.

### Software Engineering & Architecture

- [Local-First Architectures](https://awesome-repositories.com/f/software-engineering-architecture/local-first-architectures.md) — Enables building applications that store and process data locally while maintaining full relational database capabilities.
- [Cross-Thread Database Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/background-thread-dispatchers/cross-thread-database-dispatchers.md) — Offloads database operations to background worker threads to maintain main-thread responsiveness.

### Web Development

- [Leader Election](https://awesome-repositories.com/f/web-development/browser-integration-utilities/browser-session-management/tab-management/leader-election.md) — Coordinates database access and leader election across multiple browser tabs using messaging protocols.
- [Binary Snapshots](https://awesome-repositories.com/f/web-development/performance-optimizations/initial-page-load-optimizations/binary-snapshots.md) — Loads pre-built database snapshots directly into memory to bypass standard initialization and reduce startup time.

### Development Tools & Productivity

- [Database Initialization](https://awesome-repositories.com/f/development-tools-productivity/database-initialization.md) — Initializes persistent or in-memory database instances, supporting snapshot loading for faster startup. ([source](https://pglite.dev/docs/prepopulatedfs))
