A minimal Express server that proxies chat requests from the WalkWise frontend to the Groq API. It exists for one reason: to keep the Groq API key off the client.
The WalkWise chatbot needs to call an LLM provider (Groq) to generate responses. Calling Groq directly from the browser would require exposing the API key in client-side code, since anything bundled into a Vite app (VITE_* env vars) is visible to anyone who opens DevTools.
This server sits between the frontend and Groq:
WalkWise (Vercel) → walkwise-proxy (Render) → Groq API
The Groq key lives only in this server's environment variables. The client never sees it.
Accepts a conversation and forwards it to Groq.
Request body:
{
"messages": [
{ "role": "user", "content": "Explain recursion simply" },
{ "role": "assistant", "content": "Recursion is..." },
{ "role": "user", "content": "Can you give an example?" }
]
}Response: the raw Groq chat completion response. The text of the reply is at:
response.choices[0].message.content
Returns OK. Used to check the server is alive and to "warm up" the free-tier instance before a demo.
npm installCreate a .env file in the root:
GROQ_API_KEY=your_groq_key_here
PORT=3000
Run it:
npm startServer starts at http://localhost:3000.
- Push this repo to GitHub
- Create a new Web Service on Render, connect the repo
- Build command:
npm install - Start command:
npm start - Add environment variable:
GROQ_API_KEY - Deploy
Render assigns a public URL (e.g. https://walkwise-proxy.onrender.com) — this is what the frontend calls.
- Free tier cold starts: Render's free instance spins down after inactivity. The first request after idle time can take 20–30 seconds. Hit
/healtha few minutes before a demo to warm it up. - CORS: currently open (
cors()with no restrictions). Tighten this to the deployed WalkWise domain once the frontend URL is final. - Model: currently using
llama-3.3-70b-versatile. Change inserver.jsif needed.
- Express
- node-fetch (native
fetch, Node 18+) - dotenv
- cors