What is Filtron?
Filtron parses human-friendly filter strings into a typed AST (Abstract Syntax Tree). It works best when your data has dynamic or user-defined fields that aren’t part of your type system: e-commerce catalogs with varying product attributes, log entries with arbitrary fields, CMS taxonomies, or multi-tenant platforms with custom metadata.
The core parser only handles parsing, giving you full control over what happens next. Use the included adapters to generate SQL or JavaScript filters, or traverse the AST to build your own integrations.
Performance
Overhead added by Filtron when processing a query. Parse converts the query string to an AST; the adapters generate SQL or a JavaScript filter function. Both are one-time costs per query.
| Query | Parse | SQL | Filter |
|---|---|---|---|
level > 3 AND message ~ "timeout" |
2μs | 1μs | 1μs |
status : ["error", "warning", "critical"] |
3μs | 2μs | 2μs |
(user? AND role = "admin") OR sudo |
5μs | 3μs | 3μs |
In context: API request lifecycle
Full HTTP request filtering 500 users with (role = "admin" OR role = "moderator") AND age > 25 through an Elysia API with in-memory SQLite. Filtron adds less than 1% to total request time.
192μs
Request Parse SQL Database Response