{"id":18459865,"url":"https://github.com/sayjava/mimic","last_synced_at":"2025-04-23T18:13:23.291Z","repository":{"id":65674051,"uuid":"594165098","full_name":"sayjava/mimic","owner":"sayjava","description":"A data generation and API mocking server","archived":false,"fork":false,"pushed_at":"2023-05-20T16:45:58.000Z","size":1107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T18:13:19.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/sayjava.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":"2023-01-27T18:51:32.000Z","updated_at":"2023-01-27T18:52:23.000Z","dependencies_parsed_at":"2024-11-06T08:28:42.838Z","dependency_job_id":"0d39f831-9e57-40b0-8890-fe266a86cb36","html_url":"https://github.com/sayjava/mimic","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fmimic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fmimic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fmimic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fmimic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sayjava","download_url":"https://codeload.github.com/sayjava/mimic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250487536,"owners_count":21438612,"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-11-06T08:24:43.874Z","updated_at":"2025-04-23T18:13:23.271Z","avatar_url":"https://github.com/sayjava.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003eMimic\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n   Mimic is an API mocking and fake data generation server. It provides a simple approach to virtualizing services\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/images/records_screenshot.png\" alt=\"records\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/images/mocks_screenshot.png\" alt=\"mocks\" /\u003e\n\u003c/p\u003e\n\n## Why Mimic\n\n- Prototype against APIs easily\n- Test boundary values by mocking responses\n- Test alternative scenarios by varying responses for requests\n- Write predictable acceptance tests with predictable API responses\n- Debug HTTP requests made by applications under development\n- Generate large dataset using declarative response templates\n- Validate API calls\n\n## Mimic Features\n\n- Declarative mock definitions\n- Transparently proxy requests to remote servers.\n- Built-in [handlebars](https://handlebarsjs.com/) and [Fakerjs](https://https://fakerjs.dev/) for large dataset generation.\n- Reusable mock templates which helps to reduce mock duplications.\n\n## Requirements\n\n- Docker v20+\n\n## Quick Start\n\n```sh\n    docker run docker.io/sayjava/mimic -p 8080:8080\n```\n\nThe server is now running at `http://localhost:8080`. Any request made to that endpoint will be recorded and can be examined at `http://localhost:8080/_/dashboard`\n\n### Use mock definitions\n\n```sh\n    docker run docker.io/sayjava/mimic -p 8080:8080 -v \"mocks:/app/mocks\"\n```\n\nThis will load all the mock definitions present in the mocks folder.\n\n## Mocking\n\nMocks are declarative yaml/json documents that instructs Mimic how to responds to the requests it receives. Here are some simple examples of mock definitions.\n\n### Regex based request paths and methods\n\nA very simple regexp based mock that will respond to requests with paths like `todo/2` or `todo/some-id` for both `GET` or `POST` request methods.\n\n```yaml example.yaml\n    - name: Sample Mock\n      request: \n        path: /todo/.*\n        method: GET|POST\n      response:\n        status: 200\n        headers:\n            content-type: application/json\n        body:\n          id: sample-id\n          status: done\n```\n\nSee the [Mock Definition](https//mimic.run/docs/mocking) docs here for more details\n\n### Fake Data Generation\n\nFake data generation is built into Mimic. This endpoint `/todos` will consistently generate 10 todo objects\n\n```yaml example.yaml\n    - name: Dynamic Data\n      request: \n        path: /todos\n        method: GET\n      response:\n        status: 200\n        headers:\n            content-template: json/template\n        body: |\n            [\n                {{#repeat 10}}\n                    {\n                        \"title\": \"{{data.random.words}}\",\n                        \"createdAt\": \"{{data.date.recent}}\",\n                    }\n                {{/repeat}}\n            ]\n\n```\n\nSee the [Data Generation](https//mimic.run/docs/data-generation) docs for more examples\n\n## Mimic Use Cases\n\nHere are some use cases that `Mimic` can help with during development and testing.\n\n### Fully Mocked Server Side Rendered Apps\n\nServer side rendered apps can point their API endpoints to `Mimic` as the their remote API and all requests will be matched against mock definitions.\n\n```mermaid\nsequenceDiagram\n    participant c as Client(Browser)\n    participant s as Server App\n    participant m as Mimic(Remote API)\n    c-\u003e\u003es: Load Page\n    s-\u003e\u003em: Remote API Call\n    loop Match Mocks\n        m-\u003e\u003em: Data Generation/Return static mock\n    end\n    m--\u003e\u003es: Mocked/404 Response\n    s-\u003e\u003ec: Rendered Page\n```\n\n### Fully Mocked Client Side Rendered Apps\n\nServer side rendered apps can point their API endpoints to `Mimic` as the their remote API and all requests will be matched against mock definitions.\n\n```mermaid\nsequenceDiagram\n    participant c as Client(Browser)\n    participant m as Mimic(Remote API)\n    c-\u003e\u003em: XHR Request\n    loop Match Mocks\n        m-\u003e\u003em: Data Generation/Return static mock\n    end\n    m--\u003e\u003ec: Mocked/404 Response\n```\n\n### Transparent Proxy Mode\n\nIn this mode, `Mimic` acts as a transparent proxy by forwarding all requests it receives to a defined remote server transparently and depending on the mock definition, it will cache the response and respond with the cache on subsequent matching requests.\n\n```mermaid\nsequenceDiagram\n    participant c as Client\n    participant m as Mimic\n    participant r as Remote Server\n    c-\u003e\u003em: HTTP Request Request\n    loop Match Mocks\n        m-\u003e\u003em: Match a forwarding definition\n    end\n    m-\u003e\u003er: Forward request to remote server \n    r-\u003e\u003em: Remote response\n    alt Cache on response?\n        m-\u003e\u003ec: cache and return response\n    else\n        m-\u003e\u003ec: return response\n    end\n```\n\nsee the [proxy docs](https://mimic.run/docs/proxy) for more information on forwarding requests to remote servers\n\n\n## Examples\n\n- [Shopify Storefront](https://sayjava/mimic-shopify): Using the [Next Commerce](https://github.com/vercel/commerce) and `Mimic` to demonstrate the Shopify backend without the need for a shopify account.\n\n- [BigCommerce Storefront](https://sayjava/mimic-bigcommerce): Using the [Next Commerce](https://github.com/vercel/commerce) and `Mimic` to demonstrate the BigCommerce backend without the need for a BigCommerce account.\n\n## Development\n\n```sh\n    docker compose up\n```\n\nThe Mimic mock server is started on `http://localhost:8080` and the UI dashboard can be reached at `http://localhost:9090/_/dashboard`\n\n## Built With\n\n- Deno v1.30\n- VueJS 3.0\n- Handlebars\n- FakerJS\n\n## Deploy\n\n```shell\ndocker compose up\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayjava%2Fmimic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayjava%2Fmimic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayjava%2Fmimic/lists"}