How careonroad/careonroad-application works
Purpose and Entry Point
CareOnRoad is a Next.js prototype for roadside vehicle care, with separate customer and mechanic experiences. The browser entry route is app/page.tsx; global document shell and styling originate in app/layout.tsx and app/globals.css.
Role Selection and App Shells
components/role-picker.tsx selects the user-facing mode, routing control into one of two client-side application shells:
• Customer shell: components/care/care-app.tsx
• Mechanic shell: components/mechanic/mechanic-app.tsx
These shells own screen selection and assemble persistent navigation, headers, and role-specific interaction surfaces.
Customer Care Application
The customer flow centers on vehicle ownership, appointments, maintenance, roadside rescue, and history. Its primary navigation/screens are:
• components/care/screens/home-screen.tsx
• components/care/screens/schedule-screen.tsx
• components/care/screens/rescue-screen.tsx
• components/care/screens/vehicles-screen.tsx
• components/care/screens/history-screen.tsx
Reusable domain cards render bookings, maintenance status, mechanics, and vehicles through components/care/booking-card.tsx, components/care/maintenance-card.tsx, and components/care/vehicle-card.tsx.
Customer State and AI Boundary
components/care/app-context.tsx is the customer-side state boundary for sharing application data/actions across screens and components. Booking cancellation is encapsulated by components/care/cancel-appointment-modal.tsx; emergency escalation is surfaced through components/care/sos-button.tsx.
The chat interaction is isolated in components/care/ai-chatbox.tsx and backed by local simulated AI behavior in lib/mock-ai.ts; no real AI provider or backend integration is evident.
Mechanic Operations Application
The mechanic shell provides a separate operational workflow for dashboard, job queue, job details, scheduling, and profile:
• components/mechanic/screens/mechanic-dashboard.tsx
• components/mechanic/screens/mechanic-jobs-screen.tsx
• components/mechanic/screens/mechanic-job-detail.tsx
• components/mechanic/screens/mechanic-schedule.tsx
Job progression/update interactions are bounded in components/mechanic/forms/job-update-form.tsx, while dispatch/job/customer/earnings summaries are represented by components under components/mechanic/cards/.
Mechanic State and Data Contracts
components/mechanic/mechanic-app-context.tsx is the mechanic-side shared-state boundary. Mechanic-domain interfaces are defined in lib/mechanic-types.ts; fixture records are supplied by lib/mechanic-mock-data.ts. This separates mechanic UI workflows from eventual live dispatch, customer, and earnings services.
Data, Runtime, and Infrastructure
The project runs on Next.js with TypeScript, using the App Router conventions in app/. Current domain data is local/mock rather than persisted or fetched remotely: lib/mock-data.ts, lib/mechanic-mock-data.ts, and lib/mock-ai.ts. Shared customer types reside in lib/types.ts.
Deployment is expected through the v0-linked workflow described in README.md, where merges to main automatically deploy. No API routes, database client, authentication layer, payment provider, maps/geolocation SDK, or external service client appears in the repository tree.
Components 22
Next.js Entry
- Browser route
app/page.tsx - Role picker
components/role-picker.tsx
Customer Care
- Customer app shell · Owns customer navigation and screen selection.
components/care/care-app.tsx - Customer state · Shared customer data and actions boundary.
components/care/app-context.tsx - Home
components/care/screens/home-screen.tsx - Appointments
components/care/screens/schedule-screen.tsx - Roadside rescue
components/care/screens/rescue-screen.tsx - Vehicles
components/care/screens/vehicles-screen.tsx - Service history
components/care/screens/history-screen.tsx - Cancel appointment
components/care/cancel-appointment-modal.tsx - SOS escalation
components/care/sos-button.tsx - AI chatbox
components/care/ai-chatbox.tsx
Mechanic Operations
- Mechanic app shell · Owns mechanic navigation and workflow selection.
components/mechanic/mechanic-app.tsx - Mechanic state · Shared mechanic workflow state boundary.
components/mechanic/mechanic-app-context.tsx - Operations dashboard
components/mechanic/screens/mechanic-dashboard.tsx - Job queue
components/mechanic/screens/mechanic-jobs-screen.tsx - Job details
components/mechanic/screens/mechanic-job-detail.tsx - Job update form
components/mechanic/forms/job-update-form.tsx
Local Data & AI
Prototype uses local fixtures and simulated AI.
- Customer fixtures & types
lib/mock-data.ts - Mechanic fixtures
lib/mechanic-mock-data.ts - Mechanic contracts
lib/mechanic-types.ts - Simulated AI · No external AI provider is integrated.
lib/mock-ai.ts
Connections 21
- Browser route → Role picker: renders
- Role picker → Customer app shell: customer mode
- Role picker → Mechanic app shell: mechanic mode
- Customer app shell → Customer state: provides state
- Customer app shell → Home: navigates
- Customer app shell → Appointments: navigates
- Customer app shell → Roadside rescue: navigates
- Customer app shell → Vehicles: navigates
- Customer app shell → Service history: navigates
- Appointments → Cancel appointment: cancels booking
- Roadside rescue → SOS escalation: escalates
- Customer app shell → AI chatbox: hosts
- AI chatbox → Simulated AI: simulated responses
- Customer state → Customer fixtures & types: uses local data
- Mechanic app shell → Mechanic state: provides state
- Mechanic app shell → Operations dashboard: navigates
- Mechanic app shell → Job queue: navigates
- Mechanic app shell → Job details: opens jobs
- Job details → Job update form: updates progression
- Mechanic state → Mechanic fixtures: uses fixtures
- Mechanic state → Mechanic contracts: uses contracts