Show HN: Supapool – 每个编程代理仅需约 400 毫秒的 Supabase
Show HN: Supapool – a Supabase per coding agent in ~400 ms

原始链接: https://supapool.io/

Supapool 为测试和开发提供即用即焚的隔离式 Supabase 实例。通过执行 `npx @supapool/cli run -- ` 命令,您可以启动一个干净、真实的 Supabase 技术栈(包括 Postgres、Auth 和 Storage),并自动应用您的数据库迁移。 核心功能包括: * **隔离性**:确保并行代理之间互不冲突,避免了传统数据库分支方案带来的延迟和成本问题。 * **零配置集成**:直接向进程注入必要的环境变量(如 `SUPABASE_URL`、`DATABASE_URL`),无需修改本地配置文件。 * **即用即焚生命周期**:实例拥有租约有效期(TTL),在命令执行完毕或进程退出后会自动清除。 * **开发者友好**:以命令行界面(CLI)为中心的设计,可通过 API Key 轻松集成到 CI/CD 流水线中。 * **程序化访问**:除了 CLI 工具外,该包还提供了 `withInstance` 库函数,支持您直接在测试套件中管理租约的生命周期。 Supapool 让您能够针对真实、专用的技术栈运行端到端测试,而非依赖模拟(Mock),从而确保复杂数据库操作和迁移的更高可靠性。该服务目前处于公测阶段,可免费使用。

**Supapool** (supapool.io) 是一项旨在为编程智能体提供即时、全功能 Supabase 实例的新服务,启动速度仅需约 400 毫秒。 开发者创建 Supapool 是为了解决现有工作流程中的局限性:本地 Docker 容器占用资源过多,Supabase 分支测试迭代太慢,而使用模拟数据(mocks)往往会导致智能体产生幻觉。通过优先保证速度而非高可用性(如 WAL 和 fsync),Supapool 提供了一种轻量级、隔离的环境,使智能体能够针对类似生产环境的真实场景测试迁移和 SQL 语句。 该服务通过在多个全球区域维护“预热”实例池,并利用微型虚拟机(MicroVM/Firecracker)实现快速自动扩容,从而实现了亚秒级的启动速度。该平台目前处于测试阶段且免费使用,特别适合需要同时运行多个编程智能体、并要求快速且互不干扰数据库环境的开发者。未来的定价模式将侧重于按秒计费,以确保其比管理专用集群或标准分支更具成本效益。
相关文章

原文

How it works

npx @supapool/cli run -- npm run dev

Wrap any command. Supapool leases a clean instance, injects its credentials, keeps it alive, and releases it when the command exits.

Why

  • Real Supabase. Postgres, Auth, and S3-compatible Storage.
  • Parallel agents need this. Agents never wipe each other's databases mid-run.
  • No mocks. Test migrations and database operations against a real, isolated Supabase stack without touching production.
  • Branching is slow and expensive. Branches can take minutes to create and bill as if they were production instances.
  • Colocated. Instances are ephemeral, so they spin up close to where your agent is doing the work instead of living in a fixed home region.
  • CLI-only. There is no dashboard. Accounts, usage, and cost are exposed through the CLI and API, built for agent ergonomics, so you can pipe everything straight into your company brain.
  • Free during beta. Email [email protected] for an immediate automated response with a fix or a request for the information needed to solve it.

Docs

Commands

The CLI has two commands.

npx @supapool/cli login
npx @supapool/cli run -- <command>

login opens GitHub sign-in and saves an API key to ~/.config/supapool/config.json. run does the same sign-in on first use, so most people never run login directly.

run acquires a clean instance, applies every .sql file in supabase/migrations in filename order, starts your command with the instance credentials in its environment, renews the lease while the command is alive, and releases the instance when it exits. Your repository's environment files are never modified.

What gets injected

The wrapped command receives standard Supabase variables: SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY, and DATABASE_URL. The same values are mirrored to the current publishable and secret key names, the public prefixes used by Next.js, Vite, Astro, Svelte, Expo, Create React App, Gatsby, and Nuxt, Prisma and Postgres URL aliases, and the standard PG* connection variables. Secret keys are never assigned to browser-public variables. SUPAPOOL_INSTANCE_ID identifies the lease.

Leases

Every instance is a lease with a TTL, 30 minutes by default. The CLI renews it every 5 minutes while your command runs. When the command exits, or if the process dies and renewals stop, the lease expires and the slot is wiped and returned to the pool. Nothing you store in an instance survives release, so treat every run as disposable.

CI

CI jobs skip the browser login. Sign in once on a laptop, copy the key from ~/.config/supapool/config.json into a CI secret, and set it as SUPAPOOL_API_KEY:

SUPAPOOL_API_KEY=sp_live_... npx @supapool/cli run -- pnpm test

Use it from code

The npm package is also a library. withInstance acquires a lease, renews it while your callback runs, and always releases it, even when the callback throws:

import { withInstance } from '@supapool/cli'

await withInstance(async (instance) => {
  const { SUPABASE_URL, SUPABASE_ANON_KEY, DATABASE_URL } = instance.env
  // run tests, seed data, exercise the real stack
})

The lifecycle primitives acquire, renew, release, and startRenewer are exported for code that manages its own lease boundaries. See the package README for the full API.

联系我们 contact @ memedata.com