High-Level Architecture
Relevant source files
The following files were used as context for generating this wiki page:
Driveway Estimator Pro is a professional-grade full-stack application designed to facilitate driveway measurements and cost estimation using AI-powered vision and real-time regional pricing. The system is built with a mobile-first approach, leveraging a React-based frontend wrapped in a native container for iOS and Android, supported by a Node.js backend with a type-safe API layer.
The architecture centralizes around a project lifecycle that begins with image capture, proceeds through AI-assisted edge detection and manual refinement, and culminates in material visualization, pricing calculation, and contractor sharing.
Sources: README.md:1-20, todo.md:1-15
System Component Overview
The application follows a standard client-server model with additional integrations for native mobile features and external AI services.
Core Technology Stack
| Layer | Technologies |
|---|---|
| Frontend | React 19, TypeScript, Tailwind CSS 4, tRPC Client |
| Backend | Express.js, tRPC Server, Drizzle ORM |
| Mobile | Capacitor, @capacitor/camera, @capacitor/geolocation |
| Database | MySQL / TiDB |
| AI/Services | LLM Vision (Edge Detection), Image Generation (Previews), jsPDF (Exports) |
Sources: README.md:44-70, easy-asphalt/package.json:1-20
Architecture Flow
The following diagram illustrates the high-level interaction between the user interface, the tRPC API layer, and the supporting services.
The diagram shows how the React frontend utilizes tRPC to communicate with specific backend services while native plugins handle hardware-level tasks like camera access.
Sources: README.md:72-88, todo.md:18-35
Data Architecture
The system utilizes a relational database managed via Drizzle ORM to maintain consistency across users, driveway projects, and regional pricing data.
Entity Relationships
The database schema is divided into four primary tables: users, projects, projectShares, and materialPrices.
The schema establishes a strict ownership model where projects are linked to users, and shares are transient entities allowing public access via unique tokens.
Sources: drizzle/schema.ts:15-120, server/db.ts:35-150
Core Backend Services
The backend logic is modularized into services that handle complex domain calculations and external integrations.
Pricing and Estimation Service
The pricing service calculates material quantities by converting driveway dimensions (Square Feet and Depth) into cubic yards, and subsequently into tons based on material density.
- Hot Mix Asphalt: High density (1.5 tons/cu yd)
- Asphalt Millings: Medium density (1.3 tons/cu yd)
- Gravel: Lower density (1.0 ton/cu yd)
The service includes a caching layer that stores regional material prices indexed by ZIP code to minimize redundant external API calls or database lookups.
Sources: server/services/pricing.ts:1-100, todo.md:70-75
PDF Export Service
The system provides professional summaries through a dedicated export service. It leverages jsPDF to generate documents containing project measurements, material specifications, and costs.
- Client-side: Used for immediate browser downloads in the project detail view.
- Server-side: Used for generating attachments or persistent reports.
Sources: server/services/pdfExport.ts:1-90, client/src/pages/ProjectDetail.tsx:75-100
Project Lifecycle & Data Flow
The lifecycle of a driveway estimate involves a multi-stage process from initial capture to final contractor communication.
This flow ensures that heavy computations, such as edge detection and pricing lookups, are offloaded to the server while providing a responsive UI for user adjustments.
Sources: README.md:110-130, todo.md:18-45, server/services/pricing.ts:40-80
Mobile Infrastructure
The application is deployed as a native mobile app using Capacitor, allowing the same codebase to run on iOS and Android while accessing device-specific hardware.
| Component | Description |
|---|---|
| Native Wrapper | Capacitor provides the bridge between the Webview and native APIs. |
| Permissions | Managed via Info.plist (iOS) and AndroidManifest.xml (Android) for Camera and Location. |
| Build Pipeline | pnpm mobile:build prepares assets; npx cap sync updates native projects. |
Sources: MOBILE_BUILD.md:1-50, MOBILE_BUILD.md:150-175
Conclusion
The Driveway Estimator Pro architecture successfully combines a modern React frontend with a type-safe tRPC backend to manage complex data transformations. By modularizing AI vision, pricing logic, and PDF generation into distinct services, the system maintains scalability while delivering a native-like experience on mobile devices through Capacitor integration.
Sources: README.md:1-230, todo.md:1-120