Recommended stack
Rivil is the backend. You pick the frontend: the contract is HTTP and JSON. One rule is not negotiable: the secret key stays on a server, never in the browser or inside a phone app.
Default: Astro with a BFF
Section titled “Default: Astro with a BFF”Every Rivil demo is built with Astro, using server routes (a BFF, “backend for frontend”) that hold the key and call /api/site/v1.
browser -> your site (Astro, holds the key) -> Rivil /api/site/v1Why Astro:
- pages are ready-rendered HTML, so they load fast and index well;
- server routes live in the same project, no separate backend;
- JavaScript in the browser only where you actually need it (React, Svelte, Vue or none).
Demos we built
Section titled “Demos we built”Open them and use them as a reference for what you ask your AI to build.
| Demo | What it shows | API it uses |
|---|---|---|
| Casa Lumen | Online store: catalog, cart, checkout, account, wishlist, RON and USD | shop (products, carts, orders, pages, menus) |
| Cabana Măgura | Guesthouse: rooms, availability, booking, reviews | Site content, stay, reviews, forms |
| Aer Studio | Yoga studio: appointments, subscriptions, client account | Site content, booking, account |
| Solvar | Group of companies: divisions, news, jobs with applications | Site content, careers |
| Școala Miez | Online courses: catalog, video lessons, progress, certificates | account (courses) |
| Atelierul din Curte | Events: schedule, tickets, QR codes | events, account |
| Christmas Auction Night | Charity auction: bidding from the phone, big screen in the room | auction (including a live stream) |
Two simple demos show one flow each. They are browser simulations with no API calls:
| Demo | What it shows |
|---|---|
| Cafeneaua Boabe | Stamp card: sign-up, stamps, reward and the customer record |
| Agenția Reper | Accepted quote, contract, signing on the phone and its proof |
Each brand has its own layouts, typography and copy. Only the API client is shared. Your site should look the same way: yours, not a template.
An API client in a few lines
Section titled “An API client in a few lines”// src/lib/rivil.ts - import it from server code onlyconst base = import.meta.env.RIVIL_URL // https://<erp-host>const key = import.meta.env.RIVIL_SITE_KEY
export async function rivil<T>(path: string, init: RequestInit = {}, visitorIp?: string): Promise<T> { const headers = new Headers(init.headers) headers.set('Authorization', `Bearer ${key}`) if (visitorIp) headers.set('X-Rivil-Client-IP', visitorIp) if (init.body && !(init.body instanceof FormData)) headers.set('Content-Type', 'application/json')
const res = await fetch(`${base}/api/site/v1${path}`, { ...init, headers, signal: AbortSignal.timeout(20_000) }) const data = await res.json().catch(() => null) if (!res.ok) throw new Error(data?.error?.code ?? `http_${res.status}`) return data as T}Other web frameworks
Section titled “Other web frameworks”| Stack | When to pick it | Where the key lives |
|---|---|---|
| Astro | Default: site, store, bookings, portal | server routes |
| Next.js (App Router) | Your team already works in React | Server Components, Route Handlers |
| Nuxt | Your team works in Vue | server/api |
| SvelteKit | You want little JavaScript in the browser | +page.server.ts, +server.ts |
| Remix / React Router | Many forms and mutations | loader and action |
| Laravel, Django, Rails, .NET, Go | You already have an app in them | in your app |
| WordPress | You keep the existing site | in a plugin, in PHP |
Mobile apps: any technology
Section titled “Mobile apps: any technology”For iOS and Android use whatever you know or your AI prefers. Rivil does not require an SDK.
| Technology | Good for | Keep the session in |
|---|---|---|
| Expo / React Native | Same team as the web, fast publishing | expo-secure-store |
| Flutter | One codebase, identical UI on both | flutter_secure_storage |
| Swift / SwiftUI | iOS only, as native as it gets | Keychain |
| Kotlin / Compose | Android only | Keystore |
| Kotlin Multiplatform | Shared logic, native interface | Keychain and Keystore |
| Capacitor | You have a web app and want it in the stores | a secure storage plugin |
The app never receives the secret key, because anyone can extract it from the package. Put a small server of yours in front (the same server routes as your site work):
app -> your server (holds the key) -> Rivil /api/site/v1Examples of apps you can build:
- salon or clinic client: free slots, booking, history, subscription;
- store customer: catalog, cart, orders, parcel tracking;
- event attendee: QR tickets, schedule, certificates;
- student: video lessons, progress, quizzes;
- auction bidder: the lot on screen and your bid, in real time.
See the Mobile app prompt.
What we avoid
Section titled “What we avoid”- a pure client SPA with the key in the frontend;
- the key in public variables (
PUBLIC_,NEXT_PUBLIC_,VITE_); - prices, stock or free slots computed in the frontend: always ask the API.
For AI assistants
In prompts, say it explicitly: “prefer Astro; if you use something else, the key stays on the server”. In a phone app the key does not go into the app, because it can be extracted from it. The app calls a small server of yours, which holds the key and calls Rivil.