Paisaxe - Look. Ask. Discover.
An AI-powered tourism experience for Asturias, Spain. Explore the region through immersive visual stories and ask questions via voice or text to discover landscapes, local gastronomy, hiking routes, and more.
"Paisaxe" means "landscape" in Asturian (Bable), the traditional language of the region.
Features
- Immersive Visual Stories: Full-screen carousel showcasing Asturias' landscapes, cities, and culture
- AI-Powered Chat: Ask questions about any location and get contextual answers with source references
- Voice Input: Speech recognition for hands-free questions
- Voice Agents: AI-powered conversational guides via ElevenLabs for immersive storytelling
- Multilingual: UI in Spanish; chat responds in the visitor's language
- Curated Content: Information sourced from 37 official Asturias tourism guides
- User Favorites: Save and revisit stories you love (Google OAuth)
- Admin Panel: Content curation and feature flag management
- Real-time Updates: Live content sync via Supabase Realtime
- Analytics: Visitor interaction tracking
Hackathon: booking local experiences through conversation (PayPal AI Hackathon)
During the PayPal AI Hackathon, Paisaxe gained a booking flow for local experiences. Visitors describe in the text chat how many people are going, the date, their budget and any needs (for example, step-free access). The assistant compares that with the provider's catalog and its stated facts. Then it makes an explicit offer, holds a place when the visitor accepts, and takes a deposit through PayPal (sandbox). Visitors can see and cancel the booking afterwards. The decision is recorded in ADR-0024, and the implementation follows the plan and its notes (deviations, reviews and evidence for each phase).
What it does
- Conversational booking.
POST /api/booking/chat/streamruns Claude with tools:search_experiences,update_booking_draft,get_quote,create_payment_order,get_booking_statusandpreview_cancellation. Tools take ids, not amounts. Every price comes from the database, inputs are validated with zod, and ownership is checked on the server. A visitor need is judged supported, unsupported or unknown from the provider's facts. The assistant may not claim that an unknown is suitable. - Money moves only on a button. Accepting an offer, paying and confirming a cancellation are buttons. The model cannot call them, and a typed "I accept" or "cancel it" does nothing by itself.
- PayPal deposit. Orders are created through the official PayPal Server SDK
(
@paypal/paypal-server-sdk2.5.0, built with the PayPal Context Plugin; see docs/hackathon/apimatic.md) with an idempotency key, and the buyer approves by redirect. A single capture path is shared by the return page, theCHECKOUT.ORDER.APPROVEDwebhook and a reconciliation cron that runs every 5 minutes, so a buyer who approves and closes the browser is still confirmed. Webhooks are signature-verified and stored in an inbox, so a failed event is retried. A capture that cannot be honoured is refunded exactly once. - Capability links. Each booking has a link
/booking/<id>.<token>, an HMAC that can be rebuilt and revoked. The link alone opens the booking: status, payment, cancellation. Tokens never reach the model and are redacted from PostHog, Sentry and Vercel Analytics. - Voucher access. New bookings are invisible to ordinary visitors.
/accesoredeems a voucher code with a Supabase anonymous session, so no account is needed. Every booking-start route answers 404 without an active redemption, while theexperience_bookingflag is off, or on a Vercel Preview. Each redemption is metered (60 chat turns and 10 booking attempts by default). A voucher may also grant a 24-hour pass for the existing voice guide. - Cancellation. A preview computes the refund and writes nothing: the full deposit up to 24 hours before the start, nothing after. Confirming sends the amount that was shown. The server recomputes it under a row lock and refuses with the new terms if they changed. Then it refunds the deposit through PayPal, or cancels without a refund after the cutoff.
- Operator view.
/operator/<id>.<token>is a capability link for the merchant. It shows upcoming and recent bookings, deposits collected, the balance due, exceptions, active holds (with a release action), free places for 14 days, and a link re-issue for a booking. It also checks each deposit against PayPal's own records (Transaction Search, read-only): "PayPal confirma", "Reembolso en PayPal", or "Pendiente en PayPal" while PayPal has not listed it yet. This view is in Spanish. - Postman collection.
docs/hackathon/postman/walks the same journey over HTTP, including the negative cases.
Fixture merchant and sandbox labels
The catalog belongs to a fictitious merchant, "Rutas del Sella (demo, ficticio)"
(merchants.is_fixture = true). It is seeded by migration
116_operator_access_and_fixture.sql with three experiences, available every day at 10:00
and 16:00 (Madrid time), 12 places per slot, all prices for one party:
| Experience | Price | Deposit | Max party | Step-free access (provider fact) |
|---|---|---|---|---|
| Paseo por la senda costera (coastal walk) | €120 | €30 | 6 | yes |
| Descenso en canoa (canoe descent) | €60 | €15 | 4 | no |
| Ruta de miradores en 4x4 (4x4 viewpoint route) | €200 | €50 | 6 | unknown (not confirmed) |
Every booking card carries a "Demo" badge, and the payment card says "PayPal sandbox: test payment, no real money". The operator view marks the merchant "demo". No real provider takes part, and none is implied.
Run it from a fresh clone (local only)
Everything below runs on your machine against a local Docker Supabase. Never point these steps at a production project.
Required: Node.js 24, npm, Docker. Optional: an Anthropic API key (needed only for the chat itself; the Postman run below does not need it), a Voyage AI key (guide context in the chat; skipped without one), and your own PayPal sandbox app (instead of the local PayPal mock).
-
Install and start the local database:
git clone https://github.com/juan294/paisaxe.git && cd paisaxe npm install npx supabase start -x vector,logflare # the vector container is unhealthy on some machines npx supabase db reset # re-applies every migration, including 112-124Migrations 112 to 124 create the booking schema, the fixture merchant and the operator row. They also turn the
experience_bookingflag on for thedevelopmentenvironment (it is off forproduction). Local anonymous sign-ins are on insupabase/config.toml. -
Environment variables. The template is
.env.example. For the booking flow the app needs:Variable Local value NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_ANON_KEY,SUPABASE_SERVICE_KEYAPI_URL,ANON_KEYandSERVICE_ROLE_KEYfromnpx supabase status -o envBOOKING_LINK_SECRETany random value of at least 32 bytes, e.g. openssl rand -base64 48PAYPAL_CLIENT_ID,PAYPAL_CLIENT_SECRET,PAYPAL_API_BASEthe mock: local-mock,local-mock,http://127.0.0.1:4010. Your sandbox app: its credentials andhttps://api-m.sandbox.paypal.com(the only non-loopback host the adapter accepts)PAYPAL_WEBHOOK_IDoptional; the id of a sandbox webhook that reaches your machine through a tunnel. Without it, the return page and reconciliation still confirm payments ANTHROPIC_API_KEYoptional; needed for the booking chat -
Reproduce the whole journey with the Postman collection, Newman and the PayPal mock. In three terminals, follow docs/hackathon/postman/README.md:
npx tsx scripts/booking/postman-local.ts # 1: PayPal mock, flag on, a local voucher # 2: next dev on port 3006 with only the local variables (exact command in that README) npx --yes newman@6 run docs/hackathon/postman/paisaxe-booking.postman_collection.json \ -e "$TMPDIR/paisaxe-postman/paisaxe-booking.local.postman_environment.json" # 3The run redeems a voucher, accepts a quote, pays the deposit, confirms the booking, cancels it with a refund, and checks the 404, 409 and webhook cases. Its last recorded run is in
run-2026-10-03-local.md. To use your own PayPal sandbox instead of the mock, follow the approval step in the same README. -
Issue vouchers and operator links for your local stack (both scripts target local by default; production needs
--target production --yes-productionand the owner):npx tsx scripts/booking/create-voucher.ts --label local-test BOOKING_LINK_SECRET=<the server's secret> \ npx tsx --conditions=react-server scripts/booking/create-operator-link.ts --merchant demo-rutas-del-sella -
Tests:
npm run testruns the unit suites. The live database suites (*.postgrest-integration.test.ts) run when the local stack is up and skip otherwise.npm run eval:bookingruns the six-scenario model evaluation against the local stack. It reads onlyANTHROPIC_API_KEY: from the environment (ANTHROPIC_API_KEY=… npm run eval:booking), else from$HOME/code/paisaxe/.env.local. Its results are indocs/hackathon/evaluation/.
next dev rewrites AGENTS.md; restore it with git checkout -- AGENTS.md.
What changed during the hackathon
The baseline is commit d368b2b3 (1 October 2026). git log d368b2b3.. lists every
change since then. The booking feature is the bulk of it:
- Phase 0: ADR-0024, the release-checklist rulings, and spikes for the PayPal sandbox cycle and SDK tool streaming.
- Phase 1: migrations 112 to 117, covering the booking schema, the atomic
accept_quote, availability with one inventory owner, provider facts, the fixture merchant and the flag. - Phase 2: the voucher gate (
/acceso,redeem_voucher), anonymous guest sessions, metering and Preview isolation. - Phase 3: the booking chat route, the tool loop, the cards and the
?booking=1text entry. - Phase 4: the PayPal adapter, the single capture path, the booking and return pages, capability links with telemetry redaction, the webhook inbox and the reconciliation cron.
- Phase 5: cancellation (preview and confirm), the operator view and the Postman collection.
- Phase 6: this section, the
LICENSEfile, the review-workflow author check and the release probes.
The same range also contains unrelated maintenance: dependency updates, a database security fix (migration 110), the RAG embedding-model fix and migration 111, CI pinning, and the removal of the tourism guide PDFs from the repository.
Known limitations
- Sandbox only, one fictitious merchant. No real money moves. Bookings are for one party, in EUR. The deposit is taken now; the balance is due on the day and is not collected by the app. There is no multi-merchant onboarding, commission or payout.
- Booking is text only. The voice guide is the existing discovery guide and cannot book.
- A normal local browser cannot run the booking flow. The site's Content Security
Policy allows Supabase only at
https://*.supabase.co, so a browser cannot reachhttp://127.0.0.1:54321. Locally, the journey is reproduced over HTTP (Postman/Newman), by the test suites, and by thebooking-roundtripPlaywright probe, which runs it in a browser with the CSP bypassed for that test only. - Voice minutes are not metered. The redemption cap limits distinct guests, and the
voice-session rate limit bounds session starts, not minutes. The only real stop is the
ElevenLabs workspace limit, so vouchers can be issued without the voice pass
(
--no-voice). - Guest identity is the browser session. If both the booking link and the anonymous session are lost, only the operator can re-issue the link. The assistant can show the link again only while the session lasts.
- Refusals in the compensation path. A refund that PayPal refuses outright, when a payment that could not be honoured is being refunded, is retried by reconciliation instead of stopping. The booking is already flagged for attention and visible to the operator. Refunds for cancellations stop on a definitive refusal.
- Webhook coverage.
PAYMENT.CAPTURE.PENDINGandPAYMENT.CAPTURE.DENIEDare handled but were not observed in the sandbox. Events that match no payment (for example, from another environment sharing the sandbox app) stay in the inbox and are not replayed. Reconciliation queries every open payment directly, so no payment depends on them. - Demo-scale queries. A search without a date makes 7 availability calls per experience, and the operator view makes 14 per active experience.
- Platform request logs contain capability paths. Analytics and error tracking redact them; the hosting provider's own logs are private to the owner.
- Smaller accepted residuals. A retried acceptance of the same offer spends one of the 10 booking attempts. A 6-character booking reference could collide; the unique constraint rejects the duplicate. If creating a new quote version fails, the draft has no open offer until the visitor asks again.
Tech Stack
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router) |
| Language | TypeScript (strict mode) |
| Styling | Tailwind CSS 4 + shadcn/ui |
| Database | Supabase (PostgreSQL + pgvector) |
| AI Chat | Claude API (Anthropic) |
| Embeddings | Voyage AI (voyage-3.5, 512 dims) |
| Reranking | Voyage AI (rerank-2.5) |
| Voice Agents | ElevenLabs Conversational AI |
| Auth | Google OAuth via Supabase Auth |
| Testing | Vitest + React Testing Library + Playwright |
| Deployment | Vercel |
| Monitoring | Upptime + Vercel Speed Insights |
| Logging | Pino (structured JSON) + Sentry (error tracking) |
| Cache | Upstash Redis (embedding cache, rate limiting) |
Getting Started
Prerequisites
- Node.js 24+ (LTS)
- npm
- Supabase account
- Anthropic API key
- Voyage AI API key
- ElevenLabs API key (optional, for voice agents)
Installation
-
Clone the repository:
git clone https://github.com/juan294/paisaxe.git cd paisaxe -
Install dependencies:
npm install -
Copy the environment template:
cp .env.example .env.local -
Configure your environment variables in
.env.local:# AI Services ANTHROPIC_API_KEY= VOYAGE_API_KEY= ELEVENLABS_API_KEY= # Voice agents (optional) # Supabase NEXT_PUBLIC_SUPABASE_URL= NEXT_PUBLIC_SUPABASE_ANON_KEY= SUPABASE_SERVICE_KEY= # Admin ADMIN_SECRET_KEY= # Google OAuth GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= # Webhooks WEBHOOK_SECRET= # Site URL NEXT_PUBLIC_SITE_URL=http://localhost:3000 -
Set up the database:
- Create a Supabase project
- Enable the pgvector extension
- Run the migrations in
supabase/migrations/(96 migration files)
-
Seed the database with tourism content:
npm run process-pdfs # Extract content from PDFs npm run extract-images # Extract images from PDFs npm run seed-all # Seed images + embeddings -
Start the development server:
npm run dev -
Open http://localhost:3000 in your browser.
Scripts
Development
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Create production build |
npm run build:analyze |
Create a webpack analyzer build and write bundle reports under .next/analyze/ |
npm run start |
Start production server |
npm run lint |
Run ESLint for src/ and TypeScript scripts |
npm run lint:scripts |
Run ESLint for scripts/ |
npm run typecheck |
Run TypeScript checks for app, scripts, E2E, and Edge functions |
npm run check-verification-coverage |
Verify CI/package wiring for non-src and live-gate coverage |
Testing
| Command | Description |
|---|---|
npm run test |
Run unit & component tests (Vitest) |
npm run test:watch |
Watch mode |
npm run test:coverage |
Generate coverage report |
npm run test:ui |
Open Vitest UI |
npm run test:e2e |
Run E2E tests (Playwright, headless) |
npm run test:e2e:ui |
Playwright UI mode |
npm run test:e2e:headed |
Run with visible browser |
npm run test:e2e:debug |
Debug mode with inspector |
npm run test:e2e:stripe |
Run real Stripe test-mode checkout integration (requires Stripe/Supabase QA env vars) |
npm run prelaunch:live |
Run launch-critical live integration gate; fails instead of skipping missing credentials |
Data Pipeline
| Command | Description |
|---|---|
npm run process-pdfs |
Extract text content from PDFs |
npm run extract-images |
Extract images from PDFs |
npm run generate-stories |
Generate story definitions |
npm run seed-db |
Generate embeddings and populate DB |
npm run seed-db:clear |
Clear and re-seed embeddings |
npm run seed-images |
Seed extracted images to DB |
npm run seed-images:clear |
Clear and re-seed images |
npm run seed-all |
Seed images + embeddings |
npm run seed-all:clear |
Clear and re-seed everything |
Project Structure
paisaxe/
├── e2e/ # Playwright E2E tests
│ ├── fixtures/ # Mock data for E2E
│ └── *.spec.ts # Test files
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── page.tsx # Redirects to /immersive
│ │ ├── layout.tsx # Root layout
│ │ ├── admin/ # Admin panel
│ │ ├── auth/ # OAuth callback
│ │ ├── favorites/ # User favorites page
│ │ ├── immersive/ # Immersive stories page
│ │ ├── story/ # Individual story pages
│ │ └── api/
│ │ ├── chat/ # Chat endpoint
│ │ ├── health/ # Health check (uptime monitoring)
│ │ └── webhooks/ # Supabase webhook receiver
│ ├── components/
│ │ ├── a11y/ # Accessibility components
│ │ ├── admin/ # Admin panel components
│ │ ├── auth/ # Authentication UI
│ │ ├── immersive/ # Story viewer & voice chat
│ │ ├── seo/ # SEO components
│ │ └── ui/ # shadcn/ui components
│ ├── config/ # Feature configuration
│ │ └── elevenlabs-agents.ts # Voice agent IDs
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities & API clients
│ │ └── i18n/ # Internationalization
│ └── types/ # TypeScript definitions
├── content/
│ └── pdfs/ # Source tourism guides (not tracked; see Content Sources)
├── scripts/ # Da