trails.cool monorepo (migrated from GitHub)
Find a file
Ullrich Schäfer 29be9cbe5f
feat(gpx): apply elevation cleaning to totals + profile chart
Task group 2 (part a) of elevation-profile-hardening — wire the group-1
primitives into the headline stat and the chart.

- computeElevation (parse.ts): despike each segment's elevation sequence,
  then take filteredTotals; gain/loss are now noise-filtered (no more
  20–50% inflation from per-point jitter), the profile is built from the
  despiked data, and additive gainRaw/lossRaw expose the unfiltered sums.
- elevationSeries: despike per segment (no cross-trkseg interpolation)
  before downsampling, so the chart and the headline totals derive from
  the same cleaned data.
- types.ts: GpxData.elevation gains gainRaw/lossRaw (additive).

Well-formed monotonic climbs are unchanged (steps exceed the 5 m
threshold → filtered == raw); a shared noisy-track test proves jitter is
filtered and a 300 m single-point spike is interpolated out of both the
totals and the chart.

Verified: gpx 111/111; full pnpm typecheck 13/13, lint 13/13, test 11/11
(journal + planner compile with the additive fields).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 00:56:36 +02:00
.agents/skills chore(openspec): regenerate skills + commands for CLI 1.6.0 2026-07-13 20:59:01 +02:00
.claude chore(openspec): regenerate skills + commands for CLI 1.6.0 2026-07-13 20:59:01 +02:00
.github ci: rename workflow file to match its name (dependabot-auto-fix.yml) 2026-07-13 21:10:37 +02:00
apps feat(journal): federation protocol doc + delivery observability 2026-07-13 23:11:43 +02:00
docker/brouter Auto-download BRouter segments on first container start 2026-05-08 00:43:43 +02:00
docs feat(journal): federation protocol doc + delivery observability 2026-07-13 23:11:43 +02:00
e2e poi-index: extract pipeline (BRouter host) + import job (flagship) + e2e 2026-07-12 22:48:32 +02:00
infrastructure feat(journal): federation protocol doc + delivery observability 2026-07-13 23:11:43 +02:00
openspec feat(gpx): apply elevation cleaning to totals + profile chart 2026-07-14 00:56:36 +02:00
packages feat(gpx): apply elevation cleaning to totals + profile chart 2026-07-14 00:56:36 +02:00
scripts Local dev stack improvements 2026-05-17 23:12:22 +02:00
.dockerignore feat(journal): two-instance federation harness + trails↔trails Accept fix (§11) 2026-06-07 13:36:35 +02:00
.env.development.example Local dev stack improvements 2026-05-17 23:12:22 +02:00
.gitignore chore: gitignore internal working notes 2026-06-12 13:56:08 +02:00
.gitleaks.toml Fix .gitleaks.toml config syntax 2026-03-25 11:59:26 +01:00
.mcp.json Add Sentry MCP server config, ignore worktrees 2026-03-25 07:43:58 +00:00
.prettierrc Complete monorepo toolchain setup (tasks 1.1-1.7) 2026-03-22 12:12:57 +01:00
.sops.yaml SOPS+age secrets, split CD workflows, GitHub OAuth for Grafana 2026-03-27 17:28:04 +01:00
CLAUDE.md remove the map and ui shim packages 2026-06-10 07:47:59 +02:00
CONTEXT.md Atomic GPX save: validate + persist row + geometry in one transaction 2026-05-10 15:02:56 +02:00
docker-compose.dev.yml refactor(infra): mount config dirs not single files; reload on deploy 2026-06-09 13:10:35 +02:00
eslint.config.js fix: extensionless server-side imports + lint rule to catch them 2026-05-26 08:08:19 +02:00
FEDERATION.md feat(journal): federation protocol doc + delivery observability 2026-07-13 23:11:43 +02:00
LICENSE Initial monorepo setup with architecture plan 2026-03-22 11:29:33 +01:00
package.json fix(deps): resolve 12 Dependabot alerts via pnpm overrides 2026-07-13 20:07:26 +02:00
playwright.config.ts profile-weekly-distance: weekly distance bar chart on the profile 2026-06-13 07:46:06 +02:00
pnpm-lock.yaml fix(deps): resolve 12 Dependabot alerts via pnpm overrides 2026-07-13 20:07:26 +02:00
pnpm-workspace.yaml build(deps): bump the production group across 1 directory with 35 updates 2026-07-13 09:29:56 +02:00
README.md feat(journal): federation protocol doc + delivery observability 2026-07-13 23:11:43 +02:00
SECURITY.md Security hardening: headers, scanning, Docker, firewall 2026-03-25 09:58:12 +01:00
tsconfig.base.json Fix TypeScript parameter property crash in Node strip-only mode 2026-04-12 14:00:00 +02:00
turbo.json Standardize monorepo pipeline: test, lint, typecheck across all workspaces 2026-04-13 00:00:43 +02:00
vitest.config.ts Standardize monorepo pipeline: test, lint, typecheck across all workspaces 2026-04-13 00:00:43 +02:00
vitest.setup.ts Add testing strategy: Vitest for unit tests, Playwright for E2E 2026-03-22 12:36:09 +01:00
vitest.shared.ts Add tests to all packages, remove passWithNoTests 2026-04-13 00:48:27 +02: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)
GitHub Copilot AI coding assistant
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.

Federation

The Journal federates over ActivityPub. The wire protocol — actor discovery, object/activity types with JSON examples, addressing, signatures, deduplication, delivery retry, and moderation — is documented in FEDERATION.md, which is precise enough for another implementation to interoperate against.

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