GPN BusinessDiscoverer

Documentation/ GPN BusinessDiscoverer/ gpn-yp-site-worker

Local development and testing

How to build, run, and test the YP site locally using npm scripts.

Article Slug: local-development Updated: 27 Jun 2026

Prerequisites

All commands run from the apps/gpn-yp-site-worker/ directory.

npm scripts

Development server

npm run dev

Starts the Remix Vite dev server with hot module replacement. The site is available at http://localhost:5173. Changes to routes, components, and styles reload instantly.

The dev server runs Remix loaders locally. D1 queries work against a local SQLite database managed by wrangler (.wrangler/state/).

Production build

npm run build

Runs remix vite:build, which produces:

Preview the production build

npm run preview

Runs wrangler pages dev build/client, which serves the production build locally using the wrangler Pages runtime. This simulates the Cloudflare Worker environment including D1, AI, and Vectorize bindings.

Use preview to verify that the production build works before deploying.

Type checking

npm run typecheck

Runs tsc --noEmit to check for TypeScript errors without producing output files. This catches type errors in routes, components, and loaders.

Full validation

npm run validate

Runs typecheck. Use this as a quick pre-commit check.

Test suite

npm run test

Runs typecheck followed by the regression test suite (test/front-end-regressions.ts). The regression tests verify that core routes and components render correctly.

Smoke check

npm run smoke-check

Runs a remote sanity check against the deployed worker to verify it responds correctly.

Database provisioning

npm run db:provision        # Create and seed the gpn-user-d1 tables
npm run db:migrate          # Run pending migrations
npm run db:backfill:listings  # Backfill business listings from source data

These scripts set up the local D1 database with schema and seed data so the search page returns results during development.

Typical workflow

  1. npm run db:provision — set up local database (first time only)
  2. npm run dev — start the dev server
  3. Edit routes in app/routes/ and components in app/components/
  4. npm run typecheck — verify types before committing
  5. npm run build — verify the production build succeeds
  6. npm run preview — test the production build locally