1 min read

BikeNav ๐Ÿšฒ

A simple web app to help you find nearby bike parking.

I love biking places. I especially love biking to new places. Unfortunately, in our imperfect world, I never know if or where there will be a place to lock my bike at my destination. I often would spend time scouring Google Maps satelite images and street view to try to figure out what I do with my bike.

I got fed up with it, and created BikeNav! Using OpenStreetMap APIs, with BikeNav you can now easily find parking near you or get biking directions to the closest parking to your destination.

This application was one of my first forays into what the "cool kids" call "vibe coding" ๐Ÿ˜‰ The original prototype was built using Builder.io, and for refinement and additional features I used the OpenCode CLI

๐Ÿ› ๏ธ Tech Stack

This is a fully client-side app, making use of open-source mapping tools and APIs.

  • Frontend: React 18 + TypeScript + Vite
  • Styling: TailwindCSS 3 + Radix UI components
  • Mapping: Leaflet + React Leaflet
  • Routing: React Router 6
  • Data: OpenStreetMap APIs (Nominatim + OSRM)
  • Testing: Vitest
  • Icons: Lucide React

๐Ÿš€ Getting Started

Prerequisites

Local Development Setup

  1. Clone the repository

    git clone https://github.com/algabl/bikenav
    cd bikenav
    
  2. Install dependencies

    npm install
    
  3. Start the development server

    npm run dev
    

The application will be available at http://localhost:8080.

๐Ÿ“– Available Scripts

  • npm run dev - Start development server at http://localhost:8080
  • npm run build - Build for production
  • npm run preview - Preview production build locally
  • npm test - Run unit tests
  • npm run typecheck - TypeScript type checking
  • npm run format.fix - Format code with Prettier

๐ŸŒ Production Deployment

Static Build

npm run build
npm run preview

The app builds to a static site that can be deployed to any static hosting service like:

  • Netlify
  • Vercel
  • GitHub Pages
  • AWS S3 + CloudFront

๐Ÿ—๏ธ Project Structure

client/                   # React SPA frontend
โ”œโ”€โ”€ api/                  # API interface layer
โ”œโ”€โ”€ components/           # React components
โ”‚   โ”œโ”€โ”€ ui/              # Reusable UI components (Radix + Tailwind)
โ”‚   โ”œโ”€โ”€ Map.tsx          # Leaflet map component
โ”‚   โ”œโ”€โ”€ SearchBox.tsx    # Location search with geocoding
โ”‚   โ”œโ”€โ”€ DirectionsList.tsx # Parking location results
โ”‚   โ”œโ”€โ”€ RouteDisplay.tsx # Route information display
โ”‚   โ””โ”€โ”€ ModeSelector.tsx # Toggle between parking/directions
โ”œโ”€โ”€ hooks/               # Custom React hooks
โ”œโ”€โ”€ lib/                 # Core business logic
โ”‚   โ”œโ”€โ”€ bicycle-parking.ts # OSM bicycle parking data fetching
โ”‚   โ”œโ”€โ”€ routing.ts       # OSRM bike route calculation
โ”‚   โ”œโ”€โ”€ types.ts         # TypeScript type definitions
โ”‚   โ””โ”€โ”€ utils.ts         # Utility functions
โ”œโ”€โ”€ pages/               # Route components
โ”‚   โ”œโ”€โ”€ Index.tsx        # Main app page
โ”‚   โ””โ”€โ”€ NotFound.tsx     # 404 page
โ”œโ”€โ”€ App.tsx              # App entry point with routing
โ””โ”€โ”€ global.css           # TailwindCSS styles

public/                   # Static assets
โ”œโ”€โ”€ favicon.ico
โ””โ”€โ”€ robots.txt

Configuration files:
โ”œโ”€โ”€ package.json         # Dependencies and scripts
โ”œโ”€โ”€ tsconfig.json        # TypeScript config
โ”œโ”€โ”€ tailwind.config.ts   # TailwindCSS config
โ”œโ”€โ”€ vite.config.ts       # Vite build config
โ””โ”€โ”€ components.json      # Radix UI component config

๐Ÿงช Features

Interactive Map

  • Leaflet-powered mapping with OpenStreetMap tiles
  • Click-to-select locations for easy route planning
  • Real-time markers for start, destination, and parking locations
  • Route visualization with turn-by-turn directions overlay

Two Core Modes

Parking Mode

  • Find bicycle parking near any destination
  • Search by address using Nominatim geocoding
  • Distance and amenity info for each parking location
  • Visual markers showing parking availability and type

Directions Mode

  • Full bike route planning from start to destination
  • Optimal routing using OSRM bike-specific routing
  • Turn-by-turn directions with distance and duration
  • Parking integration - routes can include nearby bike parking

Smart Search

  • Address autocomplete with geocoding suggestions
  • Current location detection with GPS integration
  • Manual map selection by clicking anywhere
  • Location permission prompts for enhanced UX

Responsive Design

  • Mobile-first interface optimized for on-the-go use
  • Desktop-friendly with expanded sidebars and controls
  • Smooth animations and transitions between modes
  • Accessible UI built with Radix primitives

Open Source Data

  • OpenStreetMap for all mapping and location data
  • No API keys required - fully client-side operation
  • Community-driven bicycle infrastructure data
  • Real-time updates as OSM data improves

View original README on GitHub