Guides
Go to production
What you will learn: the few things to fix before real visitors use your assistant.
The checklist#
- Set a real secret. speeq signs each session with a secret. In development it makes a random one. In production you must set your own, at least 32 random characters, and every server copy must use the same one. Example:
openssl rand -base64 32. - Use a lasting store. The memory store forgets everything on restart. Use the MongoDB store or your own. See Choose a store.
- Use a real model. Remove the mock and add keys as server environment variables. See Connect a model.
- Know who is asking. Add
resolveUserso tools know the signed-in visitor. See Sessions and security. - Allow time and streaming. One turn can take several model calls, so give your route enough time. Make sure no proxy or CDN holds back streaming responses.
- Check your tools. Each one must check permissions and return only what is needed.
Good to know#
- Rate limits are per server. Limits count inside each running copy. If you need one limit for your whole site, add it at your edge or gateway.
- Background work. Use
waitUntil, for example Next.jsafter, so small jobs can finish after the answer. - Clean up. If you set
audit.retentionDays, runspeeq.purgeExpired()from a protected scheduled job. A check also runs on its own, but only when traffic happens. - Other websites. Same-origin requests work out of the box. To allow another website to call your handler, list its exact origin in
allowedOrigins. CORS does not log anyone in. - Secrets. Keep API keys and database strings in server environment variables only.
Usage numbers (optional)#
speeq can send anonymous counts to a dashboard that you run. It is off unless you set an address. Read Privacy and telemetry.