How ranitmukherjee/keploy works
Project type and purpose
• Keploy is a developer-centric, language-agnostic API test generator and recorder/replayer. It is neither a typical web app nor a microservice. It consists of:
• A CLI front-end (commands: record, test, import, export, ut-gen)
• A core agent that instruments your app via eBPF and proxies network/DB calls
• A service/orchestrator layer that processes recordings into testcases, stores them, and replays them
• A pluggable storage layer for mocks/tests (YAML, file system)
• Integrations with various protocols (HTTP/1.x, HTTP/2, gRPC) and databases (MySQL, Postgres, Mongo, Redis)
File structure
• Top-level commands in /cli implement the user interface and invoke the agent and service APIs.
• /pkg/core contains the agent:
• hooks/ (eBPF attachments)
• proxy/ (intercept and record/replay integrations for HTTP, gRPC, DB protocols)
• record.go, replay.go, tester/ (in-process mode)
• /pkg/service orchestrates recordings and test generation:
• record, replay, import, export, utgen, orchestrator subpackages
• /pkg/platform abstracts environment concerns:
• telemetry, docker support, coverage collectors, storage backends (YAML)
• /pkg/models defines domain objects: Testcase, Mock, Config, Transport protocols, etc.
Key insights from README
• CLI bootstraps agent (no code changes) and starts proxy.
• Agent transparently intercepts ALL CRUD network interactions and eBPF-recorded syscalls.
• Service layer converts recordings into tests/mocks and can replay them offline.
• Ut-gen embeds an LLM to auto-generate unit tests from code.