Skip to Content
Getting Started

Getting Started

Prerequisites

  • Node.js 18+
  • npm

Setup

git clone https://github.com/jcllobet/bttprineus_embedded.git cd bttprineus_embedded npm install

Environment 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
VariableRequired forWithout it
SUPABASE_URLAnalytics countersCounters show 0
SUPABASE_ANON_KEYAnalytics countersCounters show 0
ANALYTICS_PASSWORD/analytics dashboardDashboard returns 401
NEXT_PUBLIC_POSTHOG_KEYPostHog events & sessionsNo PostHog events
NEXT_PUBLIC_POSTHOG_HOSTPostHog hostDefaults to eu.posthog.com
POSTHOG_PERSONAL_API_KEYDashboard (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 dev

Open http://localhost:3000  for the home page with links to all tools.

Test URLs

RouteURL
Homehttp://localhost:3000
Embedhttp://localhost:3000/embed?gpx=http://www.bttpirineus.org/wp-content/uploads/Falda%20Bassegoda%20i%20La%20Fau.gpx
Helperhttp://localhost:3000/helper
Analyticshttp://localhost:3000/analytics
Demohttp://localhost:3000/demo
Docshttp://localhost:3000/docs

Build

npm run build npm start

Deploy

Push to GitHub — Vercel auto-deploys from main. See Deployment for full details.