Transform raw APIs and terminal cURLs into strict TypeScript, Zod, and AI Agent tool contracts in milliseconds—tested live with an in-browser, zero-backend Chaos Mock Runner.
The Core Problem: When building Autonomous AI Agents or microservices, hand-crafting schema definitions for OpenAI Strict Mode or Anthropic Claude tool calling is error-prone. A single missing additionalProperties: false or improperly typed optional field crashes OpenAI's strict tool validator.
The Pain Point: Developers and hackathon teams frequently copy raw JSON payloads or terminal cURL commands from Postman/Swagger, but turning them into typed contracts and spinning up test mock harnesses takes hours.
What it does
Input Ingestion: Ingests raw JSON or full terminal cURL commands (supporting multi-line backslashes, -X, -H, -d, --data-raw, and URL query parameters).
OpenAI Structured Outputs Function Calling specs (strict: true)
Anthropic Claude tool definitions
Chaos Mock Runner: An in-browser fuzzer that generates 1 valid sample and 3 mutated edge-case payloads (missing required fields, wrong types, boundary extremes), running live Zod .safeParse() in the browser with simulated HTTP status codes (200 OK vs 422 Unprocessable Entity)—with zero backend.
How we built it
Tech Stack: React 19, Vite, TypeScript, Tailwind CSS, Lucide React, and Zod. 100% free and open-source.
Architecture: Pure client-side single-page app with four decoupled engines:
Ingestion Engine: Custom cURL tokenizer and resilient JSON parser with auto-recovery for trailing commas.
AST Inferrer: Recursive traversal building an Abstract Syntax Tree with semantic regex heuristics (detecting UUIDs, ISO dates, emails, URLs, and array union types).
Deterministic Generators: Four pure functions compiling the AST into code targets.
Agentic Engineering: Built following strict Subagent-Driven Development (SDD) with isolated feature branches, two-stage reviews, and 32/32 Vitest unit and integration tests passing.
Challenges we ran into
OpenAI Strict Mode Schema Peculiarities: OpenAI Structured Outputs requires additionalProperties: false on every object level, and every key in properties must be included in required. To represent optional fields, they must be converted to an explicit null-union (anyOf: [schema, { type: "null" }]).
Resilient cURL Parsing: Handling varied shell quoting, multi-line line breaks, query parameters from GET requests without payloads, and malformed JSON payloads without crashing.
Zero-Backend Dynamic Validation: Running runtime schema validation and fuzzing entirely in the browser thread with sub-millisecond responsiveness.
Accomplishments that we're proud of
100% client-side zero-latency architecture: zero backend, zero database, zero external API keys needed.
32/32 unit tests passing across 6 suites with 0 TypeScript errors.
Comprehensive end-to-end automation with Playwright and custom Model Context Protocol (MCP) server tooling.
Clean developer experience with instant copy buttons and 4 pre-loaded real-world presets (Stripe, GitHub, Weather, Agent Tool).
What we learned
The power of an intermediate Abstract Syntax Tree (AST): decoupling input parsing from output generation allows adding new schema targets effortlessly.
Strict function calling requirements and how LLMs actually validate JSON schemas under the hood.
Disciplined agentic pair programming: using spec-driven development, test harnesses, and independent review gates before committing code.
What's next for ContractForge
Bulk & Multi-Endpoint Ingestion: Adding support to import entire OpenAPI/Swagger YAML specs or Postman collections at once, rather than single cURL or JSON payloads.
Interactive Visual Schema Diff: Showing a live side-by-side diff when tweaking inputs so developers immediately see which fields in the generated Zod or OpenAI tool schemas changed.
JSON Schema Draft 2020-12 & OpenAPI 3.1 YAML: Exporting standard enterprise API specification artifacts.
Service Worker Mock Interception: Using browser Service Workers to intercept live fetch() calls and return mock responses directly to local development servers without a backend.
Log in or sign up for Devpost to join the conversation.