How danielbcarvalho/taxi-app-react-native works
Project type and purpose
• This is a full‐stack mobile application (“WeTaxi”) built in React Native.
• Purpose: connect taxi drivers and passengers in real time, using a Socket.io server for live location/ride events and an Express REST API for authentication and data persistence.
File structure
• Top‐level folders:
• android/ and ios/ – native platform projects and configuration
• components/ – reusable UI components (forms, containers, buttons)
• screens/ – top‐level React Native screens (Login, SignUp, Passenger, Driver)
• __tests__/ – Jest tests for UI and logic
• Config files: babel.config.js, metro.config.js, .eslintrc.js – build, bundling, linting
• BaseUrl.js – client configuration for REST and Socket endpoints
• Third‐party native modules under node_modules (background geolocation, maps, navigation)
README for additional insights
• Two external services:
• Socket.io Server (real-time events)
• Express + MongoDB REST API (auth, user data, ride control)
• Uses Google Maps API for geocoding and route rendering
• React Navigation for in‐app routing
• Background geolocation for driver tracking
a. Main components:
• Mobile Client (React Native App)
– UI Layer: screens & components
– Service Layer: API client (Axios) and Socket.io client
– Native Modules: React Native Maps, Background Geolocation, Linear Gradient
• REST API Backend (Express + MongoDB)
• Real‐time Server (Socket.io)
• External Services: Google Maps Platform (Directions, Geocoding)
• Data Store: MongoDB
b. Relationships and interactions:
1. User opens app → React Navigation routes to Login / SignUp screens
2. Client uses Axios → sends HTTP requests to REST API for auth
3. Once authenticated: client opens Socket.io connection → real‐time channel for ride events
4. Passenger picks origin/destination → React Native Maps + Google APIs compute & render routes
5. Driver listens on Socket.io → receives ride requests, accepts → triggers route update
6. Driver background geolocation module reports location events → published via Socket.io → passenger view updates
7. All persistent data (users, trip records) stored/fetched from MongoDB via Express API
c. Architectural patterns & principles:
• Component‐based UI (separation of concerns between screens & shared components)
• Service abstraction: centralized baseUrl.js for endpoint configuration
• Event‐driven design for real‐time flows (Socket.io)
• Clear separation of mobile vs. backend responsibilities
d. Key technologies & libraries:
• React Native, React Navigation, Axios, Socket.io-client
• @mauron85/react-native-background-geolocation
• react-native-maps, @mapbox/polyline
• Express, Socket.io, Mongoose (MongoDB), Google Maps API
Essential details
• How authentication state flows from REST API into enabling real‐time channels
• Passenger → driver event flow: ride request → acceptance → location updates