Skip to content

Latest commit

 

History

History
78 lines (60 loc) · 4.02 KB

local-development.md

File metadata and controls

78 lines (60 loc) · 4.02 KB

Local development

Requirements

  • Node.js 22 or newer (.nvmrc pins 22)
  • pnpm 9 via Corepack: corepack enable
  • Docker, for Postgres (or your own Postgres 13+)
  • Chrome or Chromium, for the extension

First run

pnpm install
cp .env.example .env
docker compose up -d db                                     # Postgres on 127.0.0.1:54329
docker compose exec db createdb -U reprodrop reprodrop_test # for integration tests (once)
pnpm db:migrate
pnpm db:seed                                                # optional: demo@reprodrop.dev / reprodrop-demo
pnpm dev

pnpm dev starts:

Use the dashboard on port 5173 while developing. On first start the API generates APP_SECRET and ENCRYPTION_KEY into data/secrets.json unless they're set in .env. Uploaded screenshots go to data/uploads.

If port 5173 is busy, run the dashboard on another port with pnpm --filter @reprodrop/web dev --port 5180.

The extension

pnpm dev:extension            # rebuilds apps/extension/dist on change

Load apps/extension/dist unpacked in chrome://extensions (Developer mode), then in its settings use http://localhost:3000 as the server URL and a token from Settings → API tokens. After a rebuild, click the reload icon on the extension card. See extension.md.

Tests

Command Scope Needs
pnpm test Unit and integration tests in every package Postgres with a reprodrop_test database
pnpm --filter @reprodrop/api test API integration tests only Same
pnpm test:e2e Builds everything, then runs Playwright with the real extension Postgres; Playwright's Chromium (pnpm --filter @reprodrop/e2e exec playwright install chromium)
  • API tests rebuild the reprodrop_test schema from the migrations at the start of each run and empty the tables between tests. Point them elsewhere with TEST_DATABASE_URL.
  • End-to-end tests drop and recreate reprodrop_e2e (override with E2E_DATABASE_URL), start the production build on port 3210 with Jira in mock mode, load apps/extension/dist-e2e into Chromium, and walk through sign-up → token → extension settings → recording → submission → dashboard → Jira. No real Atlassian account is used.
  • The e2e build of the extension (build:e2e) pre-grants host permissions so tests don't hit Chrome's permission prompt. Never load it in your everyday browser.

Useful scripts

pnpm lint            # ESLint (flat config, strict TypeScript rules)
pnpm typecheck       # tsc --noEmit in every package
pnpm format          # Prettier
pnpm db:generate     # new migration after editing packages/database/src/schema.ts
pnpm build           # production builds
node e2e/scripts/screenshots.mjs http://localhost:5173 ./shots light 1440   # dashboard screenshots

Troubleshooting

  • Can't connect to Postgres: start it with docker compose up -d db and check DATABASE_URL.
  • Invalid configuration: the message lists every problem; compare with .env.example.
  • The extension says it can't reach ReproDrop: check the server URL in its settings (no trailing path) and that the API is running. Extension requests go straight to the API on port 3000.
  • Port 54329 is in use: set POSTGRES_PORT in .env and update DATABASE_URL.