Let the URL describe the reader state
The language is stored in the lang query parameter; supported values are en, fr, and ar, and an unsupported or missing value falls back to English. useLang reads that value from the current route and changes it with router.push while preserving other query parameters. Category and page also live in the URL, so a filtered list can be refreshed or shared.
The index requests 30 articles at a time and converts the page number to an API offset. Selecting a category clears the page number so the user does not land on an empty later page. The default layout sets the document language and switches dir to rtl for Arabic. UI labels come from a small translation dictionary; article translations come from the pipeline and database, which are separate localization problems.
Put the API boundary on the server
Nuxt pages request same-origin /api routes. The Nitro handler removes the /api prefix, forwards query parameters to NUXT_API_BASE, and returns the upstream data. Because the handler runs on the server, the internal Compose hostname does not need to be exposed to the browser.
The proxy permits only GET and HEAD and returns 404 for paths beginning with /ingest. This is a narrow defense-in-depth boundary: the browser has no ingest token, and the token-protected POST endpoint is not forwarded. It does not make the read API private; article and search data are intentionally available to readers.
if (event.method !== 'GET' && event.method !== 'HEAD') {
throw createError({ statusCode: 405, statusMessage: 'Read-only API proxy' })
}
if (path.startsWith('/ingest')) {
throw createError({ statusCode: 404, statusMessage: 'Not found' })
}The pages are views over API contracts
The home page combines the article endpoint with category counts, then renders cards and URL-driven pagination. An article page asks for one ID in the selected language and displays its source, date, summary, body, and QA score. Search displays both the returned answer and its hits. The stats page summarizes counts and evaluation scores returned by the API.
Some details matter when interpreting those screens. The API returns available_langs for an article, but the current language switcher always offers all three configured languages; if a row is absent, the backend falls back to the original source fields. The per-day target shown by stats is a fixed value in the API, not a measured ingestion rate. These are useful reminders to distinguish a display value from an observed metric.
A boundary, not a complete security model
The proxy prevents the frontend from becoming an ingest client, but it is not user authentication, rate limiting, or abuse prevention for public reads. The pipeline binds to localhost on the host in the supplied Compose file while the web service is exposed on its application port. Production deployment would need an explicit threat model, secrets policy, rate limits, and service health strategy.
The final note looks at the evidence developers can use to judge whether a change improved the system: traces, offline experiments, automated tests, and the limits of each.