This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MIMICORE (formerly MockingGOD) is a declarative API gateway / API-mocking platform in Go. Requests are routed to a virtual host by the HTTP Host header and handled by an in-memory IR (intermediate representation), with optional user logic compiled to WASM at runtime.
go mod tidy— sync dependencies.go run cmd/gateway/*.go— run the gateway standalone (the entrypoint is split across several files incmd/gateway/, so glob with*.go, not justmain.go). Listens on:8080(API) and:9090(Prometheus metrics)../gateway <config-dir>— built binary; config dir defaults toconfigs/.docker-compose up -d— full stack: gateway + MinIO + Prometheus + Grafana.go test ./... -v— run tests.
- Host-based routing. An API config with
"api": "shop_api"is only reachable viaHost: shop_api.localhostorHost: shop_api.local. A plaincurl localhost:8080/...with noHostheader will not match — always pass-H "Host: <api>.local". configs/is gitignored (the whole directory, plus*_test.go). Config files are mounted/loaded at runtime, not committed. Don't expect them in the repo.- Tests are not on this branch.
*_test.gois gitignored here; test files live on separatetest/*branches. - MinIO startup. With
MINIO_ENDPOINT/MINIO_ACCESS_KEY/MINIO_SECRET_KEYset, the gateway retries MinIO for up to 30s and then crashes if unreachable. With them unset it runs in single-instance mode (no S3 WASM cache) and logs warnings. - Hot-reload. A file watcher on the config dir rebuilds the handler registry and swaps it in with zero downtime — changing a config file at runtime is expected to take effect without a restart.
user_code.inline_source (raw Go) is compiled by TinyGo 0.33.0 to WebAssembly, hash-cached (L1 in-memory → L2 S3/MinIO), and executed in a wazero instance pool. TinyGo must be on PATH for dynamic compilation; the Docker image bundles it. Memory helpers (_guest_alloc) are injected automatically.
@CONFIG_GUIDE.md is the definitive reference for the v2 JSON config schema (routes, validation, transform/http chaining, rate limiting, user_code). Read it before editing or generating configs.
cmd/gateway/— entrypoint, hot-reload orchestration, WASM GC.internal/engine/— router, HTTP handling, validation, response templating, proxy.internal/services/—compiler/(TinyGo + hash cache),storage/(MinIO/S3),wasm/(wazero pool).internal/ir/,internal/adapters/(v1/v2 config parsing),internal/config/,internal/middleware/(rate limit, CORS, metrics).
- Format with
gofmtbefore committing (no other linter is configured). - Branching (GitFlow):
feature/*→development→release/dev→main. CI (.github/workflows/docker-publish.yml) runs onmainandv*.*.*tags and publishesghcr.io/axis0047/mimicore.