Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

distributedwebap

A high-level design document, on a system designed to handle device status updates and requests in a scalable, real-time manner using a microservices architecture. This system employs Kafka for messaging, MongoDB for data storage, Flask/FastAPI for the API gateway, and React for the frontend, with authentication handled via Okta. The architecture also incorporates WebSockets for real-time communication between the server and clients.

System Overview

Components:

  • Frontend: React application
  • API Gateway Interface (AGI): Flask/FastAPI
  • Messaging System: Kafka
  • Database: MongoDB
  • Scheduler/Status Service: Python microservice
  • Authentication: Okta

Key Features:

  1. Real-time UI updates.
  2. Scalable messaging via Kafka.
  3. Efficient data storage and retrieval with MongoDB.
  4. Secure authentication and authorization with Okta.

Detailed Component Design:

A) Frontend (React Application)

  • Implements user interfaces for device status monitoring.
  • Uses WebSockets (via Socket.IO-client) for real-time communication with the backend.
  • Integrates with Okta for user authentication and authorization.

B) API Gateway Interface (AGI) (Flask/FastAPI)

  • Handles HTTP requests from the frontend, including device status requests.
  • Authenticates requests using Okta SDKs, ensuring secure access.
  • Publishes messages to Kafka topics for backend processing.
  • Listens for responses from Kafka topics to relay back to the frontend via WebSockets.

C) Kafka Cluster

  • Facilitates decoupled, asynchronous communication between services.
  • Utilizes topics for device status requests and updates.
  • Employs partitioning and offset management for scalable message processing.

D) MongoDB Database

  • Stores device status information and other relevant data.
  • Provides efficient data access for the Scheduler/Status Service.

E) Scheduler/Status Service

  • Subscribes to Kafka topics to process device status requests.
  • Checks MongoDB for device status; if outdated, fetches new status.
  • Publishes status updates back to Kafka for relay to the AGI and then to the frontend.

F) Authentication (Okta)

  • Manages user authentication and role-based access control.
  • Integrated with the React frontend and Flask/FastAPI backend.

End-to-End Flow

i.User Interaction: Users log in through the React frontend, authenticated via Okta.

ii. Request Handling: The frontend sends device status requests to the AGI, which authenticates the request and publishes it to a Kafka topic.

iii. Processing: The Scheduler/Status Service consumes the request, checks MongoDB for current status, and possibly fetches new status if needed.

iv. Response Handling: Updated status information is published to a Kafka response topic, consumed by the AGI, and then sent back to the frontend via WebSockets.

v. Real-time Update: The frontend updates the UI in real-time with the received device status information.

Additional Considerations

i. Scalability: The system is designed to scale horizontally, with Kafka and MongoDB supporting high volumes of data and requests. Load balancing can be applied to the AGI and Scheduler/Status Service for additional scalability.

ii. Security: Secure communications using HTTPS/WSS, and ensure secure configurations for Kafka and MongoDB. Use Okta for robust authentication and authorization.

iii. Reliability: Implement retry mechanisms, error handling, and logging throughout the system to ensure reliability and ease of debugging.

iv. Monitoring: Employ monitoring tools to track system performance, Kafka throughput, and database performance.

Conclusion This high-level design document outlines a scalable, real-time system for managing and monitoring device statuses. By leveraging modern technologies and architectural patterns, the system is well-equipped to handle real-time data processing, secure user interactions, and scalable backend processing, providing a robust solution for device status management.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors