trails.cool monorepo (migrated from GitHub)
Find a file
Ullrich Schäfer 55806fc84a
Fix waypoint drag, host election, segment routing, debug panel
Waypoint drag:
- Use observeDeep instead of observe to detect Y.Map property changes

Host election:
- Extracted to host-election.ts with 8 unit tests
- Simple rule: lowest real client ID is always host, deterministic
- Always sets role (host or participant), no missing roles
- Filters server docs (empty awareness state) from election

BRouter routing:
- Route segment-by-segment like bikerouter.de (one request per
  waypoint pair), guarantees route passes through every waypoint
- Merge GeoJSON segments with accumulated stats
- 8 unit tests for segment merging and waypoint splitting

Awareness cleanup:
- Track client IDs per WebSocket connection
- Immediately remove awareness on WebSocket close

Debug panel:
- Visibility + expanded state persisted in localStorage
- Hotkey (Shift+Cmd+Option+T) toggles visibility
- Labels server docs as (server)
- All logic self-contained in YjsDebugPanel.tsx

User identity:
- Color and name persisted in localStorage across reloads

Tests: 32 total (16 existing + 8 host election + 8 routing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 08:52:52 +01:00
.claude Add crit command and skill for inline code review 2026-03-22 12:31:08 +01:00
.github/workflows Add all recommended triggers to automerge action 2026-03-23 01:18:54 +01:00
apps Fix waypoint drag, host election, segment routing, debug panel 2026-03-23 08:52:52 +01:00
docker/brouter Add local dev setup, fix BRouter Dockerfile, archive change (#12) 2026-03-22 23:11:43 +00:00
docs Add GitHub Actions CI, wire ESLint, lock in Caddy 2026-03-22 12:55:12 +01:00
e2e Add testing strategy: Vitest for unit tests, Playwright for E2E 2026-03-22 12:36:09 +01:00
infrastructure Add reverse DNS (PTR) records to Terraform config (#14) 2026-03-22 23:17:33 +00:00
openspec Complete Planner UI: profile selector, elevation chart, GPX export 2026-03-23 00:57:39 +01:00
packages Add animated progress bar during route computation 2026-03-23 08:34:34 +01:00
scripts Add local dev setup, fix BRouter Dockerfile, archive change (#12) 2026-03-22 23:11:43 +00:00
.gitignore Add testing strategy: Vitest for unit tests, Playwright for E2E 2026-03-22 12:36:09 +01:00
.prettierrc Complete monorepo toolchain setup (tasks 1.1-1.7) 2026-03-22 12:12:57 +01:00
CLAUDE.md Switch from squash merges to regular merge commits 2026-03-23 00:19:57 +01:00
docker-compose.dev.yml Add local dev setup, fix BRouter Dockerfile, archive change (#12) 2026-03-22 23:11:43 +00:00
eslint.config.js Add Planner session management with Yjs WebSocket (#1) 2026-03-22 13:26:03 +01:00
LICENSE Initial monorepo setup with architecture plan 2026-03-22 11:29:33 +01:00
package.json Implement Planner map UI with collaborative editing (Groups 5+6) 2026-03-23 00:32:51 +01:00
playwright.config.ts Add testing strategy: Vitest for unit tests, Playwright for E2E 2026-03-22 12:36:09 +01:00
pnpm-lock.yaml Fix Yjs WebSocket in dev mode 2026-03-23 01:12:13 +01:00
pnpm-workspace.yaml Fix esbuild security vulnerability (Dependabot #1) 2026-03-23 00:25:09 +01:00
README.md Add local dev setup, fix BRouter Dockerfile, archive change (#12) 2026-03-22 23:11:43 +00:00
tsconfig.base.json Complete monorepo toolchain setup (tasks 1.1-1.7) 2026-03-22 12:12:57 +01:00
turbo.json Add testing strategy: Vitest for unit tests, Playwright for E2E 2026-03-22 12:36:09 +01:00
vitest.config.ts Add testing strategy: Vitest for unit tests, Playwright for E2E 2026-03-22 12:36:09 +01:00
vitest.setup.ts Add testing strategy: Vitest for unit tests, Playwright for E2E 2026-03-22 12:36:09 +01:00

trails.cool

Collaborative route planning and federated activity sharing for outdoor enthusiasts.

Planner — Plan routes together in real-time. Share a link, invite friends, edit waypoints collaboratively. Powered by BRouter for intelligent routing with elevation awareness.

Journal — Track your adventures. Import activities from Garmin, Strava, or Wahoo. Share routes and rides with friends. Self-host your own instance and federate with others via ActivityPub.

Status

Early development. See the architecture plan and project philosophy.

Project Structure

This is a TypeScript monorepo using pnpm workspaces and Turborepo.

apps/
  planner/        Collaborative route editor (React Router 7 + Yjs + Leaflet)
  journal/        Activity social platform  (React Router 7 + Fedify + PostGIS)

packages/
  types/          Shared TypeScript interfaces
  ui/             Shared React components (Tailwind)
  map/            Leaflet map wrappers
  gpx/            GPX parsing and generation
  i18n/           Internationalization (English + German)

Getting Started

Prerequisites: Node.js 20+, pnpm, Docker

# Clone
git clone https://github.com/trails-cool/trails.git
cd trails

# Install dependencies
pnpm install

# Start development (apps only, no database or routing)
pnpm dev

# Start full stack (PostgreSQL + BRouter + apps)
pnpm dev:full

Full Local Dev Setup

pnpm dev:full starts everything needed to test the Planner end-to-end:

  1. PostgreSQL + PostGIS on port 5432 (via Docker)
  2. BRouter routing engine on port 17777 (via Docker)
  3. Database schema pushed automatically via Drizzle
  4. BRouter segment downloaded for Berlin area (~124MB, cached)
  5. Journal on http://localhost:3000
  6. Planner on http://localhost:3001

Other useful commands:

pnpm dev:services     # Start Docker services only (DB + BRouter)
pnpm db:push          # Push database schema changes
pnpm db:studio        # Open Drizzle Studio (DB browser)

Development Tools

This project uses AI-assisted, spec-driven development. See docs/tooling.md for details.

Tool Purpose
cmux Native macOS terminal for running multiple AI coding sessions
Claude Code AI coding assistant (primary development tool)
Crit Browser-based inline code review
OpenSpec Spec-driven development workflow

Self-Hosting

The Journal is designed to be self-hosted. A single Docker Compose file gets you running:

curl -O https://raw.githubusercontent.com/trails-cool/trails/main/infrastructure/docker-compose.yml
docker compose up -d

See docs/architecture.md for details on self-hosting configuration.

Philosophy

  • Privacy by design — The Planner collects zero user data
  • Data ownership — Export everything, self-host, no lock-in
  • Open source — MIT licensed, built on open standards
  • Simplicity — Start simple, add complexity only when needed

Read more: docs/philosophy.md

Contributing

Human contributions are welcome! This project is built with AI-assisted development (Claude Code + OpenSpec), but we value human judgment, design taste, and community input.

License

MIT