{"id":13679697,"url":"https://github.com/davesag/mock-algolia","last_synced_at":"2025-06-19T12:34:36.118Z","repository":{"id":36990646,"uuid":"183144526","full_name":"davesag/mock-algolia","owner":"davesag","description":"A mock server for the Algolia search engine allowing integration testing without the need to hit Algolia's actual servers","archived":false,"fork":false,"pushed_at":"2024-12-11T06:45:48.000Z","size":3705,"stargazers_count":27,"open_issues_count":6,"forks_count":6,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-04-04T04:23:46.101Z","etag":null,"topics":["algolia","algolia-api","mock-server","testing-tool"],"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/davesag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["davesag"]}},"created_at":"2019-04-24T03:56:21.000Z","updated_at":"2024-09-19T13:12:10.000Z","dependencies_parsed_at":"2024-08-02T13:18:31.228Z","dependency_job_id":"4abddda3-2393-4160-a73d-4d8ccf462971","html_url":"https://github.com/davesag/mock-algolia","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/davesag/mock-algolia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fmock-algolia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fmock-algolia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fmock-algolia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fmock-algolia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davesag","download_url":"https://codeload.github.com/davesag/mock-algolia/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fmock-algolia/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260751544,"owners_count":23057169,"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":["algolia","algolia-api","mock-server","testing-tool"],"created_at":"2024-08-02T13:01:08.487Z","updated_at":"2025-06-19T12:34:31.098Z","avatar_url":"https://github.com/davesag.png","language":"JavaScript","funding_links":["https://github.com/sponsors/davesag"],"categories":["JavaScript"],"sub_categories":[],"readme":"# mock-algolia\n\nA mock server that mimics the [Algolia](https://www.algolia.com) Search and Indexing APIs.\n\n## Docker\n\n- [`davesag/mock-algolia`](https://hub.docker.com/r/davesag/mock-algolia/)\n\n## Links\n\n- [Algolia](https://www.algolia.com)\n- [Algolia API Client](https://www.algolia.com/doc/)\n\n### Current Status\n\nThis is very much version `0.0.x` and a hack, not a fully fledged system.\n\n- Very minimal support for adding, updating, and removing data from indices.\n- No search queries supported yet (coming when I need them/get around to them)\n- I've not written unit or integration tests for the main routes.\n\n### To Use\n\nI am going to assume you are using the Algolia Javascript API Client here, but if not then similar patterns will apply.\n\n#### Prep the client\n\nNormally you'd do this\n\n```js\nconst client = algoliasearch(applicationId, apiKey)\nconst index = client.initIndex('some-index-name')\n\nawait index.addObjects(arrayOfObjects)\n```\n\nTo fool the `algoliasearch` client into talking to this mock server, do this instead:\n\n```js\nconst client = algoliasearch(applicationId, apiKey, { protocol: 'http:' })\nclient.hosts = {\n  read: ['http://localhost:3000'],\n  write: ['http://localhost:3000']\n}\n\nconst index = client.initIndex('some-index-name')\n\nawait index.addObjects(arrayOfObjects)\n```\n\nThen all the client requests will go to the mock server (assuming it's running on port `3000`)\n\n## Checking what was sent\n\nYou can get a quick overview of what has been sent to the mock server via [get `/requests'](http://localhost:3000/requests).\n\n## Resetting the mock server\n\nYou can reset the request log by sending [`delete /requests`]\n\n## Configuration\n\nSet the following environment variables\n\n| Variable | Default | Notes                          |\n| -------- | ------- | ------------------------------ |\n| `PORT`   | `3000`  | The port the server listens on |\n\n## Development\n\n### Branches\n\n\u003c!-- prettier-ignore --\u003e\n| Branch    | Tests | Code Coverage | Audit | Comments |\n| --------- | ----- | ------------- | ----- | -------- |\n| `develop` | [![CircleCI](https://circleci.com/gh/davesag/mock-algolia/tree/develop.svg?style=svg)](https://circleci.com/gh/davesag/mock-algolia/tree/develop) | [![codecov](https://codecov.io/gh/davesag/mock-algolia/branch/develop/graph/badge.svg)](https://codecov.io/gh/davesag/mock-algolia) | [![Vulnerabilities](https://snyk.io/test/github/davesag/mock-algolia/develop/badge.svg)](https://snyk.io/test/github/davesag/mock-algolia/develop) | Work in progress |\n| `main`  | [![CircleCI](https://circleci.com/gh/davesag/mock-algolia/tree/main.svg?style=svg)](https://circleci.com/gh/davesag/mock-algolia/tree/main) | [![codecov](https://codecov.io/gh/davesag/mock-algolia/branch/main/graph/badge.svg)](https://codecov.io/gh/davesag/mock-algolia) | [![Vulnerabilities](https://snyk.io/test/github/davesag/mock-algolia/main/badge.svg)](https://snyk.io/test/github/davesag/mock-algolia/main) | Latest Production Release |\n\n### Prerequisites\n\n- [NodeJS](htps://nodejs.org). I use [`nvm`](https://github.com/creationix/nvm) to manage Node versions — `brew install nvm`.\n- [Docker](https://www.docker.com) if you want to use the Swagger Editor. (Use [Docker for Mac](https://docs.docker.com/docker-for-mac/), not the `homebrew` version)\n\n### To build and run locally\n\nClone this (or better yet, fork it then clone your fork)\n\n```sh\nnpm install\nnpm start\n```\n\nGo to [localhost:3000/docs](http://127.0.0.1:3000/docs) to see the docs.\n\n### `.env` file\n\nYou can put environment variables in a `.env` file.\n\n### Testing\n\n- `npm test` to run the unit tests\n- `npm run test:server` will run the integration tests\n- `npm run lint` will lint it\n- `npm run prettier` will prettify it\n- `npm run test:unit:cov` will run the unit tests with code coverage\n\n## Contributing\n\nPlease see the [contributing notes](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavesag%2Fmock-algolia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavesag%2Fmock-algolia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavesag%2Fmock-algolia/lists"}