Porting · porting/2026-05-05-studio-api-local-runtime.md Docs Home

Studio API Local Runtime Slice

Date: 2026-05-05

Objective

Make the imported legacy studio-api reproducible locally without touching blinkin-2-platform.

This is the first service-level proof for the Hetzner rebuild. It does not yet mean the full platform is running end to end.

What Was Added

  • configs/local/studio-api.env.example Local-only placeholder values for Postgres, Redis, Studio URLs, Houston URLs, and optional external services.
  • scripts/studio-api-local.mjs Small helper for install, build, migration, start, and health checks.
  • package.json scripts:
    • studio-api:install
    • studio-api:build
    • studio-api:migrate
    • studio-api:start
    • studio-api:health

The helper prefers Homebrew node@20 when available, because the legacy Dockerfile uses node:20-slim.

Local Commands

Start the shared local infrastructure first:

npm run legacy:infra:up

Install Studio API dependencies:

npm run studio-api:install

Build Studio API:

npm run studio-api:build

Run Studio API migrations:

npm run studio-api:migrate

Start Studio API:

npm run studio-api:start

In another terminal, check health:

npm run studio-api:health

Expected health response:

{"statusCode":200,"message":null,"data":{"status":"Ok"}}

Verification Evidence

  • PUPPETEER_SKIP_DOWNLOAD=1 HUSKY=0 npm ci completed inside legacy-src/studio-api.
  • npm run studio-api:build passed.
  • The first studio-api migration run applied 84 pending legacy migrations to the local studio_api Postgres database.
  • A second npm run studio-api:migrate returned No migrations are pending.
  • npm run studio-api:start launched the API on localhost:18000.
  • npm run studio-api:health returned HTTP 200 with data.status set to Ok.
  • npm run legacy:verify still passes after the local build artifacts were created.

Important Findings

The global machine default is Node v25.4.0. The built API does not start on Node 25 because a legacy dependency chain reaches buffer-equal-constant-time, which expects SlowBuffer.prototype.

The legacy Dockerfile uses:

FROM node:20-slim AS builder

So the local helper uses Homebrew node@20 when it exists. On this machine that is:

/opt/homebrew/opt/node@20/bin/node

Security And Cleanup Notes

  • No real .env file was created for studio-api.
  • The local env template contains placeholders only.
  • Real local override files matching configs/local/*.env are ignored by .gitignore.
  • npm ci reported 87 vulnerabilities in the legacy dependency tree. This is expected legacy risk and needs a later dependency-hardening slice before production.

Not Yet Done

  • Auth0-backed login was not tested locally.
  • Protected Studio and Houston routes were not exercised.
  • Media upload/storage is not wired to a Hetzner-ready replacement yet.
  • Studio API is not containerized in the new project yet.
  • Picasso FE and Zweistein are not wired to this local API yet.