How libardolopezdev/ruta-pro-drive works
Project type and purpose
• Ruta Pro Drive is a full-stack web application for taxi/ride-share drivers to track services, calculate income/expenses, generate statistics, and manage preferences.
• Frontend: React + TypeScript (Vite, Tailwind CSS, shadcn-ui)
• Backend: Node.js REST API (connects to PostgreSQL)
• Database: PostgreSQL
File structure
• Top-level assets:
• public/ (static HTML, robots.txt)
• index.html, vite.config.ts, tailwind.config.ts
• Frontend app under src/:
• src/pages/ – route-level components (Index, NotFound)
• src/components/ – UI broken into Layout, Dashboard, Onboarding, Settings, Statistics, Tracking, Testing, plus shadcn-ui component library in ui/
• src/context/ – React Context for global state
• src/hooks/ – custom hooks (use-mobile, use-toast)
• src/lib/ & src/utils/ – reusable utilities and test data generators
• src/types/ – TypeScript type definitions
• main.tsx/App.tsx – app entry, routing, context provider
• Missing in file tree: backend folder (assume a Node.js/Express project lives parallel to src/, connects to .env, defines REST endpoints)
Key README insights
• Client-server architecture over RESTful APIs
• Use of agile Kanban, automated builds (npm run build → dist/)
• Deployment on Vercel/Netlify/GitHub Pages or Railway
a. Main components to include
• Web Browser / Client
– React App (AppLayout, Navbar)
– Modules: OnboardingFlow, Dashboard, Tracking (DayStart, DayEnd, IncomeEntry, ExpenseEntry), Statistics, Settings, Testing
– UI library (shadcn-ui primitives under src/components/ui)
– Context & Hooks (state management)
• API Layer
– HTTP/HTTPS endpoints served by Node.js backend
– Authentication middleware (if any)
• Business Logic
– Services for route registration, peaje deduction, report generation
• Data Layer
– PostgreSQL database (tables for services, drivers, platforms, reports, preferences)
• External services
– Payment gateways or mapping/geolocation APIs (if applicable)
– CDN or object storage (if static assets served externally)
b. Relationships & interactions
1. User interacts via browser → React UI events → React Router/Context triggers
2. React issues HTTP requests to backend endpoints (e.g., /api/services, /api/reports, /api/settings)
3. Backend controllers process requests, call service layer, interact with PostgreSQL via ORM/Query Builder
4. Database returns records → business logic applies peaje deductions and statistics calculations → response returned
5. React updates Context state & re-renders UI components
c. Architectural patterns & design principles
• Component-based UI (separation of concerns into Layout, feature modules, UI primitives)
• Single Page Application (SPA) with React Router for page navigation
• Context API + custom hooks for global & cross-cutting concerns (mobile detection, toasts)
• Layered architecture on backend (routers → controllers → services → data access)
• RESTful communication between client and server
• Configuration via environment variables (.env)
d. Key technologies/frameworks
• Frontend: React, TypeScript, Vite, Tailwind CSS, shadcn-ui
• Backend: Node.js, Express (or similar), npm scripts
• Database: PostgreSQL
• DevOps: Vercel / Netlify / Railway, GitHub Actions for CI/CD
Essential details
• Major UI modules and their dependencies on Context/hooks
• API endpoints corresponding to each feature (e.g., /services, /reports)
• Data models (ServiceRecord, DriverProfile, ReportSummary) if space permits
• Document any asynchronous flows (e.g., long-running report generation)