# Deploying the SaniPlus chatbot to Render A public, shareable showcase URL in ~10 minutes. The app is protected by a shared access code, and your Anthropic API key stays server-side. ## What you need - A GitHub account - A Render account (https://render.com — free tier is fine) - Your Anthropic API key (`sk-ant-...`) - An access code you invent (e.g. `saniplus2026`) --- ## Step 1 — Put this folder in a GitHub repo From inside `saniplus-chatbot-llm/`: ```powershell git init git add . git commit -m "SaniPlus chatbot (LLM-backed) showcase" # create an empty repo on github.com first, then: git remote add origin https://github.com//saniplus-chatbot.git git branch -M main git push -u origin main ``` `.gitignore` already excludes `node_modules` and any `.env`, so no secrets are committed. > Push **this folder** as the repo root (so `package.json` and `render.yaml` > are at the top level). If you push the parent folder instead, set > `rootDir: saniplus-chatbot-llm` under the service in `render.yaml`. ## Step 2 — Create the service on Render **Option A — Blueprint (uses the included `render.yaml`):** 1. Render dashboard → **New** → **Blueprint**. 2. Connect your repo. Render reads `render.yaml` and proposes the service. 3. It will ask for the two secret values (they have `sync: false`): - `ANTHROPIC_API_KEY` = your `sk-ant-...` - `ACCESS_CODE` = the password you chose 4. **Apply** → first build runs `npm install` and starts `npm start`. **Option B — Manual web service:** 1. **New** → **Web Service** → connect the repo. 2. Runtime **Node**, Build `npm install`, Start `npm start`. 3. **Environment** → add `ANTHROPIC_API_KEY`, `ACCESS_CODE`, and `NODE_VERSION=20`. 4. Create. ## Step 3 — Open it Render gives you `https://saniplus-chatbot.onrender.com` (or similar). Open it, enter the access code, and the chat goes live. Share the URL **and** the code with whoever you're demoing to. --- ## Notes - **Cold start:** the free plan sleeps after ~15 min idle; the first hit then takes ~30s to wake. Upgrade to a paid instance ($7/mo) for always-on. - **Health check:** Render pings `/api/health` to confirm the service is up. - **Rotating the code:** change `ACCESS_CODE` in the Render dashboard and redeploy — existing browser sessions are revalidated on next request. - **Cost control:** the access gate keeps usage to people you share the code with. For extra safety you can still add per-IP rate limiting (ask me). - **Verify hours per branch** and complete the GDPR/HWG review before using this with real customers (see README.md). ## Protection layers (both active) - **Access code** — `ACCESS_CODE` gates `/api/chat` (401 without a valid code). - **Rate limiting** — per-IP sliding window on `/api/chat` and `/api/gate`. Defaults: 20 requests / 60s. Override with env vars `RATE_MAX` and `RATE_WINDOW_MS`. Returns HTTP 429 with `Retry-After` when exceeded. ## Always-on alternative — Fly.io (no cold start) The repo includes a `Dockerfile` + `fly.toml`. Deploy: ```powershell fly launch --no-deploy # accept the included fly.toml fly secrets set ANTHROPIC_API_KEY=sk-ant-... ACCESS_CODE=yourcode fly deploy ``` Set `min_machines_running = 1` in `fly.toml` for guaranteed always-on (no cold start). The same Docker image runs on Railway, Cloud Run, or any container host.