electric-sql/electric
Fork: 162 Star: 6775 (更新于 2024-12-12 19:09:09)
license: Apache-2.0
Language: Elixir .
Sync little subsets of your Postgres data into local apps and services.
最后发布版本: @core/sync-service@1.0.0-beta.1 ( 2024-12-11 03:53:15)
Electric
Your Postgres data, in sync, wherever you need it.
Table of Contents:
- Quick links
- What is Electric?
- Getting Started
- HTTP API Docs
- Developing Electric
- Contributing
- Support
Quick links
What is Electric?
Electric provides an HTTP API for syncing Shapes of data from Postgres. This can be used directly or via client libraries and integrations.
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. See James' blog post for background on the change.
Getting Started
See the Quickstart guide to get up and running. In short, you need to:
- have a Postgres database with logical replication enabled; and then to
- run Electric in front of it, connected via
DATABASE_URL
For example, using Docker Compose from the root of this repo:
docker compose -f .support/docker-compose.yml up
You can then use the HTTP API to sync data from your Postgres. For example, to start syncing the whole foo
table:
curl -i 'http://localhost:3000/v1/shape?table=foo&offset=-1'
Or use one of the clients or integrations, such as the useShape
React hook:
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 and the Docs for more details.
HTTP API Docs
The HTTP API is defined in an OpenAPI spec in website/electric-api.yaml.
Developing Electric
We're using asdf to install Elixir, Erlang, and Node.js. Versions are defined in .tool-versions.
Mac setup
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:
Support
We have an open community Discord. 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☝️
最近版本更新:(数据更新于 2024-12-12 19:06:56)
2024-12-11 03:53:15 @core/sync-service@1.0.0-beta.1
2024-12-11 03:53:12 @electric-sql/react@1.0.0-beta.1
2024-12-11 03:53:09 @electric-sql/experimental@0.1.2-beta.0
2024-12-10 01:23:52 @core/sync-service@0.9.5
2024-12-10 01:23:49 @electric-sql/react@0.6.2
2024-12-10 01:23:46 @electric-sql/experimental@0.1.1
2024-12-04 18:09:11 @core/elixir-client@0.2.5
2024-12-04 01:20:17 @electric-sql/react@0.6.1
2024-12-04 00:30:39 @core/sync-service@0.9.4
2024-12-04 00:30:36 @core/elixir-client@0.2.4
主题(topics):
crdt, crdts, elixir, local-first, offline, postgres, replication, sql, sqlite, sync
electric-sql/electric同语言 Elixir最近更新仓库
2024-12-21 00:09:00 anoma/anoma
2024-11-23 19:38:53 teslamate-org/teslamate
2024-09-07 03:11:29 firezone/firezone
2024-07-07 05:20:46 elixir-lang/elixir
2024-04-11 02:26:13 zoonk/zoonk
2020-06-26 19:06:09 phoenixframework/phoenix