TypeScript lambdas that turn into SQL (like dotnet ef core / linq). Would you use this?

TL;DR: I want to bring EF Core / LINQ-style querying to TypeScript: you write a normal lambda, a build step turns it into parameterized SQL, and the same query also runs on plain arrays in your tests. It'd be read-only, so you'd pair it with your existing writer, and the lambda becomes serializable data so it works beyond SQL too. Would you use it?

I've been writing .NET and TypeScript for about 10 years, and I'm a huge EF Core fan. I've always missed that style of querying in TS, so I put together the idea below and want to know if people would actually use it.

The idea: you write a normal lambda, and a build-time plugin turns it into two things at once: the function itself, and a small data tree describing it. A provider turns that tree into SQL.

const adults = await db.users
  .where(u => u.age >= minAge && u.name.startsWith(prefix))
  .select(u => ({ id: u.id, name: u.name }))
  .toArray();

// runs as parameterized SQL:
//   SELECT "id", "name" FROM "users"
//   WHERE "age" >= $1 AND "name" LIKE $2

No special query syntax, no config objects, just a predicate you could pass to .filter(). The nice part: the same query runs against plain arrays in your tests (no database) and turns into SQL in production. Captured variables like minAge become bound parameters, so nothing gets pasted into the SQL string.

How it would work, short version:

  • At build time the plugin reads your lambda and keeps both the function and a plain-object tree of it.
  • Each step (where, select, …) just adds to a query plan. Nothing runs yet.
  • When you call toArray() (or first(), count()), the provider turns the tree into SQL, or in tests just runs your original lambda.

The inspiration is C#'s Expression<Func<T, bool>> + IQueryable<T> and EF Core's ideas (include/thenInclude, split queries, no silent client-side eval), rebuilt for TS. C# gets this from the compiler; TS doesn't, so a Vite/Rollup plugin would fill the gap.

Would you use it as your ORM? One honest catch: it'd be read-only (no writes, no migrations). You'd pair it with whatever already handles writes and use this for the reads. Deal-breaker, or fine by you?

It also works beyond SQL, since the lambda becomes plain JSON:

  • Send a filter from the client to the server as data, and run it there.
  • One rule can be both a SQL WHERE and a per-object "can this user see this?" check.
  • Store rules as data (feature flags, alerts) and edit them in a UI.
  • Run predicates in a Web Worker or under a strict CSP (no eval).

So: would you use this for your DB queries? And which non-SQL use, if any, would actually make you try it?

Curious whether people would actually reach for this. Roast the idea.

reddit.com
u/phenxdesign — 5 days ago
▲ 1 r/webdev

Your Playwright CI reports vanish on every build. I spent a few months building a self-hosted dashboard that keeps every run

Like probably everyone here, my Playwright HTML reports live and die as CI artifacts. A test fails on Tuesday, by Thursday the report is gone, and good luck remembering whether that exact failure already happened two weeks ago.

I've been a web dev for about 18 years, and for the past few months I've been building Piwi Dashboard to fix this for my own team.

Piwi Dashboard test run page

It's a self-hosted dashboard and reporter (MIT licensed, runs as a single Docker container) where every run is kept. On top of that history it does:

  • live streaming, runs show up test by test while CI is still executing
  • failure clustering, so 40 red tests caused by one broken selector collapse into a single cluster, displayed in a page showing everything we could gather during failure
  • flaky test detection with a score and an estimate of how many CI minutes each flaky test wastes
  • locator healing: it records element attributes during passing runs, so when a locator breaks later it can suggest replacements that actually existed on the page
  • analytics, to keep an eye on everything at once
  • failure notifications to email, Slack, or webhook
  • optional AI diagnosis. It takes a failure cluster plus the git diff since the last green run and asks a model what broke. You bring your own key (Anthropic, OpenAI, or anything OpenAI-compatible like a local Ollama). Off by default.

Setup is three steps: docker compose upnpm install -D @ piwitests/reporter, add it to your playwright.config.ts. Projects are created automatically on the first run and CI metadata (branch, commit, workflow) is picked up on its own.

There's a demo with sample data that runs entirely in your browser, nothing to install and no signup: https://piwitests.github.io/demo/

Code and docs: https://github.com/PiwiTests/platform

If you're wondering how it compares: the closest cousins are ReportPortal (heavier, multi-service) and Currents (SaaS, paid). This is a single MIT container you run yourself, with no telemetry, your data stays on your machine. Learn more.

Two caveats though:

  • It's pre-1.0 (0.14 right now): there are rough edges and you'll probably hit a bug or two, so pin your version and report an issue or ask a question here or in the discussions
  • And I build it with heavy AI assistance, which I'm not going to pretend otherwise; what keeps that honest is the full Playwright E2E suite that runs on every PR against SQLite and Postgres, with local and S3 storage. If it ships broken, the suite yells at me first.

I hesitated for weeks before posting, trying to polish everything I could. I'd genuinely like to know what your workflow needs that this doesn't do yet.

reddit.com
u/phenxdesign — 1 month ago
▲ 7 r/Playwright+1 crossposts

Your Playwright CI reports vanish on every build. I spent a few months building a self-hosted dashboard that keeps every run

Like probably everyone here, my Playwright HTML reports live and die as CI artifacts. A test fails on Tuesday, by Thursday the report is gone, and good luck remembering whether that exact failure already happened two weeks ago.

I've been a web dev for about 18 years, and for the past few months I've been building Piwi Dashboard to fix this for my own team.

Piwi Dashboard test run page

It's a self-hosted dashboard and reporter (MIT licensed, runs as a single Docker container) where every run is kept. On top of that history it does:

  • live streaming, runs show up test by test while CI is still executing
  • failure clustering, so 40 red tests caused by one broken selector collapse into a single cluster, displayed in a page showing everything we could gather during failure
  • flaky test detection with a score and an estimate of how many CI minutes each flaky test wastes
  • locator healing: it records element attributes during passing runs, so when a locator breaks later it can suggest replacements that actually existed on the page
  • analytics, to keep an eye on everything at once
  • failure notifications to email, Slack, or webhook
  • optional AI diagnosis. It takes a failure cluster plus the git diff since the last green run and asks a model what broke. You bring your own key (Anthropic, OpenAI, or anything OpenAI-compatible like a local Ollama). Off by default.

Setup is three steps: docker compose upnpm install -D @piwitests/reporter, add it to your playwright.config.ts. Projects are created automatically on the first run and CI metadata (branch, commit, workflow) is picked up on its own.

There's a demo with sample data that runs entirely in your browser, nothing to install and no signup: https://piwitests.github.io/demo/

Code and docs: https://github.com/PiwiTests/platform

If you're wondering how it compares: the closest cousins are ReportPortal (heavier, multi-service) and Currents (SaaS, paid). This is a single MIT container you run yourself, with no telemetry, your data stays on your machine. Learn more.

Two caveats though:

  • It's pre-1.0 (0.14 right now): there are rough edges and you'll probably hit a bug or two, so pin your version and report an issue or ask a question here or in the discussions
  • And I build it with heavy AI assistance, which I'm not going to pretend otherwise; what keeps that honest is the full Playwright E2E suite that runs on every PR against SQLite and Postgres, with local and S3 storage. If it ships broken, the suite yells at me first.

I hesitated for weeks before posting, trying to polish everything I could. I'd genuinely like to know what your workflow needs that this doesn't do yet.

reddit.com
u/phenxdesign — 1 month ago

Looking for Playwright test suites to put a Playwright tool I'm developing, under test

Hi, I'm looking for various test suites, from open source projects, written in TypeScript, preferably easy to run, to put a tool I'm working on under tests, before releasing it.

Can you help me for this ?

reddit.com
u/phenxdesign — 2 months ago