# Ferret

> Open-source declarative language and embeddable Go runtime for querying and transforming structured data from web pages, APIs, databases, and files.

Ferret is an open-source, declarative-first, expression-oriented language (FQL) with an embeddable runtime for data automation, maintained by the Ferret Team under the MontFerret organization. It turns pages, documents, APIs, database values, and host-provided values into structured results. Ferret v2 is currently in alpha, while v1 is the previous stable line.

## What It Is

Ferret is a small, focused language plus a runtime rather than a library inside a general-purpose language. Developers describe the data they need, the conditions to wait for, and the shape to return, then run the same FQL program against static documents, rendered pages (for example via Chrome DevTools Protocol), APIs, databases, or files. Output is structured objects and arrays suitable for scripts, tests, services, or jobs.

## How the Runtime Works

The Go runtime follows a flow of engine, compile query, create session, run, then collect or consume results. Compiled plans can be reused across isolated sessions. Applications decide which functions, modules, data, and external operations a program can access through capability-based host values. The core stays small, and optional modules add browsers, documents, databases, and protocols. A module registry lists custom modules.

## Tooling and Embedding

FQL can be run in a browser playground, a CLI, the Visual Studio Code extension (diagnostics, formatting, run and debug), a Go or JavaScript embedding (WebAssembly package @montferret/ferret), a Wire interface, a self-hosted HTTP Worker, and Lab, a test runner for UI and data checks. A Dockerized Chromium image supports browser-backed programs.

## Current Status

Ferret v2 is in alpha; the project says APIs and language features may still change, so versions should be pinned carefully. A `ferret migrate` command helps move existing Go v1 integrations to the v2 compatibility API first.

## Features
- Declarative FQL language for querying and transforming structured data
- Embeddable Go runtime with reusable compiled plans and isolated sessions
- Capability-based host values
- Unified query model for browsers, APIs, databases, documents, and files
- Extensible modules, functions, and hooks
- Event-driven synchronization with waitfor and timeouts
- Bytecode VM and portable programs
- Browser playground, CLI, VS Code extension, Worker, Wire, and Lab test runner
- Module registry
- v1 to v2 migration command

## Integrations
Go, JavaScript, Node.js, Visual Studio Code, Chrome DevTools Protocol, Chromium Docker image, WebAssembly

## Platforms
CLI, DEVELOPER_SDK, VSC_EXTENSION, WEB, API

## Pricing
Open Source

## Version
v1.0.0

## Links
- Website: https://www.ferretlang.org
- Documentation: https://ferretlang.org/docs
- Repository: https://github.com/MontFerret/ferret
- EveryDev.ai: https://www.everydev.ai/tools/ferret
