Build trails effortlessly in a few seconds
AutoHike is an intelligent hiking app that automatically generates personalized hiking routes based on your preferences. Whether you want a short stroll or a challenging trek, AutoHike designs the perfect trail from start to finish, considering factors like terrain type, elevation gain, and difficulty.
- Custom Hike Generation: Select your start and end points on an interactive map and let AutoHike create the optimal trail for you.
- Preference-Based Routing: Adjust terrain type, elevation, and difficulty to tailor your hike.
- Real-Time Map Visualization: See your route displayed directly on a map with key stats.
- Scalable Backend: High-performance C++ backend capable of handling large datasets and complex route computations.
- Modern Frontend: Built with React for a smooth and interactive user experience.
- Backend: C++ (graph-based algorithms for route generation)
- Frontend: React (interactive maps and user interface)
- Communication: REST API between frontend and backend
- Boost: Faster data structures and unit testing.
- nlohmann/json: To parse JSON requests.
- Osmium: To pre-process OpenStreetMap data.
- GDAL: To process elevation data.
- zlib: To read the compressed OSM files.
-
Navigate to the backend directory:
cd backend -
Build the application:
mkdir -p build cd build cmake .. make -j -
If not done yet, for the data preprocessing, use:
cmake -DBUILD_PREPROCESS=ON ..
make -j
./preprocess_osm ../../data/raw/raw.osm.pbf ../../data/raw/raw-srtm.tif ../../data/tiles- Run the backend server:
./AutoHikeBackend ../../data/tiles
The backend server will start on http://localhost:8080 with the following endpoints:
GET /api/health- Health checkPOST /api/route- Route calculation (returns GeoJSON)POST /api/export/gpx- GPX export
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The backend server can be configured using environment variables:
| Variable | Default | Range | Description |
|---|---|---|---|
AUTOHIKE_HOST |
127.0.0.1 |
- | Server bind address (use 0.0.0.0 for Docker) |
AUTOHIKE_PORT |
8080 |
1-65535 | Server port |
AUTOHIKE_MAX_THREADS |
8 |
1-100 | Maximum worker threads |
AUTOHIKE_TIMEOUT |
30 |
1-300 | Request timeout in seconds |
| Variable | Default | Range | Description |
|---|---|---|---|
AUTOHIKE_MAX_TILES_CACHE |
200 |
1-1000 | Maximum tiles to cache in memory |
AUTOHIKE_TILES_PATH |
"" |
- | Custom path to tile data (optional) |
| Variable | Default | Range | Description |
|---|---|---|---|
AUTOHIKE_MAX_REQUEST_SIZE |
1048576 |
1024-10MB | Maximum request size in bytes (1MB) |
AUTOHIKE_ALLOWED_ORIGINS |
"" |
- | CORS allowed origins (comma-separated, empty = allow all) |
| Variable | Default | Description |
|---|---|---|
AUTOHIKE_DB_PATH |
../../database.sqlite |
Path to SQLite database |
# Set environment variables for production
export AUTOHIKE_HOST=0.0.0.0
export AUTOHIKE_PORT=3000
export AUTOHIKE_ALLOWED_ORIGINS="https://yourdomain.com,https://app.yourdomain.com"
export AUTOHIKE_MAX_REQUEST_SIZE=2097152
export AUTOHIKE_MAX_THREADS=16
export AUTOHIKE_MAX_TILES_CACHE=500
# Run the server
./AutoHikeBackend /path/to/tilesWhen running with Docker, make sure to set AUTOHIKE_HOST=0.0.0.0 in your docker-compose.yml:
services:
backend:
environment:
- AUTOHIKE_HOST=0.0.0.0
- AUTOHIKE_MAX_TILES_CACHE=200A big thanks to each open source project that made this app possible:
- Path and water location data were obtained from OpenStreetMap.
- Elevation data were sourced from the SRTM dataset provided by OpenTopography.
- Shelter location data were retrieved from refuges.info.
- Map tiling was provided by the Thunderforest API.
This project is under license Apache 2.0.