Minimal flight booking prototype optimized for Vercel deployment.
- Next.js 15 (App Router, Node runtime)
- Prisma + Postgres (Vercel Postgres/Neon)
- Zod for validation
- OpenAI (optional, for assistant later)
- Install deps
pnpm install
- Run Postgres (no external account needed)
Option A — Docker (recommended):
docker compose up -d
This starts Postgres 16 on port 5432 with DB skymate and password postgres.
Option B — Local Postgres:
Create a database named skymate and ensure it is accessible on localhost:5432.
- Configure env
Copy .env.example to .env and set DATABASE_URL (Neon/Vercel Postgres). For development you can use a local Postgres too.
For Docker/local Postgres, use:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/skymate?schema=public"
- Prisma
pnpm prisma:generate
pnpm prisma:migrate --name init
- Run dev server
pnpm dev
-
POST
/api/flights/search→{ origin, destination, departDate, adults } -
GET
/api/flights/offers/:id -
POST
/api/bookings(requiresx-user-idheader and optionalIdempotency-Key) -
POST
/api/bookings/:id/cancel(requiresx-user-id) -
GET
/api/bookings?status=...&cursor=...(requiresx-user-id) -
GET
/api/bookings/:id(requiresx-user-id) -
PATCH
/api/bookings/:id(requiresx-user-id) → updatecontactand/orpassengers -
GET
/api/users/me(requiresx-user-idoruidcookie) -
PATCH
/api/users/me(requiresx-user-idoruidcookie) -
GET
/api/users/me/bookings?status=...&cursor=...(requiresx-user-idoruidcookie`) -
POST
/api/chat→ Proxies to local Ollama (llama3.2) to answer site questions.- Tools:
get_user_profile,list_user_bookings,get_next_flight,search_flights
- Tools:
For auth, this prototype uses an x-user-id header. Replace with NextAuth when ready.
- Add Vercel Postgres integration (or Neon) and set env vars:
DATABASE_URL,POSTGRES_PRISMA_URL,SHADOW_DATABASE_URL
- Add a build step that runs:
pnpm prisma:generateandpnpm prisma:deploy
- Install Ollama and pull a model (e.g.,
ollama pull llama3.2). - Start Ollama locally (defaults to
http://localhost:11434). - Optional envs:
LLM_PROVIDER(defaultollama; set toopenaito use OpenAI)LLM_MODEL(override default model for selected provider)OPENAI_API_KEY(required whenLLM_PROVIDER=openai)OLLAMA_BASE_URL(defaulthttp://localhost:11434)OLLAMA_MODEL(defaultllama3.2)
- Open
/assistantin the app to chat.
- Ollama (default): ensure local server is running; set nothing or
LLM_PROVIDER=ollama. - OpenAI: set
LLM_PROVIDER=openaiandOPENAI_API_KEY. Optionally setLLM_MODEL(e.g.,gpt-4o-mini).