{"id":50680315,"url":"https://github.com/hyparam/s3collab","last_synced_at":"2026-06-08T18:03:57.216Z","repository":{"id":351677251,"uuid":"1212008042","full_name":"hyparam/s3collab","owner":"hyparam","description":"Serverless collaborative markdown editor built on S3","archived":false,"fork":false,"pushed_at":"2026-04-16T02:29:51.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-16T03:26:51.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hyparam.github.io/s3collab/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyparam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-04-16T01:14:26.000Z","updated_at":"2026-04-16T02:29:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hyparam/s3collab","commit_stats":null,"previous_names":["hyparam/s3collab"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/hyparam/s3collab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyparam%2Fs3collab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyparam%2Fs3collab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyparam%2Fs3collab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyparam%2Fs3collab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyparam","download_url":"https://codeload.github.com/hyparam/s3collab/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyparam%2Fs3collab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34073816,"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-06-08T02:00:07.615Z","response_time":111,"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":[],"created_at":"2026-06-08T18:03:56.227Z","updated_at":"2026-06-08T18:03:57.210Z","avatar_url":"https://github.com/hyparam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# s3collab\n\nA serverless collaborative markdown editor where **the only backend is an S3 bucket**.\n\n- Open the app and it generates a random `word-word-word` room key, redirecting to `?key=moonlit-dazzling-lark`.\n- Share that URL. Everyone on it edits the same markdown document, with live preview on the right.\n- Sync is a single JSON op-log on S3. Writes use the new S3 conditional-write headers (`If-Match` / `If-None-Match`) to serialize concurrent edits. On a `412`, the client rebases its local edit against the winning version and retries.\n- Browser credentials come from a Cognito Identity Pool with unauthenticated access — no application server, no lambdas.\n\n## Development\n\n```bash\nnpm install\nnpm run dev       # http://localhost:5173\nnpm test\nnpm run lint\nnpm run typecheck # JSDoc-driven type checking via tsc --noEmit\n```\n\nEdit `public/config.json` to point at your bucket and identity pool (see below). Changing it does not require a rebuild; Vite serves `public/` as-is.\n\n## AWS setup\n\n### 1. S3 bucket\n\nCreate a bucket (any region). Set CORS to allow browser PUTs from your origin and to expose `ETag`:\n\n```json\n[\n  {\n    \"AllowedOrigins\": [\"https://\u003cyour-username\u003e.github.io\", \"http://localhost:5173\"],\n    \"AllowedMethods\": [\"GET\", \"PUT\"],\n    \"AllowedHeaders\": [\"*\"],\n    \"ExposeHeaders\": [\"ETag\"],\n    \"MaxAgeSeconds\": 3000\n  }\n]\n```\n\n### 2. Cognito Identity Pool\n\nCreate an Identity Pool with **unauthenticated identities enabled**. Note the Identity Pool ID (looks like `us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`).\n\n### 3. IAM role for unauth identities\n\nAttach this policy to the unauth role Cognito created. Replace `\u003cbucket\u003e` and `\u003cprefix\u003e`:\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:GetObject\"],\n      \"Resource\": \"arn:aws:s3:::\u003cbucket\u003e/\u003cprefix\u003e*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:PutObject\"],\n      \"Resource\": \"arn:aws:s3:::\u003cbucket\u003e/\u003cprefix\u003e*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:ListBucket\"],\n      \"Resource\": \"arn:aws:s3:::\u003cbucket\u003e\"\n    }\n  ]\n}\n```\n\n### 4. Configure the app\n\nEdit `public/config.json`:\n\n```json\n{\n  \"region\": \"us-east-1\",\n  \"identityPoolId\": \"us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n  \"bucket\": \"my-collab-bucket\",\n  \"prefix\": \"rooms/\"\n}\n```\n\n## Deploying to GitHub Pages\n\nPush to `main`. The workflow at `.github/workflows/pages.yml` runs lint + tests, builds with Vite, and publishes `dist/` to GitHub Pages. Enable Pages in the repo settings (source: *GitHub Actions*).\n\n`vite.config.js` sets `base: './'`, so the build works under any repo subpath without extra config.\n\n## How sync works\n\nEach room is stored at `s3://\u003cbucket\u003e/\u003cprefix\u003e\u003croom-key\u003e.json`:\n\n```json\n{\n  \"version\": 1,\n  \"ops\": [\n    { \"id\": \"…\", \"lamport\": 1, \"clientId\": \"…\", \"ts\": 1700000000000,\n      \"type\": \"replace\", \"from\": 0, \"to\": 0, \"text\": \"hello\" }\n  ]\n}\n```\n\n- State is folded by sorting ops by `(lamport, clientId)` and applying each replace-range in order.\n- Local edits are diffed as a single `replace` op against current state.\n- PUTs use `If-Match: \u003cetag\u003e` (or `If-None-Match: *` for the first write). A `412` triggers a refetch + rebase + retry up to 5 times.\n- The tab polls every 2s while visible to pick up remote edits. Remote updates reapply to the textarea while preserving caret position.\n\nThis is a log-serialized design rather than a true CRDT: the conditional write *is* the serialization point, and concurrent edits to the same text range resolve as last-writer-wins after rebase. That's fine for small groups; for heavy real-time concurrency you'd want something like Yjs.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyparam%2Fs3collab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyparam%2Fs3collab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyparam%2Fs3collab/lists"}