Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Architecture and Tech Stack #3

Open
chriscoderdr opened this issue Oct 22, 2024 · 4 comments
Open

Architecture and Tech Stack #3

chriscoderdr opened this issue Oct 22, 2024 · 4 comments
Assignees
Labels
architecture Architecture tasks in-progress In Progress

Comments

@chriscoderdr
Copy link
Owner

Research task on architecture and tech stack in preparation to the project

@chriscoderdr chriscoderdr self-assigned this Oct 22, 2024
@chriscoderdr chriscoderdr added the architecture Architecture tasks label Oct 22, 2024
@chriscoderdr
Copy link
Owner Author

chriscoderdr commented Oct 22, 2024

Morro Taxi - Architectural Decisions Summary

Mapping & Location Services

  • Mapbox will be used for maps and navigation due to its more scalable pricing model compared to Google Maps.
  • PostgreSQL with PostGIS extension will be utilized for geospatial data management, including features like latitude and longitude handling.
  • OpenMaps OverPass API/OverPass QL will be used for place queries, such as identifying landmarks and addresses.

API Security & Backend Integration

  • All API requests requiring sensitive keys (e.g., Mapbox, OpenMaps) will be routed through the backend to protect API keys from exposure, particularly in the mobile app's APK files.

State Management

  • The app will utilize Redux for global state management, with Redux Toolkit for simplifying the setup and reducing boilerplate code.

Mobile Development Framework

  • The mobile app will be developed using Expo, which provides a streamlined development experience for React Native applications.

Backend Architecture

  • Express.js will serve as the backend framework for managing API requests, authentication, and communication between the app and server.
  • Redis will be used to store ephemeral data, enabling quick access to frequently updated or temporary information.

Real-Time Communication

  • MQTT will be used for real-time communication between drivers and the system, providing more reliable and timely updates than traditional push notifications.
    • Client-side MQTT: Implemented using paho-mqtt.
    • Server-side MQTT: Implemented using mqtt.

Authentication

  • JWT (JSON Web Tokens) will handle user session management, ensuring secure communication between the app and the backend.

Admin Panel

  • The admin panel will be built with Next.js, offering a fast and efficient user interface for managing the system's backend tasks, including user management, trip statistics, and other admin actions.

Quality Assurance (QA) Testing

  • Detox will be used for end-to-end testing of the mobile app, given its strong React Native support and active community.
  • Playwright will handle web testing for the admin panel, chosen for its speed, robust multi-browser support, and simple parallelization.

Data Fetching & Mutations

  • Tanstack Query will be used to manage data fetching and mutation processes, providing fine-grained control over caching, refetching, and managing asynchronous data within the app.

UI Component Library

  • To accelerate the mobile app's UI development, the react-native-ui-lib library from Wix will be used for pre-built, customizable components.

ERD

Image

FlowChart

Image

@chriscoderdr
Copy link
Owner Author

This task won't be close, will keep updating

@chriscoderdr chriscoderdr added the in-progress In Progress label Oct 22, 2024
@chriscoderdr
Copy link
Owner Author

chriscoderdr commented Oct 23, 2024

@chriscoderdr
Copy link
Owner Author

Architectural Decision: Choosing BullMQ for Queuing in Morro Taxi

Why We Chose BullMQ Over Other Queuing Libraries

In Morro Taxi, we need a robust queuing system due to the volume and complexity of ride requests that must be processed concurrently and distributed effectively to nearby drivers. After evaluating various options, including Bee-Queue and Kue, BullMQ emerged as the optimal choice.

Reasons for Choosing BullMQ

  1. Advanced Control and Concurrency Management:
    BullMQ supports advanced job prioritization, rate limiting, and concurrency settings. This is crucial in Morro Taxi to manage thousands of ride requests, ensuring that the nearest drivers are efficiently notified, and unassigned rides are rapidly reassigned.

  2. Reliability and Redis Integration:
    Built on top of Redis, BullMQ provides reliable, in-memory queuing with durability options, enabling Morro Taxi to handle large-scale requests with high resilience. It also offers delayed jobs and retry mechanisms, making it ideal for managing ride requests with multiple potential retries.

  3. Ease of Monitoring:
    BullMQ offers in-depth tooling and monitoring options, which allow for real-time insights into the queue's state, job progress, and error handling, crucial for managing an app like Morro Taxi with fluctuating demand and critical uptime needs.

  4. Scalability for Parallel Processing:
    Given Morro Taxi's requirement to manage thousands of concurrent ride requests, BullMQ’s parallel processing and horizontal scaling are key to achieving high throughput while maintaining queue integrity and performance.

Why We Need a Queue in Morro Taxi

In Morro Taxi, a queuing system is essential to efficiently process ride requests and assign them to available drivers based on proximity and availability. Here’s why:

  • Driver-User Matchmaking:
    When a ride request is made, it enters the queue. The system checks for nearby drivers and attempts to match the request with the most suitable driver based on distance. Queuing allows for rapid, fair, and organized assignment.

  • Retry and Reassignment Logic:
    If a driver does not accept a ride within a specific time frame, the request needs to be reassigned to other nearby drivers. BullMQ’s queuing supports automatic retries, ensuring the request is quickly reassigned without manual intervention.

  • Load Management:
    With potentially thousands of requests at peak times, Morro Taxi needs a system that can manage a high volume of concurrent events. BullMQ allows requests to be processed efficiently in parallel, preventing server overload and ensuring that requests are processed in real-time.

In summary, BullMQ was chosen for its concurrency control, Redis integration, scalability, and ease of monitoring, all critical features for supporting Morro Taxi's real-time ride request processing and driver allocation system.

@chriscoderdr chriscoderdr pinned this issue Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Architecture tasks in-progress In Progress
Projects
None yet
Development

No branches or pull requests

1 participant