How rawepatj/tidrod works
1. This is a two-part monorepo: a Next.js frontend in front/ and a TypeScript Node backend in back/, with docker-compose.yml and separate Dockerfiles for local/containerized deployment.
2. The frontend is organized around the Next.js App Router. Routes are split into user-facing flows (/login, /register, /forgot-password, /reset-password, /verify-email, /profile, /trip/[id], /home) and an admin area under /admin with dedicated pages for users, trips, reports, and logs.
3. The backend is a route-based API. src/routes/ contains domain modules for auth, users, trips, messages, notifications, reports, markers, and admin, which suggests the server is the main business-logic boundary and the frontend is mostly a consumer of these endpoints.
4. Authentication and authorization are enforced in middleware, not just in the UI. middleware/auth.ts and middleware/admin.ts indicate protected user endpoints and a separate admin permission layer, matching the frontend’s normal vs admin split.
5. The app has a strong trip-centric domain model. Frontend components such as SearchTrip, TripForm, MyTrips, TripRatingsList, RateTripModal, and ReportModal imply trip discovery, trip creation/joining, ratings, and moderation/reporting as core workflows.
6. Real-time interaction is a first-class subsystem. back/src/socket.ts plus frontend components like Chat, NotificationBell, and LobbyBox point to websocket-driven messaging and live notifications alongside the normal REST API.
7. Persistence is abstracted behind a database layer in back/src/db.ts, with startup/bootstrap support in init-db.ts and an admin bootstrap script in src/scripts/make-admin.ts. This suggests the server owns schema/data initialization and operational setup, rather than the frontend.
8. There is an email-based account lifecycle. back/src/utils/email.ts and frontend pages for email verification and password reset imply the backend sends transactional email for registration verification and credential recovery.
9. The frontend contains map and location-oriented UI. Map.tsx, AutocompleteInput.tsx, and the presence of public/osm_liberty.json indicate map rendering/styling and location search as part of trip creation or discovery.
10. The admin console is a separate operational surface, not just a hidden page. It has its own layout and sidebar, and is backed by admin-specific backend routes and middleware, so it should be treated as a distinct subsystem for moderation and oversight.
11. Shared client-side infrastructure includes SessionProvider, toasts, skeleton/loading states, and reusable UI primitives. These are supporting layers around the main feature flows rather than separate domains.
12. Operationally, the backend includes logging (utils/logger.ts) and the repo is set up for containerized deployment, making the likely request path: browser → Next.js UI → backend REST/socket API → database/storage/email services.
Main entry points: app App Router · index.ts API Server · routes Route Modules · api.ts API Client
Components 20
Frontend
Next.js App Router UI and client-side feature flows
- App Router · Top-level Next.js application shell and route segments
front/app - Auth Pages · Login, register, password reset, and email verification screens
front/app/login - Home Feed · Primary landing and trip browsing experience
front/app/home - Trip Detail · Trip view and participation flow for a specific trip
front/app/trip/[id] - Profile · User profile and account settings surface
front/app/profile - Admin Console · Separate administrative area for moderation and oversight
front/app/admin - UI Components · Reusable client-side components for trips, chat, map, notifications, and forms
front/components - API Client · Frontend integration layer for backend requests
front/lib/api.ts - Session State · Auth/session provider and UI feedback primitives
front/components/SessionProvider.tsx - Map UI · Map rendering and location autocomplete support
front/components/Map.tsx
Backend
TypeScript Node API, realtime, and persistence boundary
- API Server · Backend application entrypoint and HTTP server bootstrap
back/src/index.ts - Route Modules · Domain API routes for auth, users, trips, messages, notifications, reports, markers, and admin
back/src/routes - Middleware · Authentication and admin authorization guards
back/src/middleware - Realtime Socket · Websocket-based chat and live notification channel
back/src/socket.ts - Database Layer · Database access and schema/runtime initialization
back/src/db.ts - Storage · Backend storage abstraction for persisted assets or files
back/src/storage.ts - Email Utils · Account lifecycle email delivery for verification and recovery
back/src/utils/email.ts - Admin Bootstrap · Script for creating an administrative user or seed admin access
back/src/scripts/make-admin.ts - DB Init · Startup/bootstrap flow for database setup and initialization
back/src/init-db.ts
Ops
Container and bootstrap support for local/containerized deployment
- Compose Setup · Container orchestration for frontend and backend services
docker-compose.yml
Connections 28
- App Router → Auth Pages: routes · App Router exposes authentication pages
- App Router → Home Feed: routes · App Router exposes the home feed
- App Router → Trip Detail: routes · App Router exposes trip detail pages
- App Router → Profile: routes · App Router exposes profile pages
- App Router → Admin Console: routes · App Router exposes the admin surface
- App Router → UI Components: uses · Route pages compose shared client components
- App Router → Session State: wraps · App shell provides session and toast/state infrastructure
- Home Feed → API Client: fetches · Home and discovery views load data from the API client
- Trip Detail → API Client: fetches · Trip detail and participation flows call backend endpoints
- Profile → API Client: fetches · Profile views read and update user data through the API client
- Admin Console → API Client: fetches · Admin pages consume admin endpoints through the API client
- UI Components → Map UI: includes · Shared UI includes map, autocomplete, and trip creation widgets
- UI Components → Session State: uses · Components depend on session/auth and feedback primitives
- API Server → Route Modules: mounts · Server mounts domain route modules
- API Server → Middleware: guards · Server applies auth and admin middleware
- API Server → Realtime Socket: starts · Server initializes realtime connections
- API Server → Database Layer: uses · Server depends on persistence layer
- Route Modules → Database Layer: reads/writes · Domain routes persist and query application data
- Route Modules → Email Utils: sends · Auth routes trigger transactional email flows
- Route Modules → Storage: uses · Some routes rely on backend storage abstractions
- Realtime Socket → Database Layer: reads/writes · Realtime features share persisted state with the database
- DB Init → Database Layer: initializes · Startup/bootstrap prepares the database
- Admin Bootstrap → Database Layer: seeds · Admin bootstrap creates or promotes admin access in persistence
- Compose Setup → App Router: deploys · Compose orchestrates the frontend service
- Compose Setup → API Server: deploys · Compose orchestrates the backend service
- API Client → API Server: calls · Browser UI talks to the backend API
- Session State → Route Modules: auth flow · Session state depends on backend auth and user endpoints
- UI Components → Realtime Socket: realtime · Chat and notification UI consume websocket events