How mariopb05/ranquiz works
Main Components
• API Application:
• Contains controllers (in api/controllers) that handle incoming HTTP requests.
• Models (in api/models) define the data structure and database interactions.
• Services (in api/services) encapsulate business logic (e.g., list, notification, user, category operations).
• Forms and migrations also indicate the underlying database evolution.
• Routing (in api/routing.py) maps URL endpoints to controllers.
• Core Application:
• Deals with handling requests related to the frontend.
• Uses views (core/views.py) and templates (located in the templates directory within subdirectories such as base, components, pages) to render the UI.
• Acts as the presentation layer interfacing directly with end-users.
• Websockets Application:
• Manages real-time bi-directional communication using WebSockets for instant notifications (see websockets/consumers.py and websockets/routing.py).
• Enables live updates, such as new comments or changes to user lists.
• External Services and Infrastructure:
• MariaDB: The database backend storing all persistent data.
• Cloudinary: Manages image uploads and storage in the application.
• Gmail (via SMTP): For sending transactional or notification emails.
• Static Assets: Includes JavaScript, CSS, and media resources (static/ directory) to support the client-side UI.
Relationships and Interactions
• The Frontend (handled by the Core application) interacts with the API layer. When a user creates, edits, or explores lists, the request goes to the API controllers which coordinate with models and services.
• API services abstract the business logic and directly manipulate the models; these services can be invoked from controllers or even via asynchronous channels.
• Websockets maintain a persistent connection with clients, pushing notifications or real-time updates, and they may also feed off changes in the API/database.
• The static assets and templates support the Core’s views, providing a rich user experience.
• All components interact with MariaDB for data persistence, while external services such as Cloudinary and Gmail are integrated via settings and environment variables.
Architectural Patterns and Technologies
• MVC / MTV Pattern: Separation between data (Models), business logic (Controllers/Services), and presentation (Views/Templates).
• Modular App Architecture: Dividing the system into API, Core, and Websockets promotes separation of concerns and allows for easier scalability and maintenance.
• Real-Time Communication: Use of Websockets adds a layer for live notifications, complementing the traditional request/response of HTTP.
• Consistency with Share Codes: A standardized mechanism used across various models to maintain resource identifiers uniformly.