How johnkgs/kivy-order-app works
Project type and purpose
• This is a distributed system for managing “orders” in a teaching context (“Programação Distribuída e Paralela”).
• It consists of three cooperating services (API, Queue worker, and UI client) plus an embedded message broker (ActiveMQ) and a local database (SQLite).
Main components
A. API service (order_app/api)
• FastAPI (or similar) application defined in main.py.
• Exposes REST endpoints under modules/orders (order_router.py, order_schemas.py).
• Persists order data to api/db/orders.db via order_repository.py.
• Publishes “new order” events to the message broker.
B. Message broker (ActiveMQ)
• Defined in the activemq folder and orchestrated via docker-compose.yaml.
• Routes messages between producers (API) and consumers (Queue worker).
C. Queue worker (order_app/queue)
• Connects to ActiveMQ (settings in config/settings.py).
• Listens on the “order” queue (queues/order_queue.py).
• On receipt, processes the order (e.g., logging, forwarding, analytics).
• Optionally writes results back to the database or calls external services.
D. UI client (order_app/web)
• Kivy-based GUI (files ending in .kv and *.py under pages and uix).
• Provides two screens: list existing orders and add a new order.
• Interacts with the API via order_service.py (HTTP calls).
E. Shared database
• SQLite file under api/db/orders.db.
• Used by the API for reads/writes; can also be accessed by the queue worker if needed.
Relationships and interactions
• UI → API: HTTP GET/POST over REST to retrieve and create orders.
• API ↔ SQLite: direct file-based database connection.
• API → ActiveMQ: publishes “order.created” messages.
• ActiveMQ → Queue worker: delivers messages to the consumer queue.
• Queue worker → (optional) Database or external system: processes the event.
Architectural patterns & design principles
• Microservices / modular monolith split into three logical services.
• Event-driven / message-based communication between API and worker.
• Single source of truth for data (SQLite) with clear separation of read/write paths.
• Client-server pattern for the UI and API.