Configuration Guide
Sightline is configured through a single file: map.config.ts in your project root. This guide covers all configuration options in detail.
Configuration Structure
import type { MapConfig } from './src/core/config';
const config: Partial<MapConfig> = {
branding: { /* ... */ },
dataSources: [ /* ... */ ],
map: { /* ... */ },
controls: { /* ... */ },
theme: { /* ... */ },
features: { /* ... */ },
};
export default config;Branding
Customize the look and identity of your Sightline instance.
branding: {
// Display name shown in the header
name: 'My Sightline Instance',
// Description shown in metadata and tooltips
description: 'Track incidents in my region',
// Logo displayed in header (optional)
logo: '/logo.png',
// Favicon for browser tab (optional)
favicon: '/favicon.ico',
// Open Graph image for social sharing (1200x630px recommended)
ogImage: '/og-image.png',
// Primary accent color (CSS color value)
primaryColor: '#3b82f6',
// Social links displayed in footer
social: {
github: 'https://github.com/your-org/your-repo',
twitter: 'https://twitter.com/your-handle',
website: 'https://your-website.com',
},
}For SEO, also set NEXT_PUBLIC_FAVICON and NEXT_PUBLIC_OG_IMAGE environment variables.
Data Sources
Configure where your incident data comes from. Sightline supports multiple simultaneous data sources.
dataSources: [
{
// Unique identifier for this source
id: 'my-source',
// Display name in source toggle
name: 'My Data Source',
// Optional description
description: 'Incidents from our database',
// Marker color for this source (CSS color)
color: '#3b82f6',
// Adapter type: 'static' | 'supabase' | 'api'
adapter: 'static',
// Adapter-specific configuration
adapterConfig: {
path: '/data/incidents.json',
},
// Whether this source is enabled by default
enabled: true,
// Filter visibility for this source (optional)
filterVisibility: {
showQuickFilters: true,
showDetectionMethods: true,
// ... see Filter Visibility section
},
},
]Static Adapter
Load incidents from a JSON file in public/data/.
{
adapter: 'static',
adapterConfig: {
path: '/data/incidents.json',
},
}Supabase Adapter
Connect to a Supabase database.
{
adapter: 'supabase',
adapterConfig: {
// Uses environment variables by default:
// NEXT_PUBLIC_SUPABASE_URL
// NEXT_PUBLIC_SUPABASE_ANON_KEY
// Optional: override URL/key for this source
url: 'https://your-project.supabase.co',
anonKey: 'your-anon-key',
},
}API Adapter
Fetch from a REST API endpoint.
{
adapter: 'api',
adapterConfig: {
endpoint: 'https://api.example.com/incidents',
apiKey: process.env.API_KEY,
headers: {
'X-Custom-Header': 'value',
},
},
}Map Settings
Configure the Mapbox map appearance and behavior.
map: {
// Initial center coordinates [longitude, latitude]
center: [-98.5795, 39.8283],
// Initial zoom level (0-22)
zoom: 4,
// Min/max zoom bounds
minZoom: 1,
maxZoom: 18,
// Map styles (Mapbox style URLs)
style: 'mapbox://styles/mapbox/dark-v11',
lightStyle: 'mapbox://styles/mapbox/light-v11',
darkStyle: 'mapbox://styles/mapbox/dark-v11',
// Clustering configuration
clustering: {
// Mode: 'mapbox' | 'react' | 'none'
mode: 'react',
// Cluster radius in pixels
radius: 50,
// Max zoom for clustering (clusters expand above this)
maxZoom: 14,
// Mapbox-specific styling (when mode is 'mapbox')
mapboxStyle: {
colors: {
small: '#3b82f6', // < 10 incidents
medium: '#f97316', // 10-100 incidents
large: '#ef4444', // > 100 incidents
},
sizes: {
small: 20,
medium: 30,
large: 40,
},
textColor: '#ffffff',
textSize: 12,
strokeColor: 'rgba(255,255,255,0.3)',
strokeWidth: 2,
},
},
}Clustering Modes
| Mode | Best For | Customization |
|---|---|---|
mapbox | Large datasets (1000+ points) | Limited (colors, sizes) |
react | Custom visualizations | Full (custom components) |
none | Small datasets (< 100 points) | N/A |
Controls
Enable/disable and position UI controls.
controls: {
// Timeline playback at bottom
timeline: {
enabled: true,
position: 'bottom',
},
// Filter sidebar
filters: {
enabled: true,
position: 'sidebar',
},
// Stats panel (incident counts)
stats: {
enabled: true,
position: 'top-right',
},
// Data source toggle
sourceToggle: {
enabled: true,
},
// Map legend
legend: {
enabled: true,
position: 'bottom-right',
},
// Incident feed sidebar
incidentFeed: {
enabled: true,
position: 'sidebar',
initialCount: 20,
pageSize: 10,
sortBy: 'date', // 'date' | 'distance' | 'sensitivity'
sortDirection: 'desc', // 'asc' | 'desc'
},
}Theme
Configure light/dark mode behavior.
theme: {
// Default theme: 'light' | 'dark' | 'system'
defaultTheme: 'system',
// Allow users to change theme
allowToggle: true,
// Show theme toggle in UI
showToggle: true,
// Toggle button position
togglePosition: 'top-right',
}Features
Enable/disable optional features.
features: {
// Allow users to add custom data sources
allowCustomSources: false,
// Show Mapbox attribution
showAttribution: true,
// Enable keyboard shortcuts
keyboardShortcuts: true,
}Filter Visibility
Control which filters appear for each data source. This is useful for use-case specific configurations.
filterVisibility: {
// Quick filter toggles
showQuickFilters: true,
// Classification filters
showIncidentType: true,
showHynekClassification: true,
showValleeClassification: true,
showExplanationStatus: true,
// Evidence filters
showDetectionMethods: true,
showEvidenceTypes: true,
// Investigation filters
showInvestigationStatus: true,
showInvestigatingBodies: true,
// Object filters
showObjectShapes: true,
// Location filters
showLocationSensitivity: true,
showCountry: true,
showSiteType: true,
}Environment Variables
Some configuration can also be set via environment variables:
| Variable | Purpose |
|---|---|
NEXT_PUBLIC_MAPBOX_TOKEN | Mapbox access token (required) |
NEXT_PUBLIC_SUPABASE_URL | Supabase project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY | Supabase anonymous key |
NEXT_PUBLIC_SITE_NAME | Site name override |
NEXT_PUBLIC_FAVICON | Favicon path |
NEXT_PUBLIC_OG_IMAGE | OG image path |
Complete Example
See the default map.config.ts for a complete working example with all use case templates configured.