• English
  • Operations

    This page covers build commands, deployment, environment configuration, and infrastructure. For local development setup, see Quickstart.


    Build & Deploy Commands

    CommandWhat it doesNode requirement
    npm run devVite dev server at http://localhost:5173≥ 22.15
    npm testRun all tests once (vitest run)any
    npm run test:watchVitest watch modeany
    npm run typechecktsc --noEmitany
    npm run buildProduction build: tsc -b && vite build (mode production)≥ 22.15
    npm run build:uatUAT build: tsc -b && vite build --mode uat≥ 22.15
    npm run previewBuild prod + wrangler dev (local Workers preview)≥ 22.15
    npm run deployBuild prod + wrangler deploy → worker salon-booking-ui≥ 22.15
    npm run deploy:uatBuild uat + wrangler deploy --env uat → worker salon-booking-ui-uat≥ 22.15

    Node version enforcement:

    • .nvmrc pins to 22.20.0.
    • package.json engines requires >= 22.15.
    • The Cloudflare Workers Vite plugin imports module.registerHooks (Node ≥ 22.15 only). Older Node versions fail to load vite.config.ts with does not provide an export named 'registerHooks'.
    • vite.config.ts dynamically imports the Cloudflare plugin and skips it under process.env.VITEST, so npm test and npm run typecheck work on any Node version.

    Vite Configuration

    Source: vite.config.ts

    • Plugins (non-test): @vitejs/plugin-react, @cloudflare/vite-plugin, vite-plugin-pwa.
    • Plugins (test): Only @vitejs/plugin-react — Cloudflare and PWA plugins are skipped when process.env.VITEST is set.
    • Path alias: @/src/ (mirrored in tsconfig.json).
    • PWA: Service worker via Workbox with autoUpdate registration, custom manifest, and runtime caching that forces NetworkOnly for /v1/book paths (never cache booking API responses).
    • Vitest config: globals: true, environment: jsdom, setup file at src/test-setup.ts.

    Environment Variables

    One public variable drives the app:

    VariablePurpose
    VITE_BOOKING_BASE_URLBackend Edge URL (the app appends /v1/book automatically)

    The value is baked in at build time by Vite mode — never read at runtime. Three environments, each with a committed per-mode file:

    EnvironmentVite modeConfig fileVITE_BOOKING_BASE_URL
    Localdevelopment.env.developmenthttp://localhost:8080
    UATuat.env.uathttps://api-uat.auralynkai.com
    Productionproduction.env.productionhttps://api.auralynkai.com

    For local overrides, create a gitignored .env.local — it overrides the mode-specific file. Do not read import.meta.env directly anywhere except src/lib/config.ts.


    Cloudflare Workers Deployment

    Source: wrangler.jsonc

    The app is deployed as static assets on Cloudflare Workers:

    Top-level (production) worker

    • Name: salon-booking-ui
    • Domain: booking.auralynkai.com
    • Route: { pattern: "booking.auralynkai.com", custom_domain: true }

    UAT environment worker

    • Name: salon-booking-ui-uat
    • Domain: booking-uat.auralynkai.com
    • Route: { pattern: "booking-uat.auralynkai.com", custom_domain: true }

    Worker settings (applied to both)

    SettingValueNotes
    compatibility_date2026-06-22
    compatibility_flags["nodejs_compat"]
    assets.not_found_handling"single-page-application"All 404s serve index.html (needed for React Router client-side routing)
    observability.enabledtrue

    Key operational detail: UAT and production are two separate workers, each with its own custom_domain route. Routes are not inherited between envs, so they're redeclared in the env.uat block. Assets, compatibility, and observability settings are inherited from the top level.


    TypeScript Configuration

    Source: tsconfig.json

    • Target: ES2021
    • Module: ESNext (bundler resolution)
    • JSX: react-jsx
    • Strict mode: enabled, with noUnusedLocals and noUnusedParameters
    • Path alias: @/*src/*
    • No emit (noEmit: true) — Vite handles compilation

    Backend Configuration Hookup

    The backend's Booking:SelfService:ManageBaseUrl setting controls the base URL included in email magic links:

    production: https://booking.auralynkai.com/manage
    UAT:        https://booking-uat.auralynkai.com/manage

    Email links follow the format {ManageBaseUrl}/{token}https://booking.auralynkai.com/manage/eyJ....


    Notes for Future Agents

    • Adding a new environment: Add a .env.<mode> file, update wrangler.jsonc with a new env.<mode> block (routes must be redeclared), and add npm scripts for build/deploy.
    • Node version: The Cloudflare plugin dependency on module.registerHooks is the sole reason for the Node ≥ 22.15 requirement. If @cloudflare/vite-plugin relaxes this, the engines constraint can be lowered.
    • Deployment: Always run tsc -b && vite build (the build/build:uat scripts) before deploying. Wrangler deploy does not run the build step automatically in the current setup.
    • PWA cache: The service worker is configured to never cache /v1/book paths. If the API path prefix changes, update the runtimeCaching rule in vite.config.ts.
    • SPA routing: The Workers assets.not_found_handling: "single-page-application" setting ensures client-side routes work. If this ever needs to change (e.g., to serve a custom 404 page), React Router would need a catch-all route instead.