{"id":50320011,"url":"https://github.com/a-saed/datum","last_synced_at":"2026-05-29T03:01:40.237Z","repository":{"id":360476011,"uuid":"1250186097","full_name":"a-saed/datum","owner":"a-saed","description":"Local-first spatial sync for PostGIS. A bounding box is a live sync subscription.","archived":false,"fork":false,"pushed_at":"2026-05-26T15:33:18.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-26T16:26:51.063Z","etag":null,"topics":["geospatial","golang","local-first","offline-first","pglite","postgis","spatial","sync","typescript","websocket"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a-saed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-26T11:41:24.000Z","updated_at":"2026-05-26T15:36:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/a-saed/datum","commit_stats":null,"previous_names":["a-saed/datum"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/a-saed/datum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-saed%2Fdatum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-saed%2Fdatum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-saed%2Fdatum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-saed%2Fdatum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a-saed","download_url":"https://codeload.github.com/a-saed/datum/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-saed%2Fdatum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33634611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geospatial","golang","local-first","offline-first","pglite","postgis","spatial","sync","typescript","websocket"],"created_at":"2026-05-29T03:01:08.026Z","updated_at":"2026-05-29T03:01:40.224Z","avatar_url":"https://github.com/a-saed.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Datum\n\nLocal-first spatial sync for PostGIS. A bounding box is a first-class live sync subscription.\n\n**[Live Demo](https://a-saed.github.io/datum/demo/) · [Docs](https://a-saed.github.io/datum/) · [npm](https://www.npmjs.com/package/datum-sync)**\n\n\n```ts\nconst db = await DatumClient.connect({\n  serverUrl: 'ws://localhost:3000/ws',\n  bbox: [-122.5, 37.7, -122.4, 37.8],\n})\n\n// Full PostGIS, runs locally in WASM — no network\nconst features = await db.query(`\n  SELECT * FROM features WHERE ST_Area(geom) \u003e 1000\n`)\n```\n\n## Install\n\n```bash\nnpm install datum-sync\n```\n\n```ts\nimport { DatumClient } from 'datum-sync'\nimport { useDatum } from 'datum-sync/react' // optional React hook\n```\n\n## Quick start (5 minutes)\n\n**Prerequisites:** Docker, Node.js 20+\n\n**1. Start PostGIS + datum-server**\n\n```bash\ndocker compose up -d\n```\n\n**2. Install and run the demo**\n\n```bash\nnpm install\nnpm run build -w datum-sync\nnpm run dev -w datum-demo\n```\n\nOpen http://localhost:5173. Click the map to add features. Watch them sync.\n\n**3. Verify sync**\n\nOpen a second browser tab — features added in one tab appear in the other within a few seconds.\n\n## How it works\n\n- **Client (`datum-sync` npm package):** PGlite + PostGIS WASM. Full spatial queries run locally.\n- **datum-server (Go):** Handles WebSocket connections, runs snapshot/write queries directly against PostGIS, and listens for change notifications.\n- **Migration:** Installs a `NOTIFY` trigger into your PostGIS table on startup. That's the only database-side object datum adds.\n\n## Production deployment\n\nConfigure datum-server via a `datum.yaml` file:\n\n```yaml\nport: 3000\nallowed_origin: \"https://myapp.com\"\n\n# Single table:\ntable:\n  name: features\n  col_id: id               # optional — defaults match standard column names\n\n# Or multiple tables, each with its own column mapping:\n# tables:\n#   - name: sites\n#   - name: parcels\n#     col_updated_at: modified_at\n```\n\n```bash\ndocker run -v ./datum.yaml:/app/datum.yaml \\\n  -e DATABASE_URL=\"postgres://user:pass@host/mydb\" \\\n  ghcr.io/a-saed/datum-server -config /app/datum.yaml\n```\n\nOr use env vars without a config file:\n\n```bash\ndocker run \\\n  -e DATABASE_URL=\"postgres://user:pass@host/mydb\" \\\n  -e TABLE=features \\\n  -e ALLOWED_ORIGIN=https://myapp.com \\\n  ghcr.io/a-saed/datum-server\n```\n\n\u003e **Security note:** datum-server has no user authentication — any client that can reach the WebSocket endpoint can read and write data. Set `allowed_origin` to restrict browser access, and firewall the port for anything sensitive. Per-user auth is on the [roadmap](ROADMAP.md).\n\n## Documentation\n\n- [API reference](docs/api.md) — TypeScript client, config file, env vars, wire protocol\n\n## Architecture\n\nClient (PGlite + PostGIS WASM) ↔ WebSocket ↔ datum-server (Go) ↔ pgx ↔ PostGIS\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-saed%2Fdatum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-saed%2Fdatum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-saed%2Fdatum/lists"}