Spaces:
Sleeping
Download DEPLOY.md from Sebacu/saniplus-chatbot: direct link, hf CLI and curl.
- Browser
- Download file 3.38 kB
-
https://huggingface.co/spaces/Sebacu/saniplus-chatbot/resolve/main/DEPLOY.md
- Command line
-
hf download hf://spaces/Sebacu/saniplus-chatbot/DEPLOY.md
-
curl -L -o DEPLOY.md https://huggingface.co/spaces/Sebacu/saniplus-chatbot/resolve/main/DEPLOY.md
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/:
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/<you>/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.jsonandrender.yamlare at the top level). If you push the parent folder instead, setrootDir: saniplus-chatbot-llmunder the service inrender.yaml.
Step 2 β Create the service on Render
Option A β Blueprint (uses the included render.yaml):
- Render dashboard β New β Blueprint.
- Connect your repo. Render reads
render.yamland proposes the service. - It will ask for the two secret values (they have
sync: false):ANTHROPIC_API_KEY= yoursk-ant-...ACCESS_CODE= the password you chose
- Apply β first build runs
npm installand startsnpm start.
Option B β Manual web service:
- New β Web Service β connect the repo.
- Runtime Node, Build
npm install, Startnpm start. - Environment β add
ANTHROPIC_API_KEY,ACCESS_CODE, andNODE_VERSION=20. - 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/healthto confirm the service is up. - Rotating the code: change
ACCESS_CODEin 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_CODEgates/api/chat(401 without a valid code). - Rate limiting β per-IP sliding window on
/api/chatand/api/gate. Defaults: 20 requests / 60s. Override with env varsRATE_MAXandRATE_WINDOW_MS. Returns HTTP 429 withRetry-Afterwhen exceeded.
Always-on alternative β Fly.io (no cold start)
The repo includes a Dockerfile + fly.toml. Deploy:
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.