{"id":50108661,"url":"https://github.com/mockzilla/mockzilla-codegen-template","last_synced_at":"2026-05-23T12:01:07.880Z","repository":{"id":347873416,"uuid":"1195514222","full_name":"mockzilla/mockzilla-codegen-template","owner":"mockzilla","description":"Template for generating a Go OpenAPI mock server with custom logic, API Explorer, and Mockzilla GitHub Actions deploys","archived":false,"fork":false,"pushed_at":"2026-05-15T00:25:30.000Z","size":31788,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-15T02:34:52.942Z","etag":null,"topics":["api-simulation","api-testing","codegen","contract-testing","developer-tools","github-actions","golang","mock-server","open-source","openapi","pull-request-preview","template"],"latest_commit_sha":null,"homepage":"https://mockzilla.org/","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/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-29T18:56:27.000Z","updated_at":"2026-05-15T00:25:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mockzilla/mockzilla-codegen-template","commit_stats":null,"previous_names":["mockzilla/connexions-codegen-template","mockzilla/mockzilla-codegen-template"],"tags_count":2,"template":true,"template_full_name":null,"purl":"pkg:github/mockzilla/mockzilla-codegen-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-codegen-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-codegen-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-codegen-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-codegen-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mockzilla","download_url":"https://codeload.github.com/mockzilla/mockzilla-codegen-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockzilla%2Fmockzilla-codegen-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33394672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T04:15:53.637Z","status":"ssl_error","status_checked_at":"2026-05-23T04:15:53.242Z","response_time":53,"last_error":"SSL_read: 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":["api-simulation","api-testing","codegen","contract-testing","developer-tools","github-actions","golang","mock-server","open-source","openapi","pull-request-preview","template"],"created_at":"2026-05-23T12:01:06.801Z","updated_at":"2026-05-23T12:01:07.864Z","avatar_url":"https://github.com/mockzilla.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mockzilla Codegen Template\n\nGenerate a Go mock server from OpenAPI specs with [Mockzilla](https://github.com/mockzilla/mockzilla).\n\nEach service is a Go package with generated handlers, embedded OpenAPI specs, and optional custom logic.\nIncludes an API Explorer UI at `/api-explorer`.\n\n## Quick start\n\n1. Click [**Use this template**](https://github.com/mockzilla/mockzilla-codegen-template/generate) to create your own repository\n2. Add services (see below)\n3. Regenerate and discover:\n   ```bash\n   make generate \u0026\u0026 make discover\n   ```\n4. Push to main - binaries for Linux, macOS, and Windows are built automatically and published to **Releases**\n\n## Adding services\n\n### From an OpenAPI spec\n\n```bash\nmake service name=my-api\n```\n\nThis creates `pkg/my_api/` with a scaffold. Replace `pkg/my_api/setup/openapi.yml` with your spec, then run:\n\n```bash\nmake generate \u0026\u0026 make discover\n```\n\n### From static responses\n\n```bash\nmake service-from-static name=my-api\n```\n\nAdd response files under `pkg/my_api/setup/data/` organized by method and path:\n\n```\npkg/my_api/setup/data/\n  get/\n    users/\n      index.json            -\u003e GET /users\n    users/{id}/\n      index.json            -\u003e GET /users/{id}\n  post/\n    users/\n      index.json            -\u003e POST /users\n```\n\nThen regenerate:\n\n```bash\nmake generate \u0026\u0026 make discover\n```\n\n## Service structure\n\nEach service lives in `pkg/{service_name}/` with:\n\n```\npkg/petstore/\n  setup/\n    openapi.yml             # OpenAPI specification\n    config.yml              # Latency, errors, upstream, caching\n    codegen.yml             # Code generation settings\n    context.yml             # Custom values for mock data\n  generate.go               # go:generate directive\n  gen.go                    # Generated handler (do not edit)\n  service.go                # Custom logic (optional overrides)\n```\n\n## API Explorer UI\n\nThe built-in UI is available at `/` (configurable in `resources/data/app.yml`).\nIt lets you browse services, view specs, test endpoints, and inspect request/response history.\n\n## Local development\n\n```bash\nmake build\n.build/server/server\n```\n\nSee the [Mockzilla docs](https://github.com/mockzilla/mockzilla) for more options.\n\n## Release\n\nEvery push to main/master generates code, builds binaries for Linux, macOS, and Windows (amd64 and arm64), \nand publishes them to the **Releases** page. \nDownload the binary for your platform from the `latest` release and run it locally:\n\n```bash\n./your-repo-name\n```\n\n## Mockzilla workflow\n\nThe included GitHub Actions workflow (`.github/workflows/mockzilla.yml`) publishes your server to [Mockzilla](https://mockzilla.org) automatically:\n\n- **Push to main/master** — builds and publishes the server 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/codegen@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    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| `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/codegen@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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockzilla%2Fmockzilla-codegen-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmockzilla%2Fmockzilla-codegen-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockzilla%2Fmockzilla-codegen-template/lists"}