How i-dot-ai/redbox works
• a Django web application (found in the “django_app” directory) that provides the front end (built with modern JS tooling, Parcel, and custom web components) and the web server/API for user interactions,
• and a separate core AI library (found in “redbox-core”) that encapsulates the logic for working with GenAI, including chat, summarisation, LangChain/ Langgraph integration, and AI settings.
Main components
– User Interface / Frontend:
◦ Represents the client side (web browser) that interacts with the application.
◦ Includes static assets built by Parcel, custom web components (e.g., chat controllers, document upload components), and CSS/JS bundled in “django_app/frontend”.
– Django Backend Application:
◦ Acts as the server-side layer.
◦ Contains “redbox_app” with views, API endpoints, authentication, and management commands.
◦ Uses Django templates (for pages like chats, sign-ups, accessibility statements, etc.) and integrates static assets.
– Redbox-Core AI Library:
◦ Encapsulated in “redbox-core” and responsible for all AI functionality such as processing chat requests, summarisation, and handling dynamic AI settings (set per request).
◦ This component integrates with external AI services (LLMs such as GPT-4, as mentioned) and also likely uses LangChain/Langgraph.
– Data Storage and Infrastructure:
◦ Although not shown explicitly within the Django app code, the infrastructure folder (with AWS terraform files) indicates a deployed environment that includes services such as RDS/Postgres, S3 for object storage, and possibly Elasticsearch as noted in “data/elastic-dumps”.
◦ There is also a “queue” folder for task queuing and the use of django-q for scheduled tasks.
– Containerization and Deployment:
◦ The Dockerfiles (in both “django_app” and “redbox-core”), docker-compose.yml, and GitHub workflow files indicate that containerisation (using Docker/ECS) is a key part of the deployment pipeline.
◦ Deployment components include CI/CD pipelines, AWS infrastructure definitions (infrastructure/aws), and scheduled tasks managed via docker-compose and terraform.
– Begin at the Browser/User:
– Django Backend:
◦ Internally, show a module break-down of the Django app:
▪ “redbox_app” for views and endpoints.
▪ “frontend” for static asset delivery.
▪ “tests” and “management commands” for scheduled tasks (django-q).
– AI Core:
◦ Use directed lines to indicate calls from Django to redbox-core (e.g., when a chat message is received, summarisation is requested, etc.).
◦ Annotate that dynamic AI settings are passed in per-request and that redbox-core uses LangChain/LangGraph.
– Data and External Services:
◦ Represent a “Database” (likely PostgreSQL, given the AWS RDS Terraform files) connected to the Django Backend.
◦ Optionally, show “Object Storage” (S3) for static file storage and “Search/Elastic” components (referencing the elastic-dumps directory) if relevant.
– Infrastructure / Deployment Flow:
◦ Add ancillary blocks for “Container Registry (ECR)” and “Deployment Orchestration (AWS ECS/Load Balancer)” to capture the deployment flow.
◦ Include CI/CD components (represented by GitHub Actions workflows) and configuration for tasks (terraform, Docker).
Architectural patterns and design principles
– Separation of concerns: The division between the Django web frontend/backend and the AI engine in redbox-core.
– Containerisation: Use of Docker for both Django and core library, implying encapsulated environments.
– Micro-modularity: Even though the application is not microservices-based in a classical sense, the redbox-core library is a distinct module that can be independently tested and evolved.
– Scalability and External Integration: AWS infrastructure elements indicate that the system is designed to scale and interact with external managed services (RDS, S3, etc.).
▪ For example, use blue for frontends, green for business logic (Django & redbox-core), and grey for external systems.
– Make sure to include any supporting elements such as testing pipelines (e.g., GitHub workflows) since they impact the runtime integration and deployment lifecycle.
• The separation between the web-facing Django app and the underlying GenAI processing in redbox-core.
• The interactions via API calls and scheduled tasks.
• Deployment components that outline how containerization, cloud infrastructure, and CI/CD pipelines come together.