{"id":15295976,"url":"https://github.com/bahmutov/todomvc-express","last_synced_at":"2025-07-10T18:36:51.328Z","repository":{"id":55238529,"uuid":"48922515","full_name":"bahmutov/todomvc-express","owner":"bahmutov","description":"TodoMVC with server-side rendering","archived":false,"fork":false,"pushed_at":"2023-11-19T16:33:01.000Z","size":1724,"stargazers_count":12,"open_issues_count":1,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T09:12:35.443Z","etag":null,"topics":["cypress-example"],"latest_commit_sha":null,"homepage":"https://todomvc-express.bahmutov.com/","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/bahmutov.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":"2016-01-02T20:15:51.000Z","updated_at":"2022-02-10T21:24:00.000Z","dependencies_parsed_at":"2024-12-27T20:37:42.141Z","dependency_job_id":null,"html_url":"https://github.com/bahmutov/todomvc-express","commit_stats":{"total_commits":79,"total_committers":1,"mean_commits":79.0,"dds":0.0,"last_synced_commit":"050eb241489cdd3fd2a990a03b03fa8b486ead95"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Ftodomvc-express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Ftodomvc-express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Ftodomvc-express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Ftodomvc-express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/todomvc-express/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248760843,"owners_count":21157439,"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":["cypress-example"],"created_at":"2024-09-30T18:08:48.837Z","updated_at":"2025-04-13T18:34:16.774Z","avatar_url":"https://github.com/bahmutov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# todomvc-express ![cypress version](https://img.shields.io/badge/cypress-13.5.1-brightgreen) [![ci](https://github.com/bahmutov/todomvc-express/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/bahmutov/todomvc-express/actions/workflows/ci.yml)\n\n\u003e TodoMVC with server-side rendering\n\n[![NPM][todomvc-express-icon] ][todomvc-express-url]\n\n[![semantic-release][semantic-image] ][semantic-url]\n\nLive demo at [todomvc-express.herokuapp.com/](https://todomvc-express.herokuapp.com/) -\nmight be asleep, wait 10 seconds. Does not permanently store todos; they disappear when\nthe dyno goes to sleep.\n\nComplete server-side rendering for TodoMVC using [ExpressJS](http://expressjs.com/) server and [virtual-dom](https://github.com/Matt-Esch/virtual-dom).\n\nIn fact, NO client side\nJavaScript is allowed using\n[Content Security Policy](https://glebbahmutov.com/blog/disable-inline-javascript-for-security/)\nsetting in the page \"meta\" tag (view page source). You can disable JavaScript in your browser\nand the page will still work just fine.\n\nAny new todo, or click leads to the form submission and new page rendering.\n\n## Use\n\nYou can clone this repo and start the server locally\n\n    npm start\n\nThe open `localhost:3000` to play with the application. Local data is saved in `todos.json`. The Express server itself is defined in file [src/app.js](src/app.js) that you can reuse from other environments\n\n## Tests\n\nTo run the server and the Cypress test\n\n```shell\nnpm run dev\n```\n\nFind the tests in the [cypress/integration](./cypress/integration) folder. There are UI and API tests.\n\n## Related\n\nI have written a couple of modules that help with TodoMVC applications.\n\n- [virtual-todos](https://github.com/bahmutov/virtual-todos) - generates Virtual Dom from todos\n- [fake-todos](https://github.com/bahmutov/fake-todos) to generate fake todo items\n- [todomvc-model](https://github.com/bahmutov/todomvc-model) is the model that keeps\n  todo items and responds to outside events\n- [instant-vdom-todo](https://github.com/bahmutov/instant-vdom-todo) - instant web app\n  using ServiceWorker\n\n## Emit\n\nThe returned Express app is also an event emitter. Every data update it\nemits the updated todo list.\n\n```js\nconst app = require('todomvc-express')\napp.on('todos', function (todos) {\n  console.log('server has new %d todos', todos.length)\n  // each todo object has {what, done, id} like this\n  /*\n    { what: 'new todo',\n       done: false,\n       id: '43e63255-5582-4f6f-85c2-dc2e85e44ffb' }\n  */\n})\n```\n\n## Caching\n\nI have added a level of in-memory caching, see [src/cache.js](src/cache.js). Instead of calling `db` methods directly, like `db.loadTodos()` the app code goes through the cache methods, that have same API as db. To better show caching, I slowed down the `db.loadTodos` to take 1 second.\n\n### Small print\n\nAuthor: Gleb Bahmutov \u0026copy; 2016\n\n- [@bahmutov](https://twitter.com/bahmutov)\n- [glebbahmutov.com](http://glebbahmutov.com)\n- [blog](http://glebbahmutov.com/blog/)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSpread the word: tweet, star on github, etc.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/todomvc-express/issues) on Github\n\n## MIT License\n\nCopyright (c) 2016 Gleb Bahmutov\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n[todomvc-express-icon]: https://nodei.co/npm/todomvc-express.svg?downloads=true\n[todomvc-express-url]: https://npmjs.org/package/todomvc-express\n[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Ftodomvc-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Ftodomvc-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Ftodomvc-express/lists"}