Hike • Plan • Sync — A modern hiking trail discovery + planning app with Google OAuth, Google Calendar sync, and background jobs.
TrailPulse is built like a real production app: secure auth, object-level authorization, rate-limited APIs, audit logs, jobs monitoring, and “product” features like weather snapshots + weekly picks.
- ✅ Google OAuth login (Auth.js / NextAuth v5)
- ✅ Trail discovery (seeded dataset, filters + search)
- ✅ Save trails + plan hikes (notes + checklist)
- ✅ Google Calendar event creation for planned hikes
- ✅ Background jobs (BullMQ) for:
- Weather sync (Open-Meteo)
- Digest notifications (weekly picks)
- Plan reminders (24h / 3h / 30m) (if enabled in your worker build)
- ✅ In-app notifications + activity/audit logging
- ✅ Admin Jobs Dashboard (job runs, failures, retries)
- ✅ Premium UI with Tailwind + shadcn/ui-style components
- ✅ Light/Dark mode
| Page | Light | Dark |
|---|---|---|
| Dashboard | ![]() |
![]() |
| Trails | ![]() |
![]() |
| Trail Detail | ![]() |
![]() |
| Profile | ![]() |
![]() |
- Next.js 15 (App Router) + TypeScript
- Auth.js / NextAuth v5 (Google OAuth)
- Prisma ORM + PostgreSQL
- Redis + BullMQ (background jobs)
- TailwindCSS + shadcn/ui-style components
- Zod validation
- Security headers via middleware
- Node.js 18+ (Node 20+ recommended)
- pnpm (recommended) or npm/yarn
- Docker Desktop (Postgres + Redis)
- Google Cloud project with OAuth credentials
Google Cloud Console → APIs & Services → Credentials
- Create OAuth Client ID → Application type: Web application
- Add Authorized JavaScript origins:
http://localhost:3000
- Add Authorized redirect URIs:
http://localhost:3000/api/auth/callback/google
- Copy:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET
openid email profilehttps://www.googleapis.com/auth/calendar.events(create calendar events)
cp .env.example .envFill at minimum:
NEXTAUTH_URL=http://localhost:3000NEXTAUTH_SECRET=...DATABASE_URL=postgresql://...REDIS_URL=redis://...GOOGLE_CLIENT_ID=...GOOGLE_CLIENT_SECRET=...ADMIN_EMAILS=your.email@gmail.com(optional admin access)
docker compose up -dpnpm iThese match your package.json scripts:
pnpm prisma:generate
pnpm prisma:migrate
pnpm prisma:seedpnpm devpnpm worker:devpnpm all:devOpen:
- Web:
http://localhost:3000 - Sign in:
http://localhost:3000/signin - Trails:
http://localhost:3000/trails - Dashboard:
http://localhost:3000/dashboard - Profile:
http://localhost:3000/profile - Jobs Admin (ADMIN only):
http://localhost:3000/jobs-admin
- Runs every
WEATHER_SYNC_EVERY_HOURS - Finds trails saved/planned by any user
- Fetches conditions via Open-Meteo
- Stores snapshots into
WeatherSnapshot
- Runs daily at
DIGEST_HOUR_LOCAL - Writes a “Weekly picks” notification per user
- Runs on a schedule (e.g., every 15 minutes)
- Sends reminders:
- 24 hours before
- 3 hours before
- 30 minutes before
- Writes into
Notificationtable
- Server-side validation: Zod on every write endpoint
- Object-level authorization: users can only access their own plans/notifications/etc.
- Secure sessions: DB sessions + HttpOnly cookies (Auth.js defaults)
- CSRF: Auth.js default protections + same-site cookies
- Rate limiting (Redis) on spammy endpoints:
- Plans create
- Save trail
- Calendar create
- Notifications read
- Jobs retry (admin)
- Audit logs:
- auth events
- authorization denials
- job runs
- Security headers in middleware:
- CSP starter
- nosniff
- frame protection
- referrer policy
- permissions policy
- Sign in with Google
- DevTools → Application → Cookies:
- session cookies should be HttpOnly
SameSite=LaxSecure=truein production (HTTPS)
- Open another user’s plan ID: should return 404
- Calendar create with wrong planId: should return 403
- Rapidly spam plan creation: expect 429 Too many requests
- Spam calendar creation: expect 429
- DevTools → Network → Response headers include:
Content-Security-PolicyX-Content-Type-Options: nosniffX-Frame-Options: DENYReferrer-Policy
- Add your email to
ADMIN_EMAILS, sign out/in again - Visit
/jobs-admin - Confirm:
- queue counts show
- recent JobRun entries show
- retry button appears for failed jobs
pnpm testapp/— Next.js App Router pages + API route handlerssrc/server/— Prisma/Redis/authz/rate-limit + integrations (Calendar, OSM, Wikimedia)src/worker/— BullMQ worker + repeatable jobsprisma/— schema, migrations, seeddocker-compose.yml— Postgres + Redis
- Real route imports (GPX upload / bulk OSM Overpass sync)
- Trail comparisons (2–3 trails side-by-side)
- Plan share links (tokenized, public read-only)
- PWA offline packing mode
- Better observability (health endpoint, structured logs)







