Skip to main content
All commands below are run from the repository root unless otherwise noted. The root package.json uses npm workspaces to delegate workspace-specific scripts.

Development servers

Start all dev servers

npm run dev
Starts the Astro app and Sanity Studio concurrently using concurrently --kill-others. Either server exiting kills the other.
ServerURLDescription
Astro apphttp://localhost:4321Frontend website with hot module replacement
Sanity Studiohttp://localhost:3333Headless CMS authoring interface

Start with Storybook

npm run dev:storybook
Starts all three servers concurrently: Astro app, Sanity Studio, and Storybook.
ServerURLDescription
Astro apphttp://localhost:4321Frontend website
Sanity Studiohttp://localhost:3333CMS authoring interface
Storybookhttp://localhost:6006Component development and visual testing
Use dev:storybook when working on new UI components or block variants. Storybook provides hot reload and isolated rendering without needing a Sanity connection.

Start Storybook alone

npm run storybook
Launches only Storybook on port 6006. Useful when you only need to work on components without running the full stack.

Preview production SSR build

npm run preview --workspace=astro-app
Builds the Astro app and serves it via wrangler pages dev on port 4321. This simulates the Cloudflare Pages SSR environment locally, including Cloudflare bindings (D1 database, KV, Durable Objects).
The preview command requires Wrangler to be installed and authenticated. Run npx wrangler login if you haven’t already.

Build commands

Production build

npm run build --workspace=astro-app
Builds the Astro app for production as static HTML into astro-app/dist/. Tailwind CSS is purged, and all Sanity content is baked into the output.

Deploy build to Cloudflare

npm run deploy --workspace=astro-app
Runs astro build && wrangler pages deploy dist/. Requires Wrangler authentication and appropriate Cloudflare Pages permissions.

Deploy Sanity Studio

npx sanity deploy --workspace=studio
Deploys the Studio to Sanity’s hosted URL (e.g., https://ywcccapstone.sanity.studio).

Testing

Run all tests

npm run test
Runs Vitest unit tests followed by Playwright E2E tests. The E2E suite builds the Astro app first.

Unit tests (Vitest)

npm run test:unit          # Run once
npm run test:unit:watch    # Watch mode — re-runs on file changes
npm run test:unit:coverage # Run with V8 coverage report
Unit tests live in astro-app/src/**/*.test.ts and cover utilities, GROQ query helpers, mock data, and DOM scripts. Vitest uses jsdom for browser-like test execution.

E2E tests (Playwright)

npm run test:e2e           # Run all 5 browser projects
npm run test:chromium      # Run Chromium only (fastest)
npm run test:headed        # Run Chromium with browser window visible
npm run test:ui            # Open Playwright UI mode
Playwright tests live in tests/ and run across 5 device configurations. axe-core accessibility checks are included in every E2E run.
E2E tests build the Astro app before running. The first run will be slower — subsequent runs reuse the cached build if no source files have changed.

Integration tests

Integration tests use Playwright without a browser. Run them directly with:
npx playwright test tests/integration
They validate schema imports, block registry conventions, and module resolution — no network or browser launch required.

Code quality

TypeScript check

npm run check --workspace=astro-app
Runs astro check to type-check all .astro, .ts, and .tsx files.

Generate Sanity types

npm run typegen
Runs sanity typegen generate in the studio workspace to regenerate TypeScript types from the Sanity schema and GROQ queries. Run this after modifying any schema file or GROQ projection.

Command reference

The full list of scripts from the root package.json:
CommandWhat it does
npm run devStart Astro + Studio dev servers
npm run dev:storybookStart Astro + Studio + Storybook (all three)
npm run storybookStart Storybook alone (port 6006)
npm run build --workspace=astro-appBuild Astro for production
npm run preview --workspace=astro-appServe production build via Wrangler
npm run deploy --workspace=astro-appBuild and deploy to Cloudflare Pages
npm run testRun unit tests + E2E tests
npm run test:unitRun Vitest unit tests
npm run test:unit:watchUnit tests in watch mode
npm run test:unit:coverageUnit tests with V8 coverage
npm run test:e2eRun Playwright E2E tests
npm run test:chromiumE2E tests on Chromium only
npm run test:headedE2E tests with visible browser
npm run test:uiPlaywright UI mode
npm run typegenRegenerate Sanity TypeScript types
npm run check --workspace=astro-appTypeScript type check
npm run deploy:rate-limiterDeploy the Cloudflare rate limiter Worker

Port assignments

PortService
4321Astro dev server and Wrangler Pages preview
3333Sanity Studio
6006Storybook