Getting Started
Prerequisites
- Node.js 18+
- npm
Setup
git clone https://github.com/jcllobet/bttprineus_embedded.git
cd bttprineus_embedded
npm installEnvironment variables
Map rendering works with no env vars. Copy .env.example to .env.local and fill in the values for analytics:
cp .env.example .env.local| Variable | Required for | Without it |
|---|---|---|
SUPABASE_URL | Analytics counters | Counters show 0 |
SUPABASE_ANON_KEY | Analytics counters | Counters show 0 |
ANALYTICS_PASSWORD | /analytics dashboard | Dashboard returns 401 |
NEXT_PUBLIC_POSTHOG_KEY | PostHog events & sessions | No PostHog events |
NEXT_PUBLIC_POSTHOG_HOST | PostHog host | Defaults to eu.posthog.com |
POSTHOG_PERSONAL_API_KEY | Dashboard (PostHog source) | Dashboard has no data |
Supabase setup
Create the analytics_events table in the Supabase SQL editor:
CREATE TABLE analytics_events (
id BIGSERIAL PRIMARY KEY,
gpx_url TEXT NOT NULL,
event TEXT NOT NULL,
event_name TEXT,
event_group TEXT,
share_channel TEXT,
ui_surface TEXT,
session_id TEXT,
referrer_host TEXT,
meta_json JSONB DEFAULT '{}',
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX idx_analytics_gpx ON analytics_events (gpx_url);
CREATE INDEX idx_analytics_created ON analytics_events (created_at);Run
npm run devOpen http://localhost:3000Â for the home page with links to all tools.
Test URLs
| Route | URL |
|---|---|
| Home | http://localhost:3000 |
| Embed | http://localhost:3000/embed?gpx=http://www.bttpirineus.org/wp-content/uploads/Falda%20Bassegoda%20i%20La%20Fau.gpx |
| Helper | http://localhost:3000/helper |
| Analytics | http://localhost:3000/analytics |
| Demo | http://localhost:3000/demo |
| Docs | http://localhost:3000/docs |
Build
npm run build
npm startDeploy
Push to GitHub — Vercel auto-deploys from main. See Deployment for full details.