Developing Car Rental Platform
Car rental differs from property rental in several key aspects: short periods (hours, not days), strict driver license and insurance verification, mandatory vehicle condition checks before/after rental, fuel policy. This significantly changes architecture.
Data Model
Vehicle is a specific unit with history, not just "car type":
CREATE TABLE vehicles (
id BIGSERIAL PRIMARY KEY,
owner_id BIGINT NOT NULL REFERENCES users(id),
make VARCHAR(50) NOT NULL, -- Toyota
model VARCHAR(50) NOT NULL, -- Camry
year SMALLINT NOT NULL,
plate_number VARCHAR(20) UNIQUE NOT NULL,
vin VARCHAR(17) UNIQUE NOT NULL,
transmission VARCHAR(10) NOT NULL, -- auto, manual
fuel_type VARCHAR(15) NOT NULL, -- petrol, diesel, electric, hybrid
seats SMALLINT NOT NULL DEFAULT 5,
mileage_km INT NOT NULL DEFAULT 0,
location GEOGRAPHY(POINT, 4326),
insurance_expiry DATE NOT NULL,
inspection_expiry DATE NOT NULL,
status VARCHAR(20) NOT NULL DEFAULT 'available'
);
CREATE TABLE rental_bookings (
id BIGSERIAL PRIMARY KEY,
vehicle_id BIGINT NOT NULL REFERENCES vehicles(id),
renter_id BIGINT NOT NULL REFERENCES users(id),
pickup_datetime TIMESTAMPTZ NOT NULL,
return_datetime TIMESTAMPTZ NOT NULL,
pickup_location GEOGRAPHY(POINT, 4326),
return_location GEOGRAPHY(POINT, 4326),
status VARCHAR(20) NOT NULL DEFAULT 'pending',
total_amount NUMERIC(10,2) NOT NULL,
security_deposit NUMERIC(10,2) NOT NULL,
fuel_policy VARCHAR(20) NOT NULL -- 'full_to_full', 'prepaid'
);
Driver Verification
Mandatory block — without document verification platform bears legal liability. Integration with Stripe Identity or Jumio:
class DriverVerificationService
{
public function initiateVerification(User $user): string
{
$session = $this->stripe->identity->verificationSessions->create([
'type' => 'document',
'options' => [
'document' => [
'allowed_types' => ['driving_license'],
'require_id_number' => true,
'require_live_capture' => true,
'require_matching_selfie' => true,
],
],
'metadata' => ['user_id' => $user->id],
]);
$user->update([
'stripe_verification_session_id' => $session->id,
'verification_status' => 'pending',
]);
return $session->url;
}
}
Pricing: Hourly and Daily Models
Rental can be hourly, daily, or combined. Flexible calculation needed:
class PricingCalculator
{
public function calculate(
Vehicle $vehicle,
Carbon $pickup,
Carbon $return
): PricingResult {
$hours = $pickup->diffInHours($return);
$days = $pickup->diffInDays($return);
if ($hours <= 24 && $vehicle->hourly_rate) {
$base = $vehicle->hourly_rate * $hours;
} else {
$fullDays = floor($hours / 24);
$remainHours = $hours % 24;
$base = $vehicle->daily_rate * $fullDays;
if ($remainHours > 0) {
$base += $remainHours > 12
? $vehicle->daily_rate
: $vehicle->hourly_rate * $remainHours;
}
}
$multiplier = $this->getSeasonMultiplier($pickup, $vehicle->vehicle_class);
$discount = match(true) {
$days >= 30 => 0.20,
$days >= 14 => 0.15,
$days >= 7 => 0.10,
default => 0.0,
};
return new PricingResult(
base: $base,
subtotal: $base * $multiplier * (1 - $discount),
total: $subtotal + ($subtotal * $this->platformFeeRate),
);
}
}
Pre/Post Rental Inspection with Photos
Before issue and after return — mandatory condition recording. Removes disputes:
Schema::create('vehicle_inspections', function (Blueprint $table) {
$table->id();
$table->foreignId('booking_id')->constrained();
$table->enum('type', ['pre_rental', 'post_rental']);
$table->json('damage_map'); // damage coordinates on vehicle diagram
$table->json('photo_urls'); // S3 URLs
$table->integer('fuel_level'); // 0-100%
$table->integer('mileage_km');
$table->text('notes')->nullable();
$table->string('renter_signature_url')->nullable();
$table->string('owner_signature_url')->nullable();
$table->timestamp('signed_at')->nullable();
});
Signature implemented via canvas on frontend (signature_pad.js), base64 image → S3. After both sign, status becomes signed and document legally significant.
GPS Tracking and Telematics
For fleets 20+ vehicles often need live tracking. GPS tracker integration via MQTT:
class VehicleTelematicsHandler
{
public function handle(string $topic, string $payload): void
{
preg_match('/vehicles\/(.+)\/location/', $topic, $matches);
$plate = $matches[1];
$data = json_decode($payload, true);
DB::transaction(function () use ($plate, $data) {
$vehicle = Vehicle::where('plate_number', $plate)->firstOrFail();
$vehicle->update([
'location' => DB::raw(
"ST_MakePoint({$data['lng']}, {$data['lat']})"
),
'mileage_km' => $data['odometer'] ?? $vehicle->mileage_km,
'last_seen_at' => now(),
]);
if (isset($vehicle->activeRental)) {
$this->checkGeofence($vehicle, $data);
}
});
}
}
Security Deposit and Charges
Deposit blocked on card on booking, charged only on damage:
$paymentIntent = $stripe->paymentIntents->create([
'amount' => $booking->security_deposit_cents,
'currency' => 'eur',
'capture_method' => 'manual',
'confirm' => false,
]);
// No damage — cancel hold
$stripe->paymentIntents->cancel($paymentIntent->id);
// Damage — capture needed amount
$stripe->paymentIntents->capture($paymentIntent->id, [
'amount_to_capture' => $damageAmount,
]);
Development Timeline
MVP with search, booking, driver verification, owner cabin: 8–10 weeks.
Adding inspections, GPS, flexible pricing, deposit logic: another 4–5 weeks.
Full launch with corporate accounts, fleet management, analytics: 16–18 weeks total.







