A high-performance SvelteKit web application for visualizing GPS activities on stunning 3D terrain maps using MapLibre GL JS and PMTiles.
Ridelines Hub is the frontend component of the Ridelines ecosystem, providing an interactive 3D visualization of GPS activities. It renders cycling, running, hiking, and skiing activities on realistic terrain with smooth performance and beautiful aesthetics.
Clone and install dependencies:
git clone https://github.com/yourusername/ridelines.git
cd ridelines/hub
npm install
Start development server:
npm run dev
The application will be available at http://localhost:5173
Run tests:
npm run test:unit # Unit tests with Vitest
npm run test:e2e # E2E tests with Playwright
Command | Description |
---|---|
npm run dev |
Start development server with hot module replacement |
npm run build |
Build production-ready static site |
npm run preview |
Preview production build locally |
npm run check |
Type-check TypeScript and Svelte components |
npm run lint |
Lint code with Biome |
npm run format |
Format code with Biome |
npm run test:unit |
Run Vitest unit tests |
npm run test:e2e |
Run Playwright E2E tests |
hub/
├── src/
│ ├── lib/
│ │ ├── components/ # Reusable Svelte components
│ │ │ ├── ActivityMap.svelte # Main 3D map component
│ │ │ ├── FilterPanel.svelte # Activity type filters
│ │ │ ├── ErrorMessage.svelte # Error display
│ │ │ └── icons/ # SVG activity icons
│ │ ├── stores/ # Svelte stores for state management
│ │ │ └── activities.ts # Activity filter state
│ │ ├── types/ # TypeScript type definitions
│ │ │ └── activities.ts # Activity data types
│ │ └── constants.ts # Application constants
│ ├── routes/ # SvelteKit pages and layouts
│ │ ├── +layout.svelte # Root layout
│ │ ├── +page.svelte # Home page
│ │ └── +page.ts # Page load function
│ ├── app.d.ts # Global TypeScript declarations
│ └── app.html # HTML template
├── static/ # Static assets
├── tests/ # Test suites
│ ├── unit/ # Vitest unit tests
│ └── e2e/ # Playwright E2E tests
├── biome.jsonc # Biome configuration
├── playwright.config.ts # Playwright configuration
├── svelte.config.js # SvelteKit configuration
├── tsconfig.json # TypeScript configuration
├── vite.config.ts # Vite configuration
└── package.json # Dependencies and scripts
The application follows a component-based architecture with clear separation of concerns:
ActivityMap: Core map component handling MapLibre GL JS integration
FilterPanel: Activity filtering interface
ErrorMessage: Graceful error handling
Create a .env
file for local development:
PUBLIC_MAPLIBRE_STYLE_URL=https://your-style-url
PUBLIC_ACTIVITIES_URL=https://your-cloudfront-distribution/activities.pmtiles
The map is configured in ActivityMap.svelte
with:
The application expects PMTiles containing GeoJSON LineString features with these properties:
interface ActivityProperties {
activity_type: 'Ride' | 'Run' | 'Walk' | 'Hike' | 'AlpineSki' | 'Other';
start_date_local: string; // ISO 8601 format
distance: number; // meters
elapsed_time: number; // seconds
}
Activity | Color | Hex |
---|---|---|
Ride | Blue | #0066ff |
Run | Green | #00aa00 |
Walk | Orange | #ff8800 |
Hike | Brown | #aa6600 |
AlpineSki | Purple | #aa00ff |
Other | Gray | #888888 |
npm run test:unit
Tests cover:
npm run test:e2e
Tests cover:
The application is packaged as a static site and deployed via the Frame infrastructure:
The build creates a static site in the build/
directory:
build/
├── _app/ # JavaScript and CSS bundles
├── index.html # Pre-rendered HTML
└── [other assets] # Fonts, images, etc.
npm run check
to validate typesEnable debug logging in the browser console:
localStorage.debug = 'ridelines:*'
We welcome contributions! Please:
MIT License - see the LICENSE file for details.