{"id":20455931,"url":"https://github.com/requestly/requestly-mock-server","last_synced_at":"2025-08-28T12:19:45.970Z","repository":{"id":95917670,"uuid":"575775109","full_name":"requestly/requestly-mock-server","owner":"requestly","description":"Requestly Mock Server","archived":false,"fork":false,"pushed_at":"2025-06-05T04:52:01.000Z","size":264,"stargazers_count":12,"open_issues_count":3,"forks_count":5,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-07-22T14:03:01.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@requestly/mock-server","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/requestly.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-08T09:14:46.000Z","updated_at":"2025-06-05T04:51:56.000Z","dependencies_parsed_at":"2023-09-26T10:41:57.015Z","dependency_job_id":"d4015f3b-00f4-4008-b076-a1886428e63f","html_url":"https://github.com/requestly/requestly-mock-server","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/requestly/requestly-mock-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requestly%2Frequestly-mock-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requestly%2Frequestly-mock-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requestly%2Frequestly-mock-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requestly%2Frequestly-mock-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/requestly","download_url":"https://codeload.github.com/requestly/requestly-mock-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requestly%2Frequestly-mock-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272498233,"owners_count":24944819,"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-08-28T02:00:10.768Z","response_time":74,"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-11-15T11:20:30.774Z","updated_at":"2025-08-28T12:19:45.942Z","avatar_url":"https://github.com/requestly.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# requestly-mock-server\n\nThis Repo contains the core express server [@requestly/mock-server](https://www.npmjs.com/package/@requestly/mock-server) package which powers Requestly's Cloud Mock Server. \n\n## Development\n### Install Dependencies\n``` sh\nnpm i\n```\n\n### Start Server\n``` sh\nnpm start:dev\n```\n\n## Usage with firebase-functions\n\n### Install\n``` sh\nnpm i @requestly/mock-server\n```\n\n### Setup\n``` javascript\nimport * as functions from 'firebase-functions';\nimport { MockServer } from '@requestly/mock-server';\nimport firebaseConfig from '../firebaseConfig';\n\nconst startMockServer = () =\u003e {\n  const expressApp = new MockServer(3000, firebaseConfig, '/api/mockv2').app;\n\n  return functions.runWith({ minInstances: isProdEnv() ? 1 : 0 }).https.onRequest(expressApp);\n};\n\nexport const handleMockRequest = startMockServer();\n```\n\n``` javascript\nclass FirebaseConfig implements IConfig {\n    getMockSelectorMap = (kwargs?: any) =\u003e {\n        /**\n        * Fetch and return mockSelectorMap from firestore\n        * {\n        *      mockId: {\n        *          route: \"\",\n        *          method: \"\",\n        *      }\n        * }\n        */\n    };\n    \n    getMock = (id: string, kwargs?: any) =\u003e {\n        /**\n        * Fetch mock details from firestore\n        */\n    }\n\n    storeLog? = (log: Log) =\u003e {\n        /**\n        * Store log in cloud storages\n        */\n    }\n}\n\nconst firebaseConfig = new FirebaseConfig();\nexport default firebaseConfig;\n```\n\n\n\n## Requestly Cloud Mock Server Architechture\n![image](https://github.com/requestly/requestly-mock-server/assets/16779465/277fbe21-45ad-45d2-ab65-64ea362ce17a)\n\n**STEPS**\n1. Request coming from GET `https://username.requestly.dev/users`\n2. Firebase Function passes the request to @requestly/mock-server\n3. @requestly/mock-server - MockSelector\n   a. Fetches all the available mocks using `IConfig.getMockSelectorMap()` (Firestore in case of Requestly)\n   b. Select mock if any endpoint+method matches the incoming request (GET /users)\n   c. Fetch Mock using `IConfig.getMock(mockId)` and pass it to MockProcessor\n4. @requestly/mock-server - MockProcessor\n   a. Process Mock - Response Rendering\n   b. Return Response\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequestly%2Frequestly-mock-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frequestly%2Frequestly-mock-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequestly%2Frequestly-mock-server/lists"}