{"id":15920946,"url":"https://github.com/nickcolley/registers.js","last_synced_at":"2025-09-24T10:31:23.443Z","repository":{"id":66165903,"uuid":"154051893","full_name":"NickColley/registers.js","owner":"NickColley","description":"Unofficial JavaScript client for the GOV.UK Registers project 📇📋","archived":false,"fork":false,"pushed_at":"2018-12-15T21:35:33.000Z","size":71,"stargazers_count":4,"open_issues_count":5,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-04T22:11:13.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.registers.service.gov.uk","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/NickColley.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":"2018-10-21T21:01:04.000Z","updated_at":"2024-04-23T04:38:15.000Z","dependencies_parsed_at":"2024-02-12T07:15:22.217Z","dependency_job_id":null,"html_url":"https://github.com/NickColley/registers.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NickColley/registers.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickColley%2Fregisters.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickColley%2Fregisters.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickColley%2Fregisters.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickColley%2Fregisters.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NickColley","download_url":"https://codeload.github.com/NickColley/registers.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NickColley%2Fregisters.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276732815,"owners_count":25694967,"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","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"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":"2024-10-06T19:42:22.270Z","updated_at":"2025-09-24T10:31:23.152Z","avatar_url":"https://github.com/NickColley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Registers.js\r\n\r\n[![Build Status](https://travis-ci.org/nickcolley/registers.js.svg?branch=master)](https://travis-ci.org/nickcolley/registers.js)\r\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\r\n\r\nJavaScript client for the [GOV.UK Registers](https://www.registers.service.gov.uk/) project\r\n\r\nWork in progress at the moment, see [todo](#todo) for more.\r\n\r\n## Install\r\n\r\n```js\r\nnpm install --save nickcolley/registers.js\r\n```\r\n\r\n### Glitch\r\n\r\nYou can try this library out on Glitch with the [registers.js boilerplate project](https://glitch.com/~registers-js-boilerplate)\r\n\r\n## Node\r\n\r\n\u003e This project uses async/await in the examples which requires Node v8.x+.\r\nYou can also use regular promises which requires Node 4.x+ by using `new Registers('...').method().then(...)`\r\n\r\nFirst pick the register from the [Government registers collection](https://www.registers.service.gov.uk/registers).\r\n\r\nThe examples below uses the ['country' register](https://www.registers.service.gov.uk/registers/country), which is a register for \"British English names of all countries currently recognised by the UK government\".\r\n\r\n```js\r\nconst Registers = require('registers')\r\nconst country = new Registers('country')\r\n\r\nasync function App () {\r\n  const info = await country.register()\r\n  console.log('GET /register', info)\r\n}\r\n\r\nApp()\r\n```\r\n\r\n### [GET /register](https://docs.registers.service.gov.uk/api_reference/get_register/#get-register)\r\n```js\r\nconst info = await country.register()\r\nconsole.log('GET /register', info)\r\n```\r\n\r\n### [GET /records](https://docs.registers.service.gov.uk/api_reference/get_records/#get-records)\r\n```js\r\nconst records = await country.records()\r\nconsole.log('GET /records', records)\r\n```\r\n\r\n#### Parameters\r\n- pageIndex (Optional): Collection page number. Defaults to 1.\r\n- pageSize (Optional): Collection page size. Defaults to 100. Maximum is 5000.\r\n\r\n```js\r\nconst records = await country.records({\r\n  pageIndex: 1,\r\n  pageSize: 5000\r\n})\r\nconsole.log('GET /records?page-index=1\u0026page-size=5000', records)\r\n```\r\n\r\n### [GET /records/{key}](https://docs.registers.service.gov.uk/api_reference/get_records_key/#get-records-key)\r\n```js\r\nconst countryRecord = await country.records('GB')\r\nconsole.log('GET /records/GB', countryRecord)\r\n```\r\n\r\n### [GET /records/{key}/entries](https://docs.registers.service.gov.uk/api_reference/get_records_key_entries/#get-records-key-entries)\r\n```js\r\nconst countryRecordEntries = await country.records('GB', { entries: true })\r\nconsole.log('GET /records/GB/entries', countryRecordEntries)\r\n```\r\n\r\n### [GET /records/{field-name}/{field-value}](https://docs.registers.service.gov.uk/api_reference/get_records_field_name_field_value/#get-records-field-name-field-value)\r\n```js\r\nconst filteredRecords = await country.records({ fieldName: 'name', fieldValue: 'United Kingdom' })\r\nconsole.log('GET /records/name/United Kingdom', filteredRecords)\r\n```\r\n\r\n### [GET /entries](https://docs.registers.service.gov.uk/api_reference/get_entries/#get-entries)\r\n```js\r\nconst entries = await country.entries()\r\nconsole.log('GET /entries', entries)\r\n```\r\n\r\n### [GET /entries/{entry-number}](https://docs.registers.service.gov.uk/api_reference/get_entries_entry_number/#get-entries-entry-number)\r\n```js\r\nconst secondEntry = await country.entries(6)\r\nconsole.log('GET /entries/2', secondEntry)\r\n```\r\n\r\n### [GET /items/{item-hash}](https://docs.registers.service.gov.uk/api_reference/get_items_item_hash/#get-items-item-hash)\r\n```js\r\nconst item = await country.items('sha-256:6b18693874513ba13da54d61aafa7cad0c8f5573f3431d6f1c04b07ddb27d6bb')\r\nconsole.log('GET /items/sha-256:6b18693874513ba13da54d61aafa7cad0c8f5573f3431d6f1c04b07ddb27d6bb', item)\r\n```\r\n\r\n### [GET /download-register](https://docs.registers.service.gov.uk/api_reference/get_download_register/#get-download-register)\r\n```js\r\nconst downloadedRegisterAsBuffer = await country.downloadRegister()\r\nconsole.log('GET /download-register', downloadedRegisterAsBuffer)\r\n```\r\n\r\n## Full examples\r\n\r\n### Log all countries names\r\nSee [examples/countries.js](./examples/countries.js)\r\n\r\n### All endpoints\r\nSee [examples/all-endpoints.js](./examples/all-endpoints.js)\r\n\r\n### Download and save register to disk\r\nSee [examples/download.js](./examples/downloadRegister/node.js)\r\n\r\n## Browser\r\n\r\nWorking but not published yet, clone this repository and run `npm run build:browser:production`.\r\n\r\nI have put together a really inaccessible example (do not use), but hope to publish some production ready examples when/if this is published to npm:\r\n\r\n[JSBin Browser Example](https://output.jsbin.com/bucijav) ([Source](https://jsbin.com/bucijav/edit?js))\r\n\r\n## Development\r\n\r\n### Todo\r\n\r\n- Test browser code\r\n- Publish to npm, going to ask the Registers team for their advice here.\r\n- Pagination\r\n- Error handling o-o\r\n- Validation\r\n- Caching: Since Registers have a timestamp for when they were last updated, could we have a caching mode? This could also include adapters to allow for writing to memory, and also something more persistent\r\n- Performance? Streaming?\r\n\r\n### Testing\r\n\r\nRun the tests with:\r\n\r\n```bash\r\nnpm test\r\n```\r\n\r\nUnder the hood this is running `jest`, so you can [pass any options it uses:](https://jestjs.io/docs/en/cli.html)\r\n\r\n```bash\r\nnpm test -- --watch\r\n```\r\n\r\n### Thanks\r\n- This project was mainly made to learn but is in places inspired by [Octokit/rest.js](https://github.com/octokit/rest.js)\r\n- GOV.UK Registers team for creating a well documented API\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickcolley%2Fregisters.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickcolley%2Fregisters.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickcolley%2Fregisters.js/lists"}