64 lines
1.6 KiB
Markdown
64 lines
1.6 KiB
Markdown
# HikeBuddy
|
|
|
|
Hiking assistant app: planning, gear, hike support, tracking. Built for expansion — new features will be added over time.
|
|
|
|
## Tech Stack
|
|
|
|
- **Java 21**, Spring Boot 4.0.6
|
|
- **Thymeleaf** for server-side rendered UI
|
|
- **Maven** (wrapper via `mvnw`)
|
|
- **Docker** + Docker Compose for deployment
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
src/main/java/de/pitfriedrich/hikebuddy/
|
|
HikebuddyApplication.java # Entry point
|
|
calculator/ # Hike duration feature
|
|
HikeDurationController.java # GET/POST /calculator
|
|
HikeDurationService.java # Duration formula logic
|
|
HikeDurationForm.java # Form binding (altitudeDifference, distance)
|
|
|
|
src/main/resources/
|
|
templates/calculator.html # Thymeleaf template
|
|
application.yaml
|
|
```
|
|
|
|
**Convention:** each feature lives in its own sub-package under `de.pitfriedrich.hikebuddy`.
|
|
|
|
## Build & Run
|
|
|
|
```bash
|
|
# Run locally
|
|
./mvnw spring-boot:run
|
|
|
|
# Run tests
|
|
./mvnw test
|
|
|
|
# Build JAR
|
|
./mvnw package -DskipTests
|
|
|
|
# Run via Docker Compose (port 8080)
|
|
docker compose up --build
|
|
```
|
|
|
|
App runs on `http://localhost:8080`. Root `/` redirects to `/calculator`.
|
|
|
|
## Key Business Logic
|
|
|
|
### Hike Duration Formula (`HikeDurationService`)
|
|
|
|
```
|
|
v1 = altitudeDifference (m) / 300
|
|
v2 = distance (km) / 4
|
|
duration (hours) = max(v1, v2) + 0.5 * min(v1, v2)
|
|
totalMinutes = round(duration * 60) → displayed as hours + minutes
|
|
```
|
|
|
|
## Adding New Features
|
|
|
|
1. Create sub-package under `de.pitfriedrich.hikebuddy.<feature>`
|
|
2. Add Controller, Service, Form/DTO classes
|
|
3. Add Thymeleaf template under `src/main/resources/templates/`
|
|
4. Update `SPEC.md` checklist when done
|