diff --git a/CLAUDE.md b/CLAUDE.md index ddfcb10..41ff37c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -86,11 +86,11 @@ npm run test:coverage Before running the application, you must configure environment variables: ```bash cp .env.example .env -# Edit .env to add your MapBox token and admin password +# Edit .env to add your Mapbox token and admin password ``` Required environment variables: -- `MAPBOX_ACCESS_TOKEN`: MapBox API token for geocoding and static map generation (get free token at https://account.mapbox.com/access-tokens/) +- `MAPBOX_ACCESS_TOKEN`: Mapbox API token for geocoding and static map generation (get free token at https://account.mapbox.com/access-tokens/) - **Important**: For server-side static map generation, use an unrestricted token (no URL restrictions) - `ADMIN_PASSWORD`: Password for admin panel access at /admin - `PORT`: Server port (default: 3000) @@ -143,11 +143,11 @@ The application uses progressive enhancement to work with and without JavaScript **JavaScript-Enhanced Experience:** - **public/app.js**: Main implementation using Leaflet.js - - Auto-detects available geocoding services (MapBox preferred, Nominatim fallback) + - Auto-detects available geocoding services (Mapbox preferred, Nominatim fallback) - Interactive map with real-time updates - Autocomplete and form validation -- **public/app-mapbox.js**: MapBox GL JS implementation for enhanced features +- **public/app-mapbox.js**: Mapbox GL JS implementation for enhanced features - **public/app-google.js**: Google Maps implementation (alternative) - **public/admin.js**: Admin panel functionality - **public/utils.js**: Shared utilities across implementations @@ -161,7 +161,7 @@ The application uses progressive enhancement to work with and without JavaScript ### API Endpoints **Public endpoints:** -- `GET /api/config`: Returns MapBox token for frontend geocoding +- `GET /api/config`: Returns Mapbox token for frontend geocoding - `GET /api/locations`: Active locations (< 48 hours old or persistent) - `POST /api/locations`: Submit new location report (rate limited: 10/15min per IP) - **Input Validation:** Address ≀500 chars, Description ≀1000 chars, coordinate validation diff --git a/README.md b/README.md index 5dc9f06..4d6d2f2 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A community-driven web application for tracking winter road conditions and icy h ## Features - πŸ—ΊοΈ **Interactive Map** - Real-time location tracking centered on Grand Rapids -- ⚑ **Fast Geocoding** - Lightning-fast address lookup with MapBox API +- ⚑ **Fast Geocoding** - Lightning-fast address lookup with Mapbox API - 🚫 **JavaScript-Free Mode** - Complete functionality without JavaScript via server-side rendering - πŸ–ΌοΈ **Static Maps** - Auto-generated Mapbox static images for non-JS users - πŸ”„ **Auto-Expiration** - Reports automatically removed after 48 hours @@ -19,7 +19,7 @@ A community-driven web application for tracking winter road conditions and icy h ### Prerequisites - Node.js 18+ -- MapBox API token (free tier available) +- Mapbox API token (free tier available) - **Important**: For server-side static maps, use an unrestricted token (no URL restrictions) ### Local Development @@ -39,7 +39,7 @@ A community-driven web application for tracking winter road conditions and icy h 3. **Configure environment variables:** ```bash cp .env.example .env - # Edit .env with your MapBox token + # Edit .env with your Mapbox token ``` 4. **Start the server:** @@ -103,7 +103,7 @@ ADMIN_PASSWORD=your_secure_password PORT=3000 ``` -**MapBox Token Requirements:** +**Mapbox Token Requirements:** - For interactive geocoding: Token can have URL restrictions - For server-side static maps: Must use unrestricted token (no URL restrictions) - Recommended: Use one unrestricted token for both features @@ -178,7 +178,7 @@ Interactive API documentation available at `/api-docs` when running the server. - **Frontend:** Progressive Enhancement (Vanilla JavaScript + Server-side rendering) - **Enhanced:** Leaflet.js interactive maps with real-time updates - **Fallback:** Server-side HTML tables with static Mapbox images -- **Geocoding:** MapBox API (with Nominatim fallback) +- **Geocoding:** Mapbox API (with Nominatim fallback) - **Maps:** Leaflet.js (interactive) + Mapbox Static Images API (server-side) - **Security:** Rate limiting, input validation, authentication - **Testing:** Jest, TypeScript, 128+ tests with 76% coverage diff --git a/src/routes/config.ts b/src/routes/config.ts index ab738d6..f4d14e9 100644 --- a/src/routes/config.ts +++ b/src/routes/config.ts @@ -10,7 +10,7 @@ export default (): Router => { * tags: * - Public API * summary: Get API configuration - * description: Returns public API configuration including MapBox access token for geocoding + * description: Returns public API configuration including Mapbox access token for geocoding * responses: * 200: * description: API configuration retrieved successfully @@ -20,12 +20,12 @@ export default (): Router => { * $ref: '#/components/schemas/ApiConfig' * examples: * with_mapbox: - * summary: Configuration with MapBox token + * summary: Configuration with Mapbox token * value: * mapboxAccessToken: "pk.eyJ1IjoiZXhhbXBsZSIsImEiOiJhYmNkZWZnIn0.example" * hasMapbox: true * without_mapbox: - * summary: Configuration without MapBox token + * summary: Configuration without Mapbox token * value: * mapboxAccessToken: null * hasMapbox: false @@ -40,11 +40,11 @@ export default (): Router => { console.log('πŸ“‘ API Config requested'); const MAPBOX_ACCESS_TOKEN: string | undefined = process.env.MAPBOX_ACCESS_TOKEN || undefined; - console.log('MapBox token present:', !!MAPBOX_ACCESS_TOKEN); - console.log('MapBox token starts with pk:', MAPBOX_ACCESS_TOKEN?.startsWith('pk.')); + console.log('Mapbox token present:', !!MAPBOX_ACCESS_TOKEN); + console.log('Mapbox token starts with pk:', MAPBOX_ACCESS_TOKEN?.startsWith('pk.')); res.json({ - // MapBox tokens are designed to be public (they have domain restrictions) + // Mapbox tokens are designed to be public (they have domain restrictions) mapboxAccessToken: MAPBOX_ACCESS_TOKEN || null, hasMapbox: !!MAPBOX_ACCESS_TOKEN // SECURITY: Google Maps API key is kept server-side only diff --git a/src/swagger.ts b/src/swagger.ts index 0c6d4d5..67279db 100644 --- a/src/swagger.ts +++ b/src/swagger.ts @@ -17,7 +17,7 @@ const options: swaggerJsdoc.Options = { - Retrieve active ice reports (< 48 hours or persistent) - Admin panel for content moderation and management - Profanity filtering for content safety - - Geographic data with MapBox integration + - Geographic data with Mapbox integration `, contact: { name: 'Great Lakes Ice Report', @@ -222,13 +222,13 @@ const options: swaggerJsdoc.Options = { properties: { mapboxAccessToken: { type: 'string', - description: 'MapBox API token for geocoding (null if not configured)', + description: 'Mapbox API token for geocoding (null if not configured)', example: 'pk.eyJ1IjoiZXhhbXBsZSIsImEiOiJhYmNkZWZnIn0.example', nullable: true }, hasMapbox: { type: 'boolean', - description: 'Whether MapBox token is configured', + description: 'Whether Mapbox token is configured', example: true } }