Deploy reach-immigration-api 0.0.1 (built 20261120-182613)

The zip holds the compiled app directly at its root: main.js, modules/, config/, ...
plus package.json and package-lock.json. Unzip it into the app folder on the server.
Your existing .env is never overwritten (no env file is in the zip).

  1. Stop the app (e.g. pm2 stop reach-immigration-api)
  2. Remove the previous build so no stale files remain (keeps .env):
       rm -rf app.module.* main.* tsconfig.build.tsbuildinfo common config google-places \
              lead-webhook mailchimp modules wordpress node_modules
  3. unzip -o reach-immigration-api.zip
  4. (nothing to install: node_modules is inside the zip)
  5. Make sure .env has: WPGRAPHQL_ENDPOINT, API_KEYS, REDIS_HOST, REDIS_PORT,
     GOOGLE_PLACES_API_KEY, MAILCHIMP_API_KEY, MAILCHIMP_AUDIENCE_ID, LEAD_WEBHOOK_URL
     (the app refuses to start without them; GOOGLE_PLACE_ID is no longer used)
  6. Start from this folder (the app reads .env from the folder it starts in):
       node main.js        # or: pm2 start main.js --name reach-immigration-api
  7. WordPress plugin (only when it changed; it is in this zip under wordpress-integration/):
       copy wordpress-integration/mu-plugins/ri-cache-purge-webhook.php to
       wp-content/mu-plugins/ on the WordPress server. wp-config.php needs
       RI_API_BASE_URL and RI_API_PURGE_KEY (one of the API_KEYS).
  8. Cache settings are optional (every one has a default; see CACHE-MECHANISM.md):
       CACHE_TTL_FALLBACK=21600  CACHE_TTL_FULL_LIST=86400  CACHE_STALE_MAX_SECONDS=604800
       CACHE_SWR_SECONDS=300  CACHE_REFRESH_CONCURRENCY=2  CACHE_REFRESH_DELAY_MS=200
       CACHE_PURGE_REFRESH_LIMIT=100  CACHE_REFRESH_MAX_URLS=500
     FRONTEND_REVALIDATE_URL (the website's /api/revalidate) and
       FRONTEND_REVALIDATE_SECRET (= the website's REACH_REVALIDATE_SECRET): makes the
       website show an edit within seconds instead of after its own 60 s page cache.
     Set CACHE_WARM_BASE_URL only if the app does not listen on PORT.
     Lower CACHE_REFRESH_CONCURRENCY (or raise CACHE_REFRESH_DELAY_MS) if WordPress
     times out while a refresh runs.
  9. Redis needs no restart for an update. Recommended redis.conf: maxmemory 256mb,
     maxmemory-policy allkeys-lru, and keep snapshot saving on (the startup seed is
     skipped only when Redis keeps its data across restarts). Check the size with:
       redis-cli info memory
 10. After starting, the log shows either "Cache already seeded; skipping the startup seed"
     or the seed progress. Save one item in WordPress and look for a
     "Purge note for ..." line, followed by "Refreshed ..." a few seconds later.
