Closes the funnel. Before this the product could match two people and then stopped: `quotes`, `bookings` and `reviews` had tables and state machines and nothing that wrote a row, the entry deck's right swipe was wired to an empty handler, and every address resolved to the city centre. Jobs tab and chat - message router: thread, send, markRead, unreadTotal. A thread is a MATCH, not a job — one job with three interested pros is three private conversations. - Current/Past segments derived from ACTIVE_JOB_STATUSES, job detail listing the pros who accepted, and the conversation itself with attachments. Hiring from the deck - A right swipe on the entry deck opened nothing. It now resolves "which job?" through a sheet — sign in, pick an open job, or post one — and calls the same deck.swipe the per-job deck does, so the open-request cap and row lock apply exactly once. Swipes are vetoable so closing the sheet returns the card. Geocoding - ST_Distance and ST_DWithin rank and filter every deck, and both operands were placeholders. Addresses now resolve through Mapbox (permanent=true, which is what licenses storing the coordinates), the server resolves points rather than trusting client-supplied lat/lng, and every stored point records how it was obtained. A `city`-precision base cannot reach the verification queue. Quote -> booking -> review - The commercial chain, minus payments. Accepting a quote is the only place a booking is created; confirming completion is what unlocks reviews and moves the pro's completed_jobs. - Reviews publish double-blind with no sweeper: each is written with published_at already set to its embargo deadline and every read filters published_at <= now(), so it publishes itself. The second review pulls both forward. A silent counterparty cannot bury a bad review by never replying. State machine changes, both deliberate - booked -> matched: a cancelled booking is not a cancelled job. - scheduled -> awaiting_confirmation: in_progress is optional, so a pro who never tapped Start can still say the work is done. Test suite - api tests ran files in parallel against one database and failed roughly one run in three on whichever file lost the race. Serialised, and three fixtures that grabbed "the first client" pinned to the seeded accounts. Also includes work from a parallel session: admin verification queue, pro public profile and reviews read path, notification sending, denormalised stats recompute, search, and observability. 318 tests passing; typecheck and lint clean across 7 packages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
108 lines
3.9 KiB
Bash
108 lines
3.9 KiB
Bash
# ---- Core ----
|
|
NODE_ENV=development
|
|
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
|
|
|
# ---- Database (Postgres 16 + PostGIS) ----
|
|
DATABASE_URL=postgresql://linkder:linkder@localhost:5442/linkder
|
|
|
|
# ---- Redis (pub/sub for SSE chat + BullMQ queues) ----
|
|
REDIS_URL=redis://localhost:6389
|
|
|
|
# ---- Auth.js v5 ----
|
|
# generate with: openssl rand -base64 32
|
|
AUTH_SECRET=
|
|
AUTH_URL=http://localhost:3000
|
|
# Social sign-in. Each provider is optional and independent — leave a pair
|
|
# blank and phone OTP still works. The buttons render either way and tell the
|
|
# user when a provider is not set up, so the screen never changes shape between
|
|
# environments. Set BOTH values of a pair or neither: a half-set pair is treated
|
|
# as unset (see lib/auth.ts).
|
|
#
|
|
# Authorised redirect URI: {NEXT_PUBLIC_APP_URL}/api/auth/callback/google
|
|
AUTH_GOOGLE_ID=
|
|
AUTH_GOOGLE_SECRET=
|
|
|
|
# Microsoft Entra ID (Azure AD). Register an app at
|
|
# https://entra.microsoft.com > App registrations, add a Web platform with
|
|
# redirect URI {NEXT_PUBLIC_APP_URL}/api/auth/callback/microsoft, then create a
|
|
# client secret under Certificates & secrets.
|
|
#
|
|
# TENANT_ID decides WHO may sign in and defaults to `common`:
|
|
# common work, school and personal Microsoft accounts
|
|
# organizations work and school only
|
|
# consumers personal only
|
|
# <tenant guid> one organisation only
|
|
# For a consumer marketplace `common` is almost always what you want — set the
|
|
# app registration's supported account types to match, or sign-in fails at
|
|
# Microsoft's end with AADSTS50194 no matter what is set here.
|
|
AUTH_MICROSOFT_ID=
|
|
AUTH_MICROSOFT_SECRET=
|
|
AUTH_MICROSOFT_TENANT_ID=common
|
|
|
|
# GitHub. Create an OAuth app at
|
|
# https://github.com/settings/developers > New OAuth App, with
|
|
# Authorization callback URL {NEXT_PUBLIC_APP_URL}/api/auth/callback/github.
|
|
#
|
|
# GitHub only returns a primary email if the OAuth app requests `user:email`
|
|
# AND the account has a verified one; a user whose email is private signs up
|
|
# with no address, so never assume `users.email` is reachable mail — gate
|
|
# outbound on isSyntheticEmail() from @linkder/shared, same as phone signups.
|
|
AUTH_GITHUB_ID=
|
|
AUTH_GITHUB_SECRET=
|
|
|
|
# ---- Geocoding (Mapbox) ----
|
|
# Turns a typed address into the coordinates the deck matches on. Without it,
|
|
# every job and every pro base falls back to the city centre and is stored with
|
|
# location_precision='city' — honest, but unmatched: ST_Distance measures a
|
|
# constant and ST_DWithin passes everyone.
|
|
#
|
|
# The token MUST be entitled for PERMANENT geocoding. We store the coordinates
|
|
# indefinitely because they are the matching primitive, and Mapbox's temporary
|
|
# endpoint forbids persistence — every request sets permanent=true, so a token
|
|
# without that entitlement returns 401/403 rather than silently working.
|
|
MAPBOX_TOKEN=
|
|
# ISO 3166-1 alpha-2. Bounds results to one country: "Carrer de Sants" matches
|
|
# in several places and the wrong continent is a worse answer than none.
|
|
MAPBOX_COUNTRY=es
|
|
|
|
# ---- Phone OTP (Twilio Verify) ----
|
|
TWILIO_ACCOUNT_SID=
|
|
TWILIO_AUTH_TOKEN=
|
|
TWILIO_VERIFY_SERVICE_SID=
|
|
|
|
# ---- Stripe Connect ----
|
|
STRIPE_SECRET_KEY=
|
|
STRIPE_WEBHOOK_SECRET=
|
|
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
|
|
# Platform commission in basis points (1500 = 15%)
|
|
PLATFORM_FEE_BPS=1500
|
|
|
|
# ---- Didit (ID verification) ----
|
|
DIDIT_API_KEY=
|
|
DIDIT_WORKFLOW_ID=
|
|
DIDIT_WEBHOOK_SECRET=
|
|
|
|
# ---- Cloudflare R2 (S3-compatible object storage) ----
|
|
R2_ACCOUNT_ID=
|
|
R2_ACCESS_KEY_ID=
|
|
R2_SECRET_ACCESS_KEY=
|
|
R2_BUCKET=linkder-uploads
|
|
R2_PUBLIC_URL=
|
|
|
|
# ---- Resend (transactional email) ----
|
|
RESEND_API_KEY=
|
|
EMAIL_FROM=noreply@linkder.app
|
|
|
|
# ---- Launch market (city-scoped MVP) ----
|
|
NEXT_PUBLIC_CITY_NAME=Barcelona
|
|
NEXT_PUBLIC_CITY_LAT=41.3874
|
|
NEXT_PUBLIC_CITY_LNG=2.1686
|
|
TWILIO_FROM_NUMBER=
|
|
|
|
# Dev-only fixed login (+34600000000 / code 000000). MUST stay false/unset in production.
|
|
ALLOW_DEV_LOGIN=false
|
|
|
|
# Bugsink (Sentry-compatible error tracking). Write-only ingest key, safe in the
|
|
# client bundle. Leave blank to disable reporting entirely.
|
|
NEXT_PUBLIC_SENTRY_DSN=
|