Back to ProjectsCar Rental & Fleet Management Carvo AI-Powered Car Rental Management System
Client Car Rental Business
Project Overview Comprehensive fleet management platform with Claude AI damage detection, OCR document processing, and multi-role dashboards for modern rental operations.
Zakaria Tejjani Building things that work… eventually.
© 2025 Zakaria Tejjani. All rights reserved.
Designed & Built with ♥ using Next.js & Tailwind CSS
Technologies Used Next.js 16 React 19 TypeScript MongoDB Claude AI AWS S3
System Architecture Application Structure
carvo/
├── app/ # Next.js app directory
│ ├── (public routes) # Landing, About, Contact, FAQ
│ ├── admin/ # Admin dashboard pages
│ ├── manager/ # Manager dashboard pages
│ ├── _shared/ # Shared page components
│ └── api/ # API routes
├── components/ # React components
├── contexts/ # React contexts
├── lib/ # Utility libraries
├── prisma/ # Database schema & migrations
└── public/ # Static assets
Data Flow
User Interface (React)
↓
Next.js API Routes
↓
Prisma ORM
↓
MongoDB Database
↓
AWS S3 (File Storage)
↓
Claude AI (Processing)
Authentication Flow
Sign In Page → NextAuth → JWT Session → Protected Routes
↓
User Verification
↓
Role-Based Access
Contact & Links Developer: Zakaria TEJJANI
Email: zakaria.tejjani@gmail.com
Date: November 9, 2025
Technologies Used:
Next.js 16.0.1
React 19
TypeScript
Prisma + MongoDB
NextAuth.js
Anthropic Claude AI
AWS S3
Tailwind CSS
This case study documents the development of Carvo, a comprehensive car rental management system featuring AI-powered capabilities and modern web technologies.
Interested in Similar Solutions? Let's discuss how we can build something amazing together.
Project Overview Business Problem
Traditional car rental businesses face multiple operational challenges:
Manual damage inspection and documentation
Time-consuming customer onboarding
Complex fleet and maintenance tracking
Scattered communication and support systems
Inefficient reporting and analytics
Solution
Carvo addresses these challenges through:
AI-powered damage detection using Claude Vision API
Automated document processing with OCR technology
Centralized management dashboard for all operations
Integrated ticketing system for support and bug tracking
Real-time analytics and reporting capabilities
Project Goals
Technology Stack Frontend
Framework: Next.js 16.0.1 with Turbopack
Language: TypeScript
UI Library: React 19
Styling: Tailwind CSS
Rich Text Editor: TipTap
Form Components: React Select
Charts: ApexCharts
Icons: React Icons
Backend
Runtime: Node.js
API Framework: Next.js API Routes
Authentication: NextAuth.js v5
Prisma
Core Features 1. Multi-Tenant Dashboard
Admin Portal: Full system access with all permissions
Manager Portal: Operational access with limited permissions
Customizable branding (logo, company name)
Real-time statistics and KPIs
Interactive charts and graphs
2. Vehicle Management
Complete vehicle inventory tracking
Real-time availability calendar
Maintenance scheduling
Damage history tracking
Photo galleries for each vehicle
Category-based filtering
Bulk operations support
3. Rental Operations
Quick rental creation workflow
Customer selection and verification
Date range validation
AI Integration 1. AI-Powered Damage Detection
Technology: Claude 3 Haiku Vision API
Process:
User uploads check-out photos
System retrieves check-in photos from S3
Both photo sets sent to Claude Vision API
AI analyzes and compares images
Identifies damages with:
Damage type (scratch, dent, crack, etc.)
Location on vehicle
Severity level (minor, moderate, severe)
Estimated repair cost
Returns structured JSON response
Admin reviews and confirms findings
Cost Efficiency:
~$0.004-0.005 per detection
Processing time: 2-3 seconds
User Roles & Permissions Admin Role
Full Access:
Dashboard & Analytics
Vehicle Management (CRUD)
Rental Management (CRUD)
Customer Management (CRUD)
Employee Management (CRUD)
Damage & Maintenance (CRUD)
Website Content Management
System Settings
Backup & Restore
Reports & Export
Ticket Management (Full)
All Notifications
Manager Role
Operational Access:
Dashboard (view-only analytics)
Calendar (full access)
Vehicle Management (CRUD)
Rental Management (CRUD)
Customer Management (CRUD)
Key Modules 1. Rental Module
Features:
Multi-step rental creation wizard
Customer search and selection
Vehicle availability checking
Date range validation
Price calculation with extras (driver, insurance)
Payment status tracking
Check-in/check-out workflows
Photo documentation
Digital signatures
Rental extensions
Status management
Workflow:
New Rental → Active → Checked In → Checked Out → Completed
↓
(Extensions allowed)
↓
(Damage detection)
2. Vehicle Module
Features:
Technical Challenges & Solutions Challenge 1: Image Format Compatibility
Problem: AWS S3 stores images in various formats (JPEG, PNG, WebP), but initially hardcoded JPEG for AI processing.
Error: Image does not match provided media type image/jpeg
Solution:
// Detect actual content type from S3
const response = await fetch(url)
const contentType = response.headers.get('content-type') || 'image/jpeg'
const buffer = await response.arrayBuffer()
return {
base64: Buffer.from(buffer).toString('base64'),
mediaType: contentType // Use actual type
}
Challenge 2: NextAuth Integration with Next.js 16
Problem: ClientFetchError with NextAuth in Next.js 16 + Turbopack
Solution:
// auth.config.ts
export const authConfig: NextAuthConfig = {
trustHost: true, // Required for Next.js 16
// ... rest of config
}
Challenge 3: Async Route Parameters
Problem: Next.js 16 changed params to Promises
Database Design Schema Overview
Core Entities:
User - System users (admin/manager)
Customer - Rental customers
Vehicle - Fleet inventory
Rental - Rental transactions
Damage - Vehicle damage records
Maintenance - Service records
Notification - System notifications
Ticket - Support tickets
Content Entities:
9. Testimonial - Customer reviews
10. Stat - Homepage statistics
11. BookingStep - Booking process steps
12. - Service features
13. - Service locations
14. - Frequently asked questions
15. - Dynamic pages
16. - About page content
17. - Contact form submissions
18. - Newsletter subscriptions
Performance Optimizations 1. Image Optimization
AWS S3 for scalable storage
Next.js Image component for automatic optimization
Lazy loading for galleries
WebP format support
2. Database Queries
Indexed fields for fast lookups
Pagination for large datasets
Selective field projection
Efficient relationship loading
3. API Performance
Edge runtime where applicable
Response caching strategies
Minimal data transfer
Batch operations support
4. Frontend Optimization
Code splitting with Next.js
Dynamic imports for heavy components
Turbopack for faster builds
Security Implementation Authentication
NextAuth.js with JWT strategy
Secure password hashing (bcrypt)
Session management
CSRF protection
Authorization
Role-based access control
Page-level protection
API route guards
Action-level permissions
Data Security
Environment variable protection
Secure API key storage
MongoDB connection encryption
S3 bucket policies
Input Validation
TypeScript type safety
Zod schema validation
SQL injection prevention (Prisma)
XSS protection
Future Enhancements Planned Features
Mobile Application
React Native app for iOS/Android
Customer self-service portal
QR code vehicle check-in
Advanced Analytics
Predictive maintenance using ML
Revenue forecasting
Customer lifetime value analysis
Payment Integration
Stripe/PayPal integration
Automated invoicing
Payment reminders
GPS Tracking
Project Metrics Development Statistics
Total Files Created: 200+
Lines of Code: ~50,000+
Components: 22
Admin Pages: 42
Manager Pages: 24
Shared Pages: 21
API Routes: 66
Database Models: 19
Features Delivered
✅ Complete rental management system
✅ AI-powered damage detection
✅ Driver's license OCR
✅ Role-based access control
✅ Comprehensive ticketing system
✅ Dynamic content management
Conclusion Carvo represents a modern approach to car rental management, leveraging cutting-edge technologies to solve real-world business challenges. The integration of AI-powered features, coupled with a robust role-based architecture, provides a scalable foundation for growth.
Key Achievements
Successfully integrated AI for automated damage detection and document processing
Implemented comprehensive RBAC system for multi-tenant operations
Created reusable component architecture for maintainability
Established scalable infrastructure ready for expansion
Delivered complete end-to-end rental management workflow
Lessons Learned
AI Integration: Proper error handling and format detection are crucial for production AI features
Framework Updates: Staying current with Next.js requires careful migration planning
Type Safety: TypeScript significantly reduces bugs and improves developer experience
Code Organization: Shared components reduce duplication and maintenance overhead
Reduce vehicle check-in/check-out time by 70%
Eliminate manual data entry through AI automation
Improve fleet utilization through better tracking
Enhance customer experience with streamlined processes
Provide actionable insights through comprehensive analytics
ORM:
Database: MongoDB
AI & Cloud Services
AI Provider: Anthropic Claude API
Claude 3 Haiku (damage detection)
Claude 3.5 Sonnet (OCR processing)
Cloud Storage: AWS S3
Image Processing: Sharp
External Integrations
Data Sync: Google Sheets API
Email: SMTP integration
Payment Processing: Ready for integration
Development Tools
Version Control: Git
Package Manager: npm
Linting: ESLint
Type Checking: TypeScript compiler
Automatic pricing calculations
Multiple payment status tracking
Rental extensions
Check-in/check-out photo uploads
Digital signatures
4. Customer Management
Comprehensive customer profiles
Document upload and management
Rental history tracking
Communication logs
Driver's license verification
Email notifications
5. Fleet Maintenance
Scheduled maintenance tracking
Service history logs
Cost tracking
Vendor management
Maintenance reminders
Status workflow (scheduled → in-progress → completed)
6. Damage Management
AI-powered damage detection
Photo comparison (check-in vs check-out)
Severity assessment
Cost estimation
Repair tracking
Insurance integration ready
7. Support System
Built-in ticketing system
Priority-based queue
Status tracking (open, in-progress, resolved, closed)
Category classification
Assignment management
Resolution tracking
Timeline visualization
8. Employee Management
User account creation
Role assignment (admin/manager)
Permission management
Activity tracking
Profile customization
Bulk operations
9. Website Content Management
Dynamic testimonials
FAQ management
Feature highlights
Statistics counter
Booking steps customization
Location management
Custom page creation
10. Reporting & Analytics
Revenue reports
Fleet utilization metrics
Customer analytics
Maintenance costs
Rental trends
Exportable reports
Date range filtering
Accuracy rate: High precision with context awareness // API: /api/ai/detect-damage
- Fetches images from S3
- Detects image format (JPEG, PNG, WebP)
- Converts to base64
- Sends to Claude with comparison prompt
- Parses structured response
- Returns damage report
2. Driver's License OCR Technology: Claude 3.5 Sonnet Vision API
Customer uploads driver's license photo
Image sent to Claude Vision API
AI extracts:
Full name
Date of birth
License number
Expiry date
Address
License class
Auto-fills customer form
Admin verifies extracted data
90% reduction in data entry time
Improved accuracy
Better customer experience
Faster check-in process
// API: /api/ocr/drivers-license
- Accepts image upload
- Processes with Claude Vision
- Returns structured data
- Validates extracted information
Damage & Maintenance (CRUD)
Ticket Management (view, create only)
Documentation (view-only)
No employee management
No system settings
No website content editing
No backup access
No bulk deletions
Permission System // lib/permissions.ts
- Role-based access control (RBAC)
- Page-level permissions
- Action-level permissions (canView, canCreate, canEdit, canDelete)
- Dynamic sidebar filtering
- Protected API routes
Detailed vehicle profiles
Image galleries (S3 storage)
Specifications tracking
Availability calendar
Maintenance history
Damage history
Pricing management
Category organization
Status tracking (available, rented, maintenance)
Make, Model, Year
VIN number
License plate
Category
Transmission type
Fuel type
Seating capacity
Daily rate
Mileage
3. Customer Module
Customer profiles
Contact information
Driver's license management
Document uploads
Rental history
Communication logs
Balance tracking
Custom notes
Secure upload links (token-based)
S3 storage integration
Document verification
Expiry tracking
Email notifications
4. Maintenance Module
Maintenance scheduling
Service type categorization
Cost tracking
Vendor management
Service history
Recurring maintenance
Completion tracking
Notifications
Oil change
Tire rotation
Brake service
Engine repair
Transmission service
General inspection
Custom services
5. Calendar Module
Interactive calendar view
Rental visualization
Color-coded status
Drag-and-drop (future)
Conflict detection
Quick rental creation
Filtering options
6. Ticketing Module
Ticket creation and tracking
Priority levels (low, medium, high, critical)
Status workflow
Category classification
Assignment system
Resolution tracking
Timeline visualization
Filtering and search
Bug reports
Feature requests
Improvements
Questions
Other
Error: Route params used without await
// Before
export async function GET(req, { params }: { params: { id: string } }) {
const id = params.id
}
// After
export async function GET(req, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params
}
Challenge 4: Dynamic Currency Display Problem: Hardcoded currency symbols throughout the app
// contexts/SettingsContext.tsx
const formatCurrency = (amount: number) => {
return `${settings.currency}${amount.toFixed(2)}`
}
// Usage
{formatCurrency(rental.totalPrice)}
Challenge 5: Prisma Client Generation in Vercel Problem: Build failures due to Prisma client not regenerating
// package.json
{
"scripts": {
"postinstall": "prisma generate"
}
}
Challenge 6: Authentication Method Migration Problem: Mixed authentication methods (custom JWT vs NextAuth)
// Migrated all API routes from custom getCurrentUser() to NextAuth
import { auth } from '@/auth'
export async function GET(request: NextRequest) {
const session = await auth()
if (!session) return unauthorized()
// ... rest of logic
}
Feature
Location
FAQ
Page
AboutContent
Contact
Newsletter
Settings:
19. Settings - System configuration
Key Relationships User (1) ──────── (N) Notification
Customer (1) ──── (N) Rental
Customer (1) ──── (N) Document
Vehicle (1) ───── (N) Rental
Vehicle (1) ───── (N) Damage
Vehicle (1) ───── (N) Maintenance
Rental (1) ────── (N) Damage
Sample Schema (Rental) model Rental {
id String @id @default(auto()) @map("_id") @db.ObjectId
rentalId String @unique
customerId String @db.ObjectId
vehicleId String @db.ObjectId
startDate DateTime
endDate DateTime
totalPrice Float
paymentStatus String @default("pending")
status String @default("pending")
driverService Boolean @default(false)
insuranceCoverage Boolean @default(false)
checkInPhotos String[] @default([])
checkOutPhotos String[] @default([])
notes String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("rentals")
}
React 19 concurrent features
5. Asset Optimization
Static asset compression
CDN-ready architecture
Optimized SVG icons
Font subsetting
File Upload Security
File type validation
Size limits
Secure temporary URLs
S3 access controls
Real-time vehicle location
Geofencing alerts
Route history
Automated Marketing
Email campaigns
SMS notifications
Loyalty programs
Multi-Language Support
i18n implementation
RTL language support
Currency localization
Advanced Reporting
Custom report builder
PDF export
Scheduled reports
Integration Hub
Third-party app integrations
API marketplace
Webhook support
✅ Google Sheets integration
✅ Email notification system
✅ Real-time analytics dashboard
✅ Backup and restore functionality
Technology Impact
AI Integration Cost: ~$0.005 per transaction
Development Time Saved: 40% with code reuse
Type Safety: 100% TypeScript coverage
Build Performance: 50% faster with Turbopack
Authentication: Modern auth solutions like NextAuth simplify complex security requirements
Business Value
Reduced operational overhead through automation
Improved customer satisfaction with faster service
Better fleet utilization through tracking and analytics
Scalable architecture supporting business growth
Competitive advantage through AI-powered features