{"id":23705725,"url":"https://github.com/pouchdb/npm-browser","last_synced_at":"2025-06-26T23:37:20.637Z","repository":{"id":16371840,"uuid":"19122168","full_name":"pouchdb/npm-browser","owner":"pouchdb","description":"npm in your browser.  Because why not. (UNMAINTAINED)","archived":false,"fork":false,"pushed_at":"2017-03-07T07:14:28.000Z","size":3735,"stargazers_count":34,"open_issues_count":4,"forks_count":7,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-07-01T17:11:04.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.npm-browser.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/pouchdb.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}},"created_at":"2014-04-24T19:59:51.000Z","updated_at":"2023-08-25T17:39:14.000Z","dependencies_parsed_at":"2022-09-13T11:01:45.947Z","dependency_job_id":null,"html_url":"https://github.com/pouchdb/npm-browser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouchdb%2Fnpm-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouchdb%2Fnpm-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouchdb%2Fnpm-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouchdb%2Fnpm-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pouchdb","download_url":"https://codeload.github.com/pouchdb/npm-browser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231874121,"owners_count":18439218,"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":[],"created_at":"2024-12-30T14:56:52.084Z","updated_at":"2024-12-30T14:56:53.016Z","avatar_url":"https://github.com/pouchdb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"NPM Browser\n========\n\nNPM Browser is an offline-first HTML5 app that replicates most of NPM into your browser. It's designed as a demo showcase for [PouchDB](http://pouchdb.com).\n\nIs this for real?\n----------\n\nYes, if you wait long enough, it will actually store all of NPM's metadata locally. You can then search it offline.\n\nWe're not suggesting that storing nearly 1GB in your user's browser is a good idea. The point is to demonstrate that browsers are capable enough today to handle that load. In a normal PouchDB application, we expect you'll have much less data.\n\nWhy does Safari ask for 2GB up front?\n--------\n\nIf you want to store more than 5MB data in WebSQL, Safari requires that you ask permission from the user. The other browsers are more lenient.\n\nDetails can be found in [the PouchDB FAQs](http://pouchdb.com/faq.html#data_limits) and [\"common errors\" page](http://pouchdb.com/errors.html#not_enough_space).\n\n\nHow it works\n------\n\nNPM is largely built on top of CouchDB. In fact, the main repository data is stored in two databases: the *skim* DB and the *fullfat* DB:\n\n* [https://skimdb.npmjs.com/registry](https://skimdb.npmjs.com/registry) (skim)\n* [https://registry.npmjs.com/](https://registry.npmjs.com/) (fullfat)\n\nThe skim DB contains only project metadata (e.g. versions, maintainers, READMEs), whereas the fullfat DB also contains tarball binaries.\n\nIn any case, since CouchDB uses the same replication protocol as PouchDB, the NPM Browser replicates the skim DB to your browser.\n\nPouchDB tricks\n-------\n\nSince even the skim DB is a huge database (as of this writing, the `.couch` file is ~600MB), we needed some tricks in order to get the app to perform speedily and efficiently.\n\n### filter-pouch\n\n[filter-pouch](https://github.com/nolanlawson/filter-pouch) is used to filter incoming documents and trim away unneeded data before storing it in the local database. This ensures that we don't quickly reach browser usage limits, and that in browsers where we have to request data upfront (i.e. Safari), we don't have to request very much.\n\n### pouchdb-load\n\n[pouchdb-load](https://github.com/nolanlawson/pouchdb-load) and [pouchdb-dump-cli](https://github.com/nolanlawson/pouchdb-dump-cli) were used so that the initial replication doesn't take an inordinate amount of time.\n\nCouchDB replication is pretty chatty, so we work around this by decomposing it into a [replication stream](https://github.com/nolanlawson/pouchdb-replication-stream) which we can then store as [plaintext static files hosted on Amazon S3](http://shrub.appspot.com/nolanlawson/npm-browser/).\n\nOnce initial replication is complete, the app switches over to regular replication. As modules are added, modified, and deleted, the app should update in realtime.\n\n### Skim DB mirror\n\nUnfortunately, since SkimDB still doesn't support CORS (as of this writing), we have a simple IrisCouch mirror set up at [http://skimdb.iriscouch.com/registry](http://skimdb.iriscouch.com/registry). Using the real Skim DB is a TODO.\n\n### WebSQL\n\nThis app prefers WebSQL to IndexedDB because in Chrome it appears to perform better.\n\nAppCache tricks\n------\n\nWe use AppCache so that the app can work offline. Add it as a bookmark to your home screen, and notice how it still continues to work! There are two parts to this:\n\n#### Updating AppCache\n\nAppCache is, to put it mildly, [an unsavory fellow](http://alistapart.com/article/application-cache-is-a-douchebag) at times. To work with it, we just [update a comment in the appcache file](https://github.com/pouchdb/npm-browser/blob/aa5c5fe703f92eecc9dc3bc3c1ad9eed3e712f97/manifest.appcache) whenever we make a change, to ensure that the browser downloads the latest version.\n\n#### Native homescreen icons\n\nIn order to get the right icon added to the homescreen on iOS, Android, and FirefoxOS, icons are specified [in the index.html using the Apple format](https://github.com/pouchdb/npm-browser/blob/aa5c5fe703f92eecc9dc3bc3c1ad9eed3e712f97/index.html#L14-L23), as well as in a [manifest.webapp file, using the FirefoxOS format](https://github.com/pouchdb/npm-browser/blob/aa5c5fe703f92eecc9dc3bc3c1ad9eed3e712f97/manifest.webapp). (Android will just use the Apple icons.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpouchdb%2Fnpm-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpouchdb%2Fnpm-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpouchdb%2Fnpm-browser/lists"}