메뉴
HN
Hacker News • 58일 전

코딩 에이전트용 임시 Supabase, 400ms 부팅 'Supapool'

IMP
7/10
핵심 요약

Supapool은 코딩 에이전트 또는 CI 환경에서 명령어를 실행할 때 약 400ms 만에 격리된 실제 Supabase 인스턴스를 임대해주는 CLI 도구입니다. 복잡한 브랜치 생성이나 Mock 데이터 없이도 안전하게 데이터베이스 마이그레이션을 테스트할 수 있어, 병렬로 작동하는 AI 에이전트들의 데이터 충돌 문제를 완벽히 방지합니다. 작업이 끝나면 인스턴스는 자동으로 폐기되며, 베타 기간 동안 무료로 사용할 수 있습니다.

번역된 본문

코딩 에이전트에 이 도구를 제공해 보세요. (디스코드 링크)

작동 방식 npx @supapool/cli run -- npm run dev 원하는 어떤 명령어든 감싸서(wrap) 실행하기만 하면 됩니다. Supapool이 깨끗한 인스턴스를 임대하고, 자격 증명(credentials)을 주입하며, 명령어가 실행되는 동안 인스턴스를 유지하고 명령어가 종료되면 해제합니다.

왜 필요한가?

  • 진짜(real) Supabase: Postgres, Auth, 그리고 S3 호환 스토리지를 제공합니다. 병렬로 작업하는 에이전트들에게 꼭 필요합니다. 에이전트들이 실행 중 서로의 데이터베이스를 덮어쓰거나 날려버리는 일이 절대 발생하지 않습니다.
  • Mock 없음: 프로덕션 환경에 영향을 주지 않고, 격리된 진짜 Supabase 스택에서 마이그레이션과 데이터베이스 작업을 테스트할 수 있습니다.
  • 브랜치는 느리고 비쌈: 브랜치를 생성하는 데 몇 분이 걸릴 수 있으며, 프로덕션 인스턴스처럼 요금이 부과될 수 있습니다.
  • 동일 위치 배치(Colocated): 인스턴스는 일시적(ephemeral)이므로, 고정된 홈 리전에 머무는 대신 에이전트가 작업을 수행하는 가장 가까운 곳에서 빠르게 실행됩니다.
  • 오직 CLI만 제공: 대시보드가 없습니다. 계정, 사용량 및 비용은 CLI와 API를 통해 확인할 수 있으며, 에이전트 작업에 최적화되어 있어 모든 데이터를 회사의 핵심 시스템(brain)으로 바로 전송할 수 있습니다.
  • 베타 기간 무료: agent@supapool.io로 이메일을 보내면 즉각적인 자동 응답과 함께 해결책 또는 문제 해결에 필요한 정보 요청을 받을 수 있습니다.

문서 및 명령어 이 CLI는 두 개의 명령어를 가지고 있습니다. npx @supapool/cli login npx @supapool/cli run -- <명령어> login은 깃허브(GitHub) 로그인 창을 열고 API 키를 ~/.config/supapool/config.json에 저장합니다. run은 첫 사용 시 동일한 로그인을 수행하므로, 대부분의 사람들은 login을 직접 실행하지 않습니다. run은 깨끗한 인스턴스를 획득하고, supabase/migrations에 있는 모든 .sql 파일을 파일 이름 순서대로 적용한 다음, 인스턴스 자격 증명을 환경 변수에 담아 명령어를 시작합니다. 명령어가 살아있는 동안 임대(lease)를 갱신하고, 종료되면 인스턴스를 해제합니다. 귀하의 리포지토리 환경 파일은 절대 수정되지 않습니다.

주입되는 항목 래핑된 명령어는 표준 Supabase 변수인 SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY, DATABASE_URL을 받습니다. 이와 동일한 값들은 현재 게시 가능한 키 및 비밀 키 이름, Next.js, Vite, Astro, Svelte, Expo, Create React App, Gatsby, Nuxt에서 사용하는 공개 prefix, Prisma 및 Postgres URL 별칭, 그리고 표준 PG* 연결 변수에도 매핑됩니다. 비밀 키는 브라우저 공개 변수에 절대 할당되지 않습니다. SUPAPOOL_INSTANCE_ID가 임대를 식별합니다.

임대(Leases) 모든 인스턴스는 TTL(기본값 30분)을 가진 임대입니다. CLI는 명령어가 실행되는 동안 5분마다 이를 갱신합니다. 명령어가 종료되거나 프로세스가 죽어서 갱신이 중단되면 임대가 만료되고, 슬롯은 초기화되어 풀(pool)로 반환됩니다. 인스턴스에 저장한 항목은 해제 후 유지되지 않으므로, 모든 실행을 일회용으로 취급하십시오.

CI (지속적 통합) CI 작업은 브라우저 로그인을 건너뜁니다. 노트북에서 한 번 로그인한 후, ~/.config/supapool/config.json에서 키를 복사하여 CI 비밀 변수(secret)에 넣고, 이를 SUPAPOOL_API_KEY로 설정하십시오: SUPAPOOL_API_KEY=sp_live_... npx @supapool/cli run -- pnpm test

코드에서 사용하기 이 npm 패키지는 라이브러리이기도 합니다. withInstance는 임대를 획득하고 콜백이 실행되는 동안 이를 갱신하며, 콜백에서 오류가 발생하더라도 항상 해제합니다:

import { withInstance } from '@supapool/cli'

await withInstance(async (instance) => {
  const { SUPABASE_URL, SUPABASE_ANON_KEY, DATABASE_URL } = instance.env
  // 테스트 실행, 데이터 시딩, 실제 스택 테스트 등 수행
})

acquire, renew, release, startRenewer와 같은 라이프사이클 기본 요소들은 자체적인 임대 경계를 관리하는 코드를 위해 내보내기(export)됩니다. 전체 API는 패키지 README를 참조하십시오.

원문 보기
원문 보기 (영어)
Give this to your coding agent Discord 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 agent@supapool.io 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.