How it’s built
The diagram
The visitor only talks to my site. It is the site’s server, not the browser, that calls the API with a key, and the API refuses any call that doesn’t carry one. Both demos, the estimator and the “Ask my portfolio” assistant, follow this same diagram, each with its own API and its own key.
- BrowserThe form. No secret: it only talks to the site.
- SiteAstro on Vercel: pre-generated pages, plain TypeScript.
- Site routeA Vercel function: it re-reads the request and adds the API key.
- APIFastAPI in Docker, behind Caddy (HTTPS). Refuses any call without a key.
- DataEstimator: scikit-learn models and DVF sales. Assistant: an index of my READMEs and a language model.
The stack
- The site: Astro, plain TypeScript with no library in the browser, hosted on Vercel.
- The routes: five server routes, in the same Astro project: three for the estimator, two for the assistant.
- The APIs: FastAPI (Python). The estimator’s relies on scikit-learn and pandas for its models; the assistant’s, on an index of passages and a language model called through OpenRouter.
- The server: an Ubuntu VPS, Docker Compose, Caddy for HTTPS.
- Continuous integration: GitHub Actions (style, tests, Docker image, site build) and Dependabot.
The choices that matter
- A route on the site rather than a direct call. A key written in a web page would be readable by all its visitors. The site’s server keeps it, re-reads every field it receives, refuses requests coming from another site and passes on the visitor’s IP address, so that the API’s request limit applies to each visitor and not to Vercel as a whole.
- No request logs. A request contains the position of a property, which is personal data. The API doesn’t log it and the route never writes it: the coordinates travel in a POST, not in a page address that hosts keep. Questions put to the assistant are not logged either; they are, however, sent to the language-model provider, which writes the answer.
- Audience measurement, and nothing else. The site counts its visits with Vercel Web Analytics: for each page view, the page address, the referring site, the approximate location, the system, the browser and the device type. No third-party cookies, no tracking across sites, and nothing typed into the demos: that data only goes through the routes described above.
- Docker and Caddy. With Docker, the same image runs on my machine and on the server, with nothing to install by hand. With Caddy, the HTTPS certificate is obtained and renewed on its own, and it is the only entry point: the API is not published anywhere.
- A static site. Pages are generated at build time: they are fast, and there is nothing to watch over. Only five small routes run on each call.
The model’s figures
I don’t copy them here, because they change with every training. The error of each method, the training date and the model version are read live from the API and shown in “Under the hood” of the estimator. The code, the tests and the evaluation method are in the API’s repository. The sales come from the property transaction records (DVF), published by the French state on data.gouv.fr under the Licence Ouverte 2.0.
What is left to do
- Plug an external monitor into the API’s health check.
- Deploy the API automatically after passing tests.
- Add a plain-language explanation of each estimate by an LLM, which will put the model’s numbers into words without ever producing them.