Skip to content

Component map

1. Bounded contexts → API modules/components and surfaces

From docs/architecture.md (bounded contexts) and docs/domain/README.md intent, the system is organized into these contexts. The mapping below shows where behavior lives (API side) and which surfaces consume it.

Bounded context API modules/components (typical) Surfaces that use it
Identity & Enrollment Auth (phone + OTP, Sanctum), membership/company code flows, user profile/locale/gender, role scoping. API areas: enrollment endpoints, company codes, driver account creation by Manager. Front Views (onboarding entry), Fleet Dashboard (enrollment queue, codes, drivers), Passenger App (join + blocked state), Driver App (login/session), API/Filament (Platform Admin controls).
Fleet Company-scoped NavRoute, Vehicle, driver assignments, route/vehicle management. Fleet Dashboard (routes, vehicles, drivers), API domain/infrastructure for fleet entities, Driver App consumes assigned/company-scoped trips context.
Trips & Booking Trips, trip groups (trip_group_code), bookings (no payment), reservation deadlines, duplicate trip flows. API areas: company trips, booking endpoints, extra car requests integration points. Fleet Dashboard (trips management), Passenger App (trip list/groups, booking, optional D2D points), Driver App (company-scoped trips/manifests context), API.
Live Ops Realtime channels/events, GPS ingestion from Driver App, status messages/feedback, boarding updates (boarded_at), live read models for positions/ETA. API areas: live endpoints, coordinator feedback, broadcast events. Driver App (GPS publish, status messages, boarding actions), Fleet Dashboard (Live tab), Passenger App (live tracking), API + Reverb.
D2D (Door-to-Door) D2D eligibility rules (company + member toggles), booking D2D pickup/dropoff points, detour estimation/validation (max detour minutes), route plan generation/serving. API area: GET /coordinator/trips/{id}/route-plan and booking fields. Passenger App (set pickup/dropoff points when eligible), Fleet Dashboard (D2D settings, Live route plan display), Driver App (route plan/navigation cues), API.
Billing & Tiers Subscription tiers, seat accounting (approved Passenger members), company subscription status, Platform Admin tier/company management. Fleet Dashboard (seat usage visibility), API + Filament (Platform Admin), Front Views (pricing/tiers presentation context).
Reviews & Analytics Trip reviews (trip_reviews), trip analytics (trip_analytics) such as delays, unexpected stops, slow segments, and separate D2D detour metrics. API areas: review endpoints, analysis endpoints/job outputs. Passenger App (submit reviews after completed trips), Fleet Dashboard (reviews list/filters, trip analysis views), API (jobs/resources).

2. API layering (DDD)

The API follows DDD layering (see docs/method.md and api/AGENTS.md guidance summarized here):

flowchart TB
    Req["HTTP Request"]
    FR["FormRequest\n(HTTP validation only; no business rules)"]
    DTO["DTO\n(typed input)"]
    AS["Application Service\n(one use case; transaction boundary)"]
    DOM["Domain\n(rich models/value objects/invariants,\nrepository interfaces, events)"]
    INF["Infrastructure\n(Eloquent repos, listeners/providers,\nbroadcasts, external adapters)"]
    RES["JsonResource\n(response shape; never raw models)"]

    Req --> FR --> DTO --> AS --> DOM
    AS --> INF
    DOM --> INF
    INF --> RES --> Req

Rules (from docs/method.md):

  • Repository interfaces live in the Domain layer; Eloquent implementations live in Infrastructure. Bindings are registered in service providers.
  • Business invariants live on models/value objects, not in controllers or FormRequests.
  • One application service per use case; services may call repositories and dispatch domain events.
  • Controllers stay thin: validate → DTO → service → resource.
  • Events/listeners live in Infrastructure and may broadcast via Reverb.
  • Filament is an adapter for Platform Admin only; do not place business rules in Filament resources/controllers/views.

3. Surface component structures (high level)

3.1 Front Views (web/front) — Astro + React islands, Tailwind

  • Purpose: public marketing/onboarding surface (landing, pricing/tiers, company onboarding entry).
  • Typical structure (conceptual):
  • Astro pages/routes for public content.
  • React islands for interactive parts (forms, onboarding flows) styled with Tailwind.
  • API calls to the backend for onboarding actions (rate-limited public endpoints as defined by product spec).

3.2 Fleet Dashboard (web/dashboard) — React + TypeScript + Vite, Tailwind, shadcn/ui

  • Purpose: company operations UI for Managers (and related company-scoped workflows).
  • Typical structure (conceptual):
  • App shell with routing and RTL-aware layout.
  • Data layer via TanStack Query (query/mutation hooks) calling the API.
  • UI components from Tailwind + shadcn/ui; tables/forms via TanStack Table + React Hook Form + Zod.
  • Maps via @vis.gl/react-google-maps.
  • Realtime via laravel-echo + pusher-js against Reverb.
  • i18n via i18next + react-i18next (persisted locale, language switch in settings).
  • Pages (from architecture/product docs): Overview, Enrollment, Trips (routes, vehicles, drivers), Extra cars, D2D settings, Live, Trip analysis, Reviews. Platform Admin remains in Filament (/admin), not in the Dashboard.

3.3 Passenger App (apps/passenger) — Expo React Native (pointer only on this host)

  • Purpose: Passenger experience (join/blocked state, trip groups and booking with no payment, optional D2D points when eligible, live tracking, reviews).
  • Typical structure (conceptual):
  • Screen/navigation flows for enrollment/join, trip discovery/group selection, booking, D2D point selection, live view, reviews, notifications/settings.
  • API integration for auth (phone + OTP), membership state, trips/bookings, live data, and reviews.
  • i18n with RTL support; maps remain LTR.

3.4 Driver App (apps/driver) — Expo React Native (pointer only on this host)

  • Purpose: Driver operations (company-scoped trips/manifests, boarding via tap/QR, navigation with main + secondary routes, GPS publishing, status messages, offline sync patterns as applicable).
  • Typical structure (conceptual):
  • Flows for assigned/company-scoped trips, manifest/boarding actions, route plan/navigation display, GPS/status feedback publishing, and offline-aware behavior.
  • API + realtime integration for trip data, route plans, feedback, and broadcasting/receiving updates as designed.
  • i18n with RTL support; maps remain LTR.

4. Cross-cutting constraints (component-relevant)

  • Tenant isolation: enforce company_id scoping in API queries and authorization; global CompanyScope applies to tenant-scoped models.
  • Realtime channels (high level): private-company.{companyId} for Manager-facing company events; trip.{tripId} for passenger live view (with membership checks). Existing notification channels remain.
  • Localization: API uses Accept-Language and localized fields; clients use i18next/react-i18next with RTL and persisted locale. Maps stay LTR.