{"id":26678689,"url":"https://github.com/spioune/feathers-cf-durable","last_synced_at":"2025-03-26T05:16:46.461Z","repository":{"id":57233990,"uuid":"425099544","full_name":"Spioune/feathers-cf-durable","owner":"Spioune","description":"A feathers service using Cloudflare Durable Objects for persistent datastore","archived":false,"fork":false,"pushed_at":"2021-11-07T14:20:41.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-14T23:05:02.312Z","etag":null,"topics":["cloudflare","cloudflare-workers","durable-objects","feathers-service-adapter","feathersjs"],"latest_commit_sha":null,"homepage":"","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/Spioune.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}},"created_at":"2021-11-05T22:26:31.000Z","updated_at":"2022-01-03T09:43:50.000Z","dependencies_parsed_at":"2022-09-04T21:21:04.418Z","dependency_job_id":null,"html_url":"https://github.com/Spioune/feathers-cf-durable","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spioune%2Ffeathers-cf-durable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spioune%2Ffeathers-cf-durable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spioune%2Ffeathers-cf-durable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spioune%2Ffeathers-cf-durable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Spioune","download_url":"https://codeload.github.com/Spioune/feathers-cf-durable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245591500,"owners_count":20640692,"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":["cloudflare","cloudflare-workers","durable-objects","feathers-service-adapter","feathersjs"],"created_at":"2025-03-26T05:16:45.243Z","updated_at":"2025-03-26T05:16:46.249Z","avatar_url":"https://github.com/Spioune.png","language":"JavaScript","readme":"\u003e❗  This adapter is very experimental. Use with caution.\n\n\u003e❗  [Cloudflare Durable Objects](https://developers.cloudflare.com/workers/learning/using-durable-objects) are still in Beta\n\n# feathers-cf-durable\n\n[![Download Status](https://img.shields.io/npm/dm/feathers-cf-durable.svg?style=flat-square)](https://www.npmjs.com/package/feathers-cf-durable)\n\n[feathers-cf-durable](https://github.com/Spioune/feathers-cf-durable/) is a database service adapter for [Cloudflare Durable Objects](https://developers.cloudflare.com/workers/learning/using-durable-objects/), a consistent low-latency storage for Cloudflare Workers. [Durable Objects](https://blog.cloudflare.com/durable-objects-easy-fast-correct-choose-three/) stores data on the edge which makes it useful as a persistent storage without the need of a separate database.\n\n```bash\n$ npm i feathers-cf-durable\n```\n\n\u003e __Important:__ `feathers-cf-durable` implements the [Feathers Common database adapter API](https://docs.feathersjs.com/api/databases/common.html) and [querying syntax](https://docs.feathersjs.com/api/databases/querying.html).\n\n\n## Example\n\nHere is an example of a Feathers application running on Cloudflare Workers with a `messages` service persisted on Durable Objects:\n\n```\n$ npm i @feathersjs/feathers@pre feathers-cf-durable feathers-cf-rest itty-router \n```\n\u003e __Important:__ In this example we will be using the prereleased version of [Feathers Dove](https://dove.docs.feathersjs.com/)\n\n\nIn `wrangler.toml`\n\n```toml\n[durable_objects]\nbindings = [\n  { name = \"SERVICE\", class_name = \"Service\" }\n]\n```\n\n\nIn `index.mjs`:\n\n```js\nimport { Router } from 'itty-router'\nexport { DurableObject as Service } from 'feathers-cf-durable'\n\nimport app from './feathers.mjs'\n\nconst router = Router()\n\nrouter.all('*', app.handle)\n\nrouter.all('*', (request, env) =\u003e {\n  return new Response('Not found', { status: 404 })\n})\n\nexport default {\n  fetch: router.handle,\n}\n```\n\n\nIn `feathers.mjs`:\n\n```js\nimport feathers from '@feathersjs/feathers'\nimport rest from 'feathers-cf-rest'\nimport { Adapter } from 'feathers-cf-durable'\n\nconst app = feathers()\n\napp.configure(rest)\n\napp.use('messages', new Adapter())\n\nexport default app\n\n```\n\nTo test your app in development, I recommend using [Miniflare](https://miniflare.dev/) since [Wrangler CLI](https://developers.cloudflare.com/workers/cli-wrangler/) does not yet support Durable Objects.\n\n```bash\n$ miniflare --watch --debug\n```\n\nYou should now be able to navigate to [http://localhost:8787/messages](http://localhost:8787/messages) to see the messages list.  \nTo create a new message, simply make a HTTP POST request to [http://localhost:8787/messages](http://localhost:8787/messages)\n\n\nYou can publish your app to Cloudflare Workers. If this is the first time publishing your app, don't forget to instantiate the DO with the `--new-class` argument\n\n```bash\n$ wrangler publish --new-class Service\n```\n\n\n## License\n\nCopyright (c) 2021\n\nLicensed under the [MIT license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspioune%2Ffeathers-cf-durable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspioune%2Ffeathers-cf-durable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspioune%2Ffeathers-cf-durable/lists"}