Street Guides: UI + API
This document describes the current street-guide behavior implemented in the web app and Firebase Functions API.
Map UI Behavior
Map provider:
MapEditornow uses Leaflet + OpenStreetMap tiles (free provider), not Google Maps.
Street detail page (/streets/:streetId)
- Map view is rendered via
MapEditorinstreet-contextmode. - The map intentionally stays lightweight:
- Draws only the A→B street line.
- Shows endpoint markers
AandB. - Does not render business/shop markers.
- Does not render building polygons/markers.
- The map includes:
A to Bdistance badge (km).Locate Abutton.Locate Bbutton.Locate Streetbutton (fits A/B in view).Get Therelink to Google Maps directions.Route A-Blink to Google Maps A→B walking route.
Street editor page (/streets/:streetId/edit)
- Map view is rendered via
MapEditorin default mode. - Endpoint markers
AandBare visible and draggable when edit mode is on. Enter Edit Mode/Exit Edit Modeis controlled in toolbar.- In edit mode:
- Drag
AandBto updatestartPointandendPoint. - Click map to place new businesses.
- Drag
- Shop markers are intentionally not rendered on the map for a lighter street-level view.
Street View mode
- Uses
StreetViewEditor(not the map) for immersive street view. - Viewer location is only applied when user is near the street (distance check in
StreetDetailPage).
Firestore Data Model (Street)
- Street guide document:
streetGuides/{streetId} - Businesses subcollection:
streetGuides/{streetId}/businesses/{businessId} - Buildings subcollection:
streetGuides/{streetId}/buildings/{buildingId} - Key street geometry fields:
startPoint: { lat, lng }(A)endPoint: { lat, lng }(B)
Firestore Rules
Current rules allow authenticated reads and writes for street guides and nested businesses/buildings:
match /streetGuides/{streetGuideId}match /streetGuides/{streetGuideId}/businesses/{businessId}match /streetGuides/{streetGuideId}/buildings/{buildingId}
File: firestore.rules
REST API (Firebase Functions)
Base:
- Authenticated API:
/api/v1/* - OpenAPI spec JSON:
/openapi.json(public)
Street routes are defined in: functions/src/api/routes/streets.ts
Street guides
GET /api/v1/streetsGET /api/v1/streets/:idPOST /api/v1/streetsPATCH /api/v1/streets/:idDELETE /api/v1/streets/:id
Street businesses
GET /api/v1/streets/:id/businessesGET /api/v1/streets/:id/businesses/:bizIdPOST /api/v1/streets/:id/businessesPATCH /api/v1/streets/:id/businesses/:bizIdDELETE /api/v1/streets/:id/businesses/:bizId
Street buildings
GET /api/v1/streets/:id/buildingsGET /api/v1/streets/:id/buildings/:buildingIdPOST /api/v1/streets/:id/buildingsPATCH /api/v1/streets/:id/buildings/:buildingIdDELETE /api/v1/streets/:id/buildings/:buildingId
OpenAPI Docs Update Flow
OpenAPI is generated from route metadata and emitted to:
- Source:
functions/src/api/openapi.ts - Generator script:
functions/scripts/generate-openapi.ts
Regenerate with:
bash
cd functions
npm run generate:openapiThe API function serves the generated spec at /openapi.json.