{"id":44001494,"url":"https://github.com/stkr89/esme","last_synced_at":"2026-02-07T12:33:40.774Z","repository":{"id":54311421,"uuid":"320977916","full_name":"stkr89/esme","owner":"stkr89","description":"Mock services by defining the APIs in json format","archived":false,"fork":false,"pushed_at":"2024-02-03T18:53:39.000Z","size":60,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T09:40:52.454Z","etag":null,"topics":["golang","json","mock","mockservice","server"],"latest_commit_sha":null,"homepage":"","language":"Go","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/stkr89.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":"2020-12-13T03:47:21.000Z","updated_at":"2024-02-03T17:22:56.000Z","dependencies_parsed_at":"2024-06-20T08:45:22.228Z","dependency_job_id":"ea1dd92d-d82b-42cb-aadc-4c0f80f458cb","html_url":"https://github.com/stkr89/esme","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/stkr89/esme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkr89%2Fesme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkr89%2Fesme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkr89%2Fesme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkr89%2Fesme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stkr89","download_url":"https://codeload.github.com/stkr89/esme/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkr89%2Fesme/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29194027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","json","mock","mockservice","server"],"created_at":"2026-02-07T12:33:40.711Z","updated_at":"2026-02-07T12:33:40.765Z","avatar_url":"https://github.com/stkr89.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is Embeddable Service Mocking Engine (ESME)?\n\nESME is a go library that allows you to mock a RESTful service by defining the configuration in `json` format. This\nservice can then simply be consumed by any client to get the expected response.\n\n# Where can it be used?\n\n- while developing frontend\n- while consuming external APIs\n- to set up an API with static content\n\n## Usage\n\nHere is a sample `route-config.json` file that can be processed by ESME\n\n```json\n{\n  \"route_groups\": [\n    {\n      \"auth\": {\n        \"basic\": {\n          \"username\": \"user1\",\n          \"password\": \"pass123\"\n        },\n        \"bearer_token\": {\n          \"token\": \"abc123xyz\"\n        },\n        \"custom\": {\n          \"custom_key\": \"custom_value\"\n        }\n      },\n      \"endpoints\": [\n        {\n          \"url\": \"https://api.example.com/v1/resource\",\n          \"method\": \"GET\",\n          \"status_code\": 200,\n          \"body\": {\n            \"key1\": \"value1\",\n            \"key2\": \"value2\"\n          },\n          \"response\": {\n            \"success\": true,\n            \"data\": {\n              \"item1\": \"details1\",\n              \"item2\": \"details2\"\n            }\n          }\n        },\n        {\n          \"url\": \"https://api.example.com/v1/submit\",\n          \"method\": \"POST\",\n          \"status_code\": 201,\n          \"body\": {\n            \"submit_key\": \"submit_value\"\n          },\n          \"response\": \"Submission successful\"\n        }\n      ]\n    }\n  ]\n}\n```\n\nStart a mock server using above `route-config.json` file\n\n```go\npackage main\n\nimport (\n\t\"github.com/stkr89/esme\"\n)\n\nfunc main() {\n\tesme.Serve(\"8080\", \"route-config.json\")\n}\n```\n\n\u003e You can also provide multiple route configs as arguments to `Serve` method.\n\nLet's break down this file to understand what each component means.\n\n## Route Groups\n\n`route_groups` contains the list of route groups which need to be mocked. ESME supports adding routes to multiple files\nwhich can represent different services running simultaneously.\n\n### Auth\n\n`auth` defines the authentication scheme required for each endpoint within the group. ESME supports following\nauthentication schemes:\n\n#### Basic\n\n```json\n{\n  \"auth\": {\n    \"basic\": {\n      \"username\": \"username\",\n      \"password\": \"password\"\n    }\n  }\n}\n```\n\n`basic` authentication checks for a header field in the form of\n`Authorization: Basic \u003ccredentials\u003e`, where `\u003ccredentials\u003e` is the Base64 encoding of username and password joined by a\nsingle colon `:`.\n\n#### Bearer Token\n\n```json\n{\n  \"auth\": {\n    \"bearer_token\": {\n      \"token\": \"token\"\n    }\n  }\n}\n```\n\n`bearer_token` authentication checks for a header field in the form of\n`Authorization: Bearer \u003ctoken\u003e`.\n\n#### Custom\n\n```json\n{\n  \"auth\": {\n    \"custom\": {\n      \"my_header_1\": \"value1\",\n      \"my_header_2\": \"value2\"\n    }\n  }\n}\n```\n\n`custom` authentication checks for headers `my_header_1` and `my_header_2`\nwith values `value1` and `value2` respectively.\n\n### Endpoints\n\n`endpoints` contains the list of all the endpoints within a group.\n\n### URL\n\n`url` defines the route that need to be mocked.\n\n### Method\n\n`method` defines the http method associated with an url.\n\n### Status Code\n\n`status_code` defines the http status code that needs to be returned from the endpoint.\n\n### Response\n\n#### Array\n\n```json\n{\n  \"response\": [\n    {\n      \"firstName\": \"jane\",\n      \"lastName\": \"doe\",\n      \"id\": 1\n    },\n    {\n      \"firstName\": \"john\",\n      \"lastName\": \"doe\",\n      \"id\": 2\n    }\n  ]\n}\n```\n\n#### Object\n\n```json\n{\n  \"response\": {\n    \"firstName\": \"jane\",\n    \"lastName\": \"doe\",\n    \"id\": 1\n  }\n}\n```\n\n#### String\n\n```json\n{\n  \"response\": \"success\"\n}\n```\n\n`response` defines an array, object or string that the endpoint returns on success.\n\n### Auth\n\n`auth` defines the authentication scheme required for an endpoint. Each `url` can have its own authentication scheme.\nESME supports following authentication schemes:\n\n#### Basic\n\n```json\n{\n  \"auth\": {\n    \"basic\": {\n      \"username\": \"username\",\n      \"password\": \"password\"\n    }\n  }\n}\n```\n\n`basic` authentication checks for a header field in the form of\n`Authorization: Basic \u003ccredentials\u003e`, where `\u003ccredentials\u003e` is the Base64 encoding of username and password joined by a\nsingle colon `:`.\n\n#### Bearer Token\n\n```json\n{\n  \"auth\": {\n    \"bearer_token\": {\n      \"token\": \"token\"\n    }\n  }\n}\n```\n\n`bearer_token` authentication checks for a header field in the form of\n`Authorization: Bearer \u003ctoken\u003e`.\n\n#### Custom\n\n```json\n{\n  \"auth\": {\n    \"custom\": {\n      \"my_header_1\": \"value1\",\n      \"my_header_2\": \"value2\"\n    }\n  }\n}\n```\n\n`custom` authentication checks for headers `my_header_1` and `my_header_2`\nwith values `value1` and `value2` respectively.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstkr89%2Fesme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstkr89%2Fesme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstkr89%2Fesme/lists"}