# Bid Radar Lite

> A multi-tenant web app for small construction firms with no bid staff. It collects public tender notices every day, filters them by rules, and shows each match with the reason it was recommended, eligibility, and the deadline.

- Published: 2026-11-11
- Client: Personal project (for small construction firms)
- Role: Design, implementation, deployment (team of 1)
- Period: 2026-10-30 ~ 2026-11-03
- Stack: Node.js, PostgreSQL, Supabase, PGlite, Playwright, Cloud Run
- Outcome: Precision 0.700 → 1.000 on a synthetic golden set of 46 cases (rule fixes)
- Tags: SaaS, RLS, rule matching, public data

**Why**: Small firms have no one assigned to bids, notices are scattered, and deadlines are short. Existing paid services are built for large firms, so they are expensive and complex.

**Principle**: Rules decide what gets recommended and attach their reasons; without a reason, nothing is stated as certain.

## Metrics

| Metrics | Value | Scope | Source |
| --- | --- | --- | --- |
| Match precision (synthetic golden set, 46 cases) | 0.700 → 1.000 | Reproducible measurement | node scripts/eval-match.mjs (rerun 2026-11-03), tests/fixtures/golden/ |
| Match recall (synthetic golden set, 46 cases) | 0.750 → 1.000 | Reproducible measurement | node scripts/eval-match.mjs (rerun 2026-11-03) |
| Eligibility judgment accuracy | 0.823 → 1.000 (34/34) | Reproducible measurement | node scripts/eval-match.mjs, after correcting 2 labels (2026-11-03), Development log (private) |
| Unit / E2E tests | 974/0 · 121/0 | Reproducible measurement | npm test, npm run e2e (2026-11-03), Development log (private) |
| Live call, construction tender list | resultCode=00 totalCount=506 | Production measurement | npm run smoke:live (last 24 hours, value at time of measurement), Development log (private) |

## Links

- Demo: https://bid-radar-lite-1072416881206.asia-northeast3.run.app
- Repository: https://github.com/ilyos-numon/bid-radar-lite

## 1. Situation

Small firms have no one assigned to bids. Public tender notices are scattered across several sites, and deadlines are short. Firms that cannot check every day miss opportunities. Existing paid services are built around large firms, so they are expensive and complex.

The target users were the owner of a landscaping firm with about 5 employees and 1 office worker. The goal: enter industry keywords, region, and budget range, and see which of today's new notices fit, each with an explanation of why it was recommended.

## 2. Scoping

The initial scope was a condition file plus webhook alerts. After feedback that "alerts alone aren't worth trying," I widened it to 7 menus.

In exchange, I was explicit about what to drop. No drafting of bids or proposals, and no award prediction. Rules decide whether to recommend; the LLM only helps with summaries. Today's notices and alerts keep working without an LLM. The app never declares "not eligible" based only on text it parsed automatically. The UI avoids engine terminology, and a unit test checks for banned words.

## 3. Build

| Category | What | Rationale |
| --- | --- | --- |
| Adopted | Supabase Auth, Postgres RLS, Cloud Run | Don't build auth or secret storage yourself |
| Modified | Region, budget, and license matching rules | Changed rules by root cause instead of patching to fit the golden set |
| Built | Per-company row isolation, collection on the first visit of the day, sign-up-free demo | To run a public demo at close to 0 fixed cost |

Many companies share one service, so isolation is not left to app code alone. All 25 business tables carry a company ID. The app connects as a dedicated role that cannot bypass RLS and sets the "current company" on the connection for every request. If it is not set, reads return 0 rows and writes fail, so it fails closed.

The public demo is idle most of the time, so I removed the always-on instance and scheduled jobs. After comparing 5 ways to run collection, I chose "the first visit of the day sends a collection request to the app itself." An atomic claim on a date key ensures it starts only once, and the visitor waits at most 1.5 seconds.

## 4. What broke

**Precision 0.700.** On a synthetic golden set of 46 cases, precision was 0.700 and recall 0.750. There were three causes. Region was approximated from the agency name, confusing the agency's location with the eligible bidding region. Budget looked at the allocated budget first. A partial license match counted as holding the license. Switching to an eligible-region lookup with province-level comparison, estimated price first, and exact license matching brought precision and recall to 1.000. With judgment accuracy at 0.941, the remaining 2 cases were labels that were overconfident. Company locations are only known at the province level, so a city or district restriction cannot be confirmed; I corrected those labels and kept the previous values alongside the reasoning.

**Showing rank 1 as the winner.** Checking responses with 3 live calls showed that the bid-opening results have no award field. I now fetch the award list separately and join on notice number and round; when there is no match, the row is labeled "rank 1 at bid opening." If the award-list call fails, every row is downgraded.

**Trusting the request Host.** A review found a path where building the app's own request URL from the Host header could leak the secret token to an outside host. The URL is now built only from the configured service address, and if none is set, first-visit collection is turned off.

## 5. Results

| Metric | Value | Scope | Source |
| --- | --- | --- | --- |
| Match precision | 0.700 → 1.000 | Reimplementation (synthetic, 46 cases) | `node scripts/eval-match.mjs` |
| Match recall | 0.750 → 1.000 | Reimplementation (synthetic, 46 cases) | `node scripts/eval-match.mjs` |
| Judgment accuracy | 0.823 → 1.000 (34/34) | Reimplementation (after correcting 2 labels) | Development log (private) |
| Unit / E2E | 974/0 · 121/0 | Reimplementation | `npm test`, `npm run e2e` |
| Live construction notices | resultCode=00 totalCount=506 | Operations (value at time of measurement) | `npm run smoke:live` |

The 1.000 accuracy is measured on the synthetic golden set. Accuracy on real notices has not been measured.

## 6. If I did it again

There is still no record of a real firm using it for 2 weeks. The public demo runs on sample data. Next is expanding the golden set with real notices and recording, in numbers, the results of 1 firm running it.

Payments and email are not in real operation. Scheduled jobs are off, so no daily alerts go out; collection runs on the first visit of the day. With minimum instances at 0, the first demo login after idle took about 23 seconds, a value the operator confirmed in the environment before the migration. I also have not pinned down why CI runners get cancelled midway with 0 failures. I split the runners without cutting any tests, but 1 of 4 still drops. That has to be fixed before automatic deployment can run.
