{"id":14991067,"url":"https://github.com/contentful-labs/gazette","last_synced_at":"2025-04-12T03:25:19.473Z","repository":{"id":66072605,"uuid":"82928489","full_name":"contentful-labs/gazette","owner":"contentful-labs","description":"Contentful Gazette: bidirectional real-time content management and delivery","archived":false,"fork":false,"pushed_at":"2017-03-25T15:41:19.000Z","size":2048,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-03-25T23:02:35.604Z","etag":null,"topics":["browserify","contentful","pubnub","react","webhooks"],"latest_commit_sha":null,"homepage":"https://contentful-labs.github.io/gazette/","language":"JavaScript","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/contentful-labs.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}},"created_at":"2017-02-23T13:11:57.000Z","updated_at":"2021-08-19T00:15:19.000Z","dependencies_parsed_at":"2023-04-04T01:32:55.667Z","dependency_job_id":null,"html_url":"https://github.com/contentful-labs/gazette","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.06666666666666665,"last_synced_commit":"ad5fea302f17223c3a8819744ad8616b4fdc83c6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful-labs%2Fgazette","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful-labs%2Fgazette/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful-labs%2Fgazette/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful-labs%2Fgazette/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contentful-labs","download_url":"https://codeload.github.com/contentful-labs/gazette/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511177,"owners_count":21116359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["browserify","contentful","pubnub","react","webhooks"],"created_at":"2024-09-24T14:21:24.535Z","updated_at":"2025-04-12T03:25:19.453Z","avatar_url":"https://github.com/contentful-labs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contentful Gazette\n\n*bidirectional real-time content management and delivery*\n\n![Demo](./demo.gif)\n\n## Disclaimers\n\nThis application was produced during a hackathon. It's a quick Proof of Concept created in 8h. It's not ready to be used in production.\n\n### Known shortcomings\n\n- there's no [server side rendering](https://facebook.github.io/react/docs/react-dom-server.html). It won't work without JavaScript enabled and load times will most likely suffer\n- entry changes are populated with the real-time sync faster than they end up in the CDA. A page refreshed right after syncing may still show the previous version. To mitigate this problem we could use `localStorage` to cache versions received with the sync channel\n- failed update are not reverted from the state of the app. You can provide a value that won't pass validations and will be rejected by the CMA, but it'll stay as is in the front-end\n\n### Security\n\n**Never ever give your CMA token away to applications you don't trust**. Contentful Gazette will store your CMA token in-memory only until the browser tab is closed. You can verify what we do with your token by studying the code of [src/contentful.js](./src/contentful.js).\n\n## Setting up your own Gazette\n\n### Prepare content\n\n1. create a new space in [Contentful](https://www.contentful.com)\n2. create a content type with ID `article` consisting of 3 fields: `title`, `lead`, `content` (see below)\n3. create a Content Delivery API key (or use the default one)\n4. write some articles :)\n\n### Run it locally and on GitHub Pages\n\n1. update [src/config.json](./src/config.json) with your space ID and the CDA key\n2. install dependencies with `npm install`\n3. start dev server by running `npm run build-dev`\n4. push it to GitHub Pages using `npm run deploy-gh`\n\n### Get live updates\n\n1. create a [PubNub](https://www.pubnub.com/) application with a key set\n2. for your space create a webhook for entry publication events calling PubNub (see below)\n3. update [src/config.json](./src/config.json) with your PubNub subscribe key\n\n### Write changes from Gazette back to Contentful\n\n1. click on the `edit this website` ribbon on the top left corner of gazette and paste your Content Management API token\n2. click in any of the textfields and change a value\n3. open gazette in a different tab or look at the entries in the Contentful web app to see you changes get synchronized\n\n### Appendix: content type\n\n![Content type](./ct.png)\n\n```js\n{\n  \"name\": \"article\",\n  \"description\": \"Contentful Gazette article\",\n  \"displayField\": \"title\",\n  \"fields\": [\n    {\n      \"name\": \"title\",\n      \"id\": \"title\",\n      \"type\": \"Symbol\",\n      \"localized\": false,\n      \"required\": false,\n      \"disabled\": false,\n      \"omitted\": false,\n      \"validations\": []\n    },\n    {\n      \"name\": \"lead\",\n      \"id\": \"lead\",\n      \"type\": \"Symbol\",\n      \"localized\": false,\n      \"required\": false,\n      \"disabled\": false,\n      \"omitted\": false,\n      \"validations\": []\n    },\n    {\n      \"name\": \"content\",\n      \"id\": \"content\",\n      \"type\": \"Text\",\n      \"localized\": false,\n      \"required\": false,\n      \"disabled\": false,\n      \"omitted\": false,\n      \"validations\": []\n    }\n  ],\n  \"sys\": {/* redacted */}\n}\n```\n\n### Appendix: webhook\n\nFirst you have to compose your publish URL. Refer the [PubNub documentation](https://www.pubnub.com/docs/pubnub-rest-api-documentation#publish-subscribe-publish-v1-via-post-post):\n\n```\nhttps://pubsub.pubnub.com/publish/{pub_key}/{sub_key}/0/articles/0?store=1\n```\n\nThen this URL should be used for as a [Contentful webhook](https://www.contentful.com/developers/docs/concepts/webhooks/). Please note it should be triggerd only on entry publication.\n\n![Webhook](./webhook.png)\n\n## Authors\n\nThis project won the 2017 Winter Hackathon at Contentful.\n\nContributors:\n\n- [andrefs](https://github.com/andrefs) (code)\n- [hlabas](https://github.com/hlabas) (product ownership)\n- [jelz](https://github.com/jelz) (code)\n- [joaoramos](https://github.com/joaoramos) (visuals)\n- [TimBeyer](https://github.com/TimBeyer) (code)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful-labs%2Fgazette","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontentful-labs%2Fgazette","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful-labs%2Fgazette/lists"}