// How it's built
Sofia
She asks in the visitor’s own words, then emails me a written brief before we speak.
The chat calls xAI or OpenRouter. The choice is stored with the site. The keys stay on the server.
- xAI
- The default. The model is grok-4.6 unless a saved id or XAI_MODEL replaces it. The call goes to api.x.ai.
- OpenRouter
- Used when that provider is selected. The default model is openai/gpt-4.1-mini unless a saved id or OPENROUTER_MODEL replaces it. The call goes to openrouter.ai.
- Keys
- XAI_API_KEY and OPENROUTER_API_KEY are read on the server. The browser calls this site, not the model host.
A conversation, not a form. She asks the next detail and copies what they said. The request does not give her tools.
- Prompt
- The built-in instructions say to use their words, not invent, and to ask one next question. A saved version can replace that text. If the database is down, the built-in prompt is used.
- Shape
- Each reply is JSON: a short reply, whether the brief is ready, the write-up, and the fields name, email, business, people, problem, build, and timing. Timing stays empty until they mention it.
- Stop
- They can stop once there is a name, an email, and a picture of the work. She writes it up. The page sends the email only after they press the button.
- Refuses
- The instructions tell her not to answer or store a rude, offensive, or off-topic message, and not to ask for passwords or payment details. She must not say the email has already been sent.
They press send. Resend emails the write-up and the exchange.
- Send
- The button posts the brief, the write-up, and the exchange. Another reply can change the write-up before that.
- Resend sends one email to carlos@carlosnatera.com and one to the address they gave, unless those are the same. RESEND_FROM has to be on a domain verified in Resend.
- Contents
- Each email has the write-up, the brief fields, and the raw exchange.
The exchange stays in the browser until they send it. When the Langfuse keys are set, each turn is also sent there with the email masked. The email is the full copy I receive.
- Browser
- The transcript and the brief are held in the page for that visit. They are not written to the database or to local storage.
- After they send, the write-up and the exchange are in the Resend email. The page says it goes to me and to their address. It does not say how long that mail is kept.
- Counters
- Postgres stores a count of model calls, not the text. Hour rows older than 48 hours are deleted. Day rows older than 14 days are deleted.
- Traces
- LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY send each reply and each send to Langfuse in the EU. A trace has the provider, the model, the instruction version, the exchange with emails hashed, and the reply after this page's rules. The instruction text and the sent email are left out. With the keys unset, nothing is sent.
- Provider
- The browser makes a conversation id. For xAI, that id is sent as a header. The same id groups the Langfuse traces. It is not stored in Postgres.
If the model reply cannot be used, the page says to try again or email. Limits cap one browser, and the whole site.
- Failure
- A reply that cannot be read, a call cancelled after 25 seconds, or an HTTP error shows: That did not go through. Try the same line again, or email carlos@carlosnatera.com.
- Limits
- 20 messages in 10 minutes from one address, and 5 sends in an hour. The site also stops after 24 model calls in an hour and 80 in a UTC day, unless GROK_HOURLY_CAP or GROK_DAILY_CAP is set. The page then says the brief chat is paused. If Postgres is down, those site-wide caps are counted in memory for that process.
- Abuse
- A request from another site is refused. The body is limited to 24,000 bytes. A transcript is limited to 32 turns, 16 of them from the visitor. The instructions say not to store an offensive or off-topic message in the brief.
- Tests
- Vitest covers the brief rules, the model request, the chat and send routes, rate limits, and the spend caps. Saved answers for made-up visitors are checked against those rules without calling a model. A live run, started by hand, asks the model and then marks tone, the next question, conduct, secrets, and invention.
- Deployment and rollout
- This site runs on Vercel. Code reaches production when a branch is merged into main and pushed.
- Auth and secrets handling
- The brief has no login. The model and mail keys stay in the server environment. Admin sign-in is separate and does not gate the conversation.
- Testing and release checks
- Vitest covers the brief rules, the model request, the chat and send routes, rate limits, and the spend caps. Saved answers for made-up visitors are checked against those rules without calling a model. A live run, started by hand, asks the model and then marks tone, the next question, conduct, secrets, and invention.