{"id":49865094,"url":"https://github.com/mockzilla/mockzilla-portable-template","last_synced_at":"2026-05-15T01:28:28.109Z","repository":{"id":347819378,"uuid":"1195353274","full_name":"mockzilla/mockzilla-portable-template","owner":"mockzilla","description":"Portable OpenAPI mock server template for Mockzilla with GitHub Actions and hosted API simulations","archived":false,"fork":false,"pushed_at":"2026-05-14T23:26:23.000Z","size":48,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-14T23:29:42.311Z","etag":null,"topics":["api-simulation","api-testing","contract-testing","developer-tools","github-actions","golang","mock-api","mock-server","open-source","openapi","openapi-spec","portable-template","pull-request-preview"],"latest_commit_sha":null,"homepage":"https://mockzilla.org/","language":null,"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/mockzilla.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-29T15:13:02.000Z","updated_at":"2026-05-14T23:26:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mockzilla/mockzilla-portable-template","commit_stats":null,"previous_names":["mockzilla/connexions-portable-template","mockzilla/mockzilla-portable-template"],"tags_count":2,"template":true,"template_full_name":null,"purl":"pkg:github/mockzilla/mockzilla-portable-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-portable-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-portable-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-portable-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-portable-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mockzilla","download_url":"https://codeload.github.com/mockzilla/mockzilla-portable-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-portable-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33049936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":["api-simulation","api-testing","contract-testing","developer-tools","github-actions","golang","mock-api","mock-server","open-source","openapi","openapi-spec","portable-template","pull-request-preview"],"created_at":"2026-05-15T01:28:27.287Z","updated_at":"2026-05-15T01:28:28.100Z","avatar_url":"https://github.com/mockzilla.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mockzilla Portable Template\n\nA template for declaring mock API services and publishing them to [Mockzilla](https://github.com/mockzilla/mockzilla).\n\nDrop each service into `services/\u003cname\u003e/`, push, and get both a hosted simulation and a downloadable `.mockz` package you can run locally.\n\n## Quick start\n\n1. Click [**Use this template**](https://github.com/mockzilla/mockzilla-portable-template/generate) to create your own repository.\n2. Add your services under `services/\u003cname\u003e/` (see layout below).\n3. Push to main. The included GitHub Actions:\n   - Publish your specs to a hosted simulation at `https://api.mockz.io/gh/\u003corg\u003e/\u003crepo\u003e/`.\n   - Pack a `.mockz` archive and attach it to the latest GitHub release for offline use.\n\n## Layout\n\nEach service lives in its own folder under `services/`. The folder name **is** the service identity: what you name it is what gets mounted at.\n\n```\nservices/\n  petstore/\n    openapi.yml          # OpenAPI spec (any *.{yml,yaml,json} name works)\n    config.yml           # optional: latency, errors, mount, upstream, cache\n    context.yml          # optional: replacement values for mock data\n  hello-world/\n    v1/\n      get/index.json     # → GET /hello-world/v1\n      post/index.json    # → POST /hello-world/v1\napp.yml                  # optional: global settings (port, history, etc.)\n```\n\nA service folder is in **static mode** as soon as it contains any\n`\u003cpath\u003e/index.\u003cext\u003e` file. No `static/` wrapper. The verb defaults to\n`GET`; wrap in a `\u003cmethod\u003e/` dir (`get`, `post`, etc.) as the\nimmediate parent of `index.\u003cext\u003e` to override. The path before that\ncan be empty, one segment, or many.\n\nIf a folder has both a spec file and static endpoints, the two are\nmerged: spec endpoints register first, static files override matching\n`(path, method)` pairs and add any new ones, and the spec file itself\nis served at `GET /\u003cservice\u003e/\u003cfilename\u003e` as a literal asset for docs.\n\nRoutes the example serves:\n\n```\nGET  /petstore/pets             ← from services/petstore/openapi.yml\nPOST /petstore/pets\nGET  /petstore/pets/{petId}\nGET  /hello-world/v1            ← from services/hello-world/v1/get/index.json\nPOST /hello-world/v1\n```\n\n## Per-service config (`services/\u003cname\u003e/config.yml`)\n\n```yaml\nlatency: 100ms              # constant latency\n# OR percentile latencies\nlatencies:\n  p50: 50ms\n  p95: 200ms\nerrors:                     # percentile error injection\n  p5: 500                   # 5% of requests → 500\nmount: pets/v2              # override URL prefix (default: \u003cfolder-name\u003e)\nupstream:                   # forward to a real backend\n  url: https://petstore3.swagger.io/api/v3\n  timeout: 10s\ncache:\n  requests: true            # cache GET responses\n```\n\n## Per-service context (`services/\u003cname\u003e/context.yml`)\n\nFlat replacement values. Keys are used by the mock generator to fill matching fields in responses. **No service-name wrapper.**\n\n```yaml\nname: [\"Fluffy\", \"Spot\", \"Rover\"]\ntag: [\"cat\", \"dog\", \"bird\"]\n```\n\n## Static responses\n\nDrop response files under `services/\u003cname\u003e/\u003cpath\u003e/index.\u003cext\u003e`. The\nverb defaults to `GET`; wrap in a `\u003cmethod\u003e/` dir (`get`, `post`,\n`put`, `patch`, `delete`, `head`, `options`, `trace`) as the\nimmediate parent of `index.\u003cext\u003e` to override.\n\n```\nservices/api/\n  index.json                    → GET /api\n  users/index.json              → GET /api/users      (implicit GET)\n  users/post/index.json         → POST /api/users     (explicit method)\n  users/{id}/index.json         → GET /api/users/{id}\n  users/{id}/delete/index.json  → DELETE /api/users/{id}\n```\n\nExtension determines content-type:\n\n| Extension | Content-Type |\n|---|---|\n| `.json` | `application/json` |\n| `.html` / `.htm` | `text/html` |\n| `.xml` | `application/xml` |\n| `.yaml` / `.yml` | `application/yaml` |\n| `.txt` | `text/plain` |\n\nIf a service folder has only static endpoints (no spec), the OpenAPI\ndocument is synthesized from the file tree at startup.\n\n## Release\n\nEvery push to main/master packs your service tree into a `.mockz`\narchive (a gzipped tarball with a `.mockzilla.json` manifest declaring\nthe contained services) and publishes it to the `latest` release.\n\nRun it locally with the mockzilla CLI:\n\n```bash\nbrew tap mockzilla/tap\nbrew install mockzilla\n\ncurl -L \"https://github.com/\u003corg\u003e/\u003crepo\u003e/releases/latest/download/\u003crepo\u003e.mockz\" -o mocks.mockz\nmockzilla mocks.mockz\n```\n\nTo inspect what's inside before running:\n\n```bash\nmockzilla info mocks.mockz\n```\n\n## Mockzilla workflow\n\nThe included GitHub Actions workflow (`.github/workflows/mockzilla.yml`) publishes your specs to [Mockzilla](https://mockzilla.org) automatically:\n\n- **Push to main/master**: publishes the latest specs to your main simulation\n- **Pull request with `Mockzilla` label**: deploys a preview simulation for the PR (torn down when the PR is closed)\n\nThe `Mockzilla` label is created automatically on first push via the setup workflow.\n\nYour simulation will be available at:\n- `https://api.mockzilla.org/gh/{org}/{repo}/`: main branch\n- `https://api.mockzilla.org/gh/{org}/{repo}/pr-{n}/`: per pull request\n\n### Action inputs\n\nYou can customize the action in `.github/workflows/mockzilla.yml`:\n\n```yaml\n- uses: mockzilla/actions/portable@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    region: us-east-1        # optional. Preferred AWS region, used as a hint on first deploy only.\n    memory-size: 256         # optional. Memory in MB (default: 128).\n    timeout: 60              # optional. Request timeout in seconds.\n    environment: '{\"ENV\":\"production\",\"DEBUG\":\"true\"}'  # optional\n    host: api.mockzilla.net  # optional. API host for the simulation URL.\n    services-dir: services   # optional. Directory with per-service folders (default: 'services').\n    timeout-minutes: 5       # optional. Max minutes to wait for simulation to become active (default: 5).\n    delete: false            # optional. Remove this repository from Mockzilla (default: false).\n```\n\n| Input | Required | Description |\n|---|---|---|\n| `token` | yes | `GITHUB_TOKEN`, used to verify repo identity. |\n| `region` | no | Preferred AWS region (e.g. `us-east-1`, `ap-southeast-1`). Used as a hint on first deploy. If at capacity, the nearest available region is used. Has no effect after the simulation is deployed. |\n| `memory-size` | no | Memory in megabytes (e.g. `128`, `256`, `512`). Defaults to `128`. |\n| `timeout` | no | Request timeout for the simulation in seconds (e.g. `30`, `60`). |\n| `environment` | no | JSON object of environment variables to set in the simulation (e.g. `'{\"ENV\":\"production\"}'`). |\n| `host` | no | API host for the simulation URL (`api.mockzilla.org`, `api.mockzilla.de`, or `api.mockzilla.net`). Defaults to org setting or `api.mockzilla.org`. |\n| `services-dir` | no | Directory containing per-service folders. Defaults to `services`. |\n| `timeout-minutes` | no | Max minutes the action polls for the simulation to become active. Defaults to `5`. |\n| `delete` | no | Remove this repository from Mockzilla. When set to `true`, the action skips publishing and deletes all mock APIs for this repo. Useful on the free plan to free up your slot before connecting a different repository. Defaults to `false`. |\n\n### Removing this repository from Mockzilla\n\nOn the free plan you can only have one repository connected to Mockzilla at a time. To switch to a different repo, run the action with `delete: true` on the old one first:\n\n```yaml\nname: mockzilla-remove\n\non:\n  workflow_dispatch:\n\njobs:\n  remove:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: mockzilla/actions/portable@v1\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          delete: true\n```\n\nTrigger it manually from the **Actions** tab when you're ready.\n\n### Check your simulation URL\n\nAfter pushing, your URL is deterministic:\n\n```bash\necho \"https://api.mockz.io/gh/$(gh repo view --json nameWithOwner -q .nameWithOwner)/$(git branch --show-current)/\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockzilla%2Fmockzilla-portable-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmockzilla%2Fmockzilla-portable-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockzilla%2Fmockzilla-portable-template/lists"}