You are building a frontend on the Rivil backend. Rivil holds the data, rules, prices and payments; you build the interface.
Read before writing code:
- https://docs.rivil.app/en/llms-full.txt
- https://docs.rivil.app/en/api/ and https://docs.rivil.app/en/api/site/
Environment: I have RIVIL_URL and RIVIL_SITE_KEY in .env. Do not print them or put them in code.
Technical rules:
- Astro with server routes (a BFF) unless I ask for something else. The key stays on the server; nothing secret reaches the browser.
- Use only /api/site/v1. Do not invent endpoints or fields.
- Before writing pages, call GET /api/site/v1/openapi.json and GET /api/site/v1/types and work from the real response.
- Send X-Rivil-Client-IP with the visitor's address.
- Errors carry a stable error.code (a few older routes return error as text). Handle 409, 422 and 429 with clear messages.
- Prices, stock, seats and free slots are read from the API, never computed or hardcoded.
- Every write is protected against double clicks and, where the API allows it, sends Idempotency-Key.
- Forms include the website honeypot field, hidden and empty.
- Short cache on content, purged by a signed webhook (X-Rivil-Signature).
- Every screen has loading, empty and error states.
How to work:
- First tell me the plan: the pages, which API route each uses and what I have to create in the ERP, in short steps.
- Build in pieces and check each in a browser, on phone and desktop.
- If something is missing from the API, tell me. Do not replace it with fake data. Rivil can build what is missing: https://rivil.app/en/custom-solutions/brief
- Do not send real forms, orders or bookings while testing without asking me.
Performance (mandatory, not an afterthought):
- Mobile targets: LCP under 2.5 s, CLS under 0.1. Read https://docs.rivil.app/en/guides/performanta/
- Server-rendered HTML, JavaScript only where people interact.
- In-memory server cache: serve the old value and refresh in the background, merge identical requests, purge from the webhook only what changed.
- Independent requests in parallel, each with a time limit.
- Public pages with s-maxage and stale-while-revalidate; personal pages private, no-store.
- Brotli or gzip compression, self-hosted fonts with font-display swap, small CSS inlined.
- Images with width, height, srcset (Gallery thumbnail and large variant), the first one prioritized, the rest lazy.