Skip to content

System Overview

Majestic Transport is built as a Monorepo, meaning all the applications and shared logic are housed in a single project. This approach ensures consistency, easier code sharing, and unified management.

System Architecture

Core Business Flows

1. Trip Lifecycle

2. Vehicle Handover

High-Level Architecture

The system uses Turborepo to orchestrate tasks like builds, testing, and development across the following components:

Applications

  • Admin Panel (apps/admin): A React-based web app for administrators.
  • Driver App (apps/driver): An Expo/React Native mobile app for drivers.
  • Backend API (apps/api): A Hono-powered server managing the data and authentication.
  • Documentation (apps/docs): The VitePress site you are currently reading.

Shared Packages

To avoid code duplication and ensure the Admin and Driver apps speak the same "language," we use shared packages:

  • @majestic-transport/schema: Houses all data validation rules (Zod schemas).
  • @majestic-transport/client: A standardized way for apps to communicate with the API.

Core Business Entities

The system revolves around several key entities:

🗺️ Trips

The primary "unit of work." A trip involves a guest, a route, a scheduled time, and a specific car and driver.

🚗 Cars & Drivers

These are the resources managed by the Admin. Drivers use the mobile app to interact with assigned cars and trips.

🔄 Car Handovers & Snapshots

To ensure vehicle safety and accountability, the system tracks "Handovers." Drivers take snapshots (photos and condition reports) when they start or finish using a vehicle.

🏢 Organizations & Companies

The system supports a multi-tenant or hierarchical structure. A user belongs to an Organization (e.g., Majestic Transport), and they may interact with different Companies (e.g., partners or subcontractors).


Technical Stack Summary

LayerTechnology
Monorepo ManagementTurborepo + pnpm
Backend FrameworkHono
Database ORMDrizzle
Web FrontendVite + React + TanStack Router/Query
Mobile FrontendExpo + React Native + NativeWind
AuthenticationBetter Auth
ValidationZod
DocumentationVitePress