Replaces the earlier 404-for-private model with Mastodon-style locked accounts. A private profile now returns 200 with a stub layout and gates content behind follow approval. Default for new users flips from 'public' to 'private' to align with trails.cool's privacy-first content defaults. Schema: - users.profile_visibility default flipped to 'private'. Existing rows remain 'public' (backfill on first migration handled them). Follow API (follow.server.ts): - followUser now creates Pending (accepted_at = NULL) against private targets and Accepted against public targets — no more refusal. - New: countPendingFollowRequests, listPendingFollowRequests, approveFollowRequest, rejectFollowRequest. Approve/reject are owner-bound: only the followed user can act on their own incoming requests. - countFollowers / countFollowing / listFollowers / listFollowing now filter to accepted-only relations. Loader (users.$username.tsx): - Drops the 404 paths. New canSeeContent flag = isOwn || profile_visibility='public' || (followState.following === true). - When canSeeContent=false, render a stub: header + 🔒 badge + body copy + Request-to-follow / sign-in CTA. Routes/activities sections are not rendered. UI: - FollowButton gains a "Request to follow" / "Requested" state for private targets via a new isPrivateTarget prop. Cancel-request reuses the unfollow endpoint. - New /follows/requests page lists incoming Pending requests with Approve / Reject buttons. - New API routes: POST /api/follows/:id/approve and /reject. - Navbar shows a count badge linking to /follows/requests when pending > 0. Privacy manifest already documents the follows relation; no changes needed (the locked-account semantics don't add new data — same row, different lifecycle). Specs / design (social-feed change): - public-profiles delta rewritten around the four-mode locked model (public, private+anon, private+pending, private+accepted) with scenarios for each. - social-follows delta gains Pending lifecycle requirements (auto vs. manual accept, approve/reject endpoints, pending request management, Pending follows do not contribute to feed). - design.md decision section reflects the new model and rationale for default-private; non-goal "locked-local-accounts as a follow-up" is removed since this change ships it. Tests: - follow.integration.test.ts: pending-against-private, approve flips to accepted, reject deletes, owner-bound enforcement. - e2e/social.test.ts: full Request → Pending → Approve → full-view flow, plus stub-for-anonymous and /follows/requests auth gate. Supersedes PR #309 (closed): the empty-public-profile 200 is now a side-effect of the new render path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .claude | ||
| .github | ||
| apps | ||
| docker/brouter | ||
| docs | ||
| e2e | ||
| infrastructure | ||
| openspec | ||
| packages | ||
| scripts | ||
| .gitignore | ||
| .gitleaks.toml | ||
| .mcp.json | ||
| .prettierrc | ||
| .sops.yaml | ||
| CLAUDE.md | ||
| docker-compose.dev.yml | ||
| eslint.config.js | ||
| LICENSE | ||
| package.json | ||
| playwright.config.ts | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| SECURITY.md | ||
| tsconfig.base.json | ||
| turbo.json | ||
| vitest.config.ts | ||
| vitest.setup.ts | ||
| vitest.shared.ts | ||
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:
- PostgreSQL + PostGIS on port 5432 (via Docker)
- BRouter routing engine on port 17777 (via Docker)
- Database schema pushed automatically via Drizzle
- BRouter segment downloaded for Berlin area (~124MB, cached)
- Journal on http://localhost:3000
- 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.
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