Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/electric-sql/electric
Sync little subsets of your Postgres data into local apps and services.
https://github.com/electric-sql/electric
crdt crdts elixir local-first offline postgres replication sql sqlite sync
Last synced: 5 days ago
JSON representation
Sync little subsets of your Postgres data into local apps and services.
- Host: GitHub
- URL: https://github.com/electric-sql/electric
- Owner: electric-sql
- License: apache-2.0
- Created: 2022-06-01T14:18:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T09:21:04.000Z (2 months ago)
- Last Synced: 2024-10-29T09:28:15.755Z (2 months ago)
- Topics: crdt, crdts, elixir, local-first, offline, postgres, replication, sql, sqlite, sync
- Language: Elixir
- Homepage: https://electric-sql.com
- Size: 106 MB
- Stars: 6,365
- Watchers: 41
- Forks: 152
- Open Issues: 97
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- my-awesome - electric-sql/electric - first,offline,postgres,replication,sql,sqlite,sync pushed_at:2025-01 star:7.1k fork:0.2k Sync little subsets of your Postgres data into local apps and services. (Elixir)
- awesome-repositories - electric-sql/electric - Sync little subsets of your Postgres data into local apps and services. (Elixir)
- awesome - electric-sql/electric - Sync little subsets of your Postgres data into local apps and services. (Elixir)
README
# Electric
Your Postgres data, in sync, wherever you need it.
**Table of Contents:**
- [Quick links](#quick-links)
- [What is Electric?](#what-is-electric)
- [Getting Started](#getting-started)
- [HTTP API Docs](#http-api-docs)
- [Developing Electric](#developing-electric)
- [Mac setup](#mac-setup)
- [Contributing](#contributing)
- [Support](#support)## Quick links
- [Quickstart](https://electric-sql.com/docs/quickstart)
- [About](https://electric-sql.com/about)
- [Docs](https://electric-sql.com/docs)
- [Examples](./examples)## What is Electric?
Electric provides an [HTTP API](https://electric-sql.com/docs/api/http) for syncing [Shapes](https://electric-sql.com/docs/guides/shapes) of data from Postgres. This can be used directly or via [client libraries](https://electric-sql.com/docs/api/clients/typescript) and [integrations](https://electric-sql.com/docs/api/integrations/react).
### This looks a bit different than the last time I visited?
We started a clean rebuild of the sync engine in July 2024. One that's informed by the lessons learned building the [previous system](https://github.com/electric-sql/electric-old). See
[James' blog post for background on the change](https://electric-sql.com/blog/2024/07/17/electric-next).## Getting Started
See the [Quickstart guide](https://electric-sql.com/docs/quickstart) to get up and running. In short, you need to:
1. have a Postgres database with logical replication enabled; and then to
2. run Electric in front of it, connected via `DATABASE_URL`For example, using [Docker Compose](https://docs.docker.com/compose/) from the root of this repo:
```sh
docker compose -f .support/docker-compose.yml up
```You can then use the [HTTP API](https://electric-sql.com/docs/api/http) to sync data from your Postgres. For example, to start syncing the whole `foo` table:
```sh
curl -i 'http://localhost:3000/v1/shape?table=foo&offset=-1'
```Or use one of the clients or integrations, such as the [`useShape`](https://electric-sql.com/docs/api/integrations/react) React hook:
```jsx
import { useShape } from "@electric-sql/react"function Component() {
const { data } = useShape({
url: `http://localhost:3000/v1/shape`,
params: {
table: `foo`,
where: `title LIKE 'foo%'`,
},
})return JSON.stringify(data)
}
```Again, see the [Quickstart](https://electric-sql.com/docs/quickstart) and the [Docs](https://electric-sql.com) for more details.
## HTTP API Docs
The HTTP API is defined in an [OpenAPI spec](https://swagger.io/specification/) in [website/electric-api.yaml](./website/electric-api.yaml).
## Developing Electric
We're using [asdf](https://asdf-vm.com/) to install Elixir, Erlang, and Node.js. Versions are defined in [.tool-versions](.tool-versions).
### Mac setup
```sh
brew install asdf
asdf plugin-add nodejs elixir erlang
asdf install
```You'll probably need to fiddle with your bash/zsh/etc rc file to load the right tool into your environment.
## Contributing
See the:
- [Guide to Contributing](https://github.com/electric-sql/electric/blob/main/CONTRIBUTING.md)
- [Contributor License Agreement](https://github.com/electric-sql/electric/blob/main/CLA.md)
- [Community Guidelines](https://github.com/electric-sql/electric/blob/main/CODE_OF_CONDUCT.md)## Support
We have an [open community Discord](https://discord.electric-sql.com). Come and say hello and let us know if you have any questions or need any help getting things running.
It's also super helpful if you leave the project a star here at the [top of the page☝️](#start-of-content)