How 2024-arizona-opportunity-hack/harora-pajaritoenvironmenta-frommediaoverloadtoseamlessorganization works
Based on our analysis of the provided file tree and README file, this project is a cloud-based, full-stack media content search and automated tagging system tailored for nonprofits. The system employs a modern architecture that separates concerns into a frontend (built in React), a FastAPI-based backend (with several modular Python scripts handling API endpoints, database operations, and integration with AI and Dropbox), and a Postgres database (managed through Docker). Additionally, there are containerization components (Dockerfiles, docker-compose files) to simplify deployment in both development and production (“release”) environments.
Main Components
• Frontend Components:
• Two separate React-based frontend applications (located in frontend/web_app and frontend/web_app_2). These handle the user interface, media uploads, search, and authentication.
• Backend Components:
• The FastAPI server (shown by the primary script api.py) that exposes REST APIs.
• Specific service modules for tasks such as file downloads (download.py), database interactions (db.py, data_models.py), search functionality (search.py), process orchestration (process.py), and structured AI output (structured_llm_output.py).
• Dropbox integration (dropbox_integration.py) signifies integration with external cloud storage.
• Database:
• A Postgres database managed via scripts (DDL.sql, changes_to_db.sql, init-db.sh) and containerized within the “database” directory.
• Infrastructure & Containerization:
• Dockerfiles in backend, frontend, and database directories.
• docker-compose files orchestrating the multi-container environment.
• Nginx is present (with separate configurations in nginx/dev and nginx/release) to route requests between frontend, backend, and external services.
• Supporting Documents and Configurations:
• Documentation files, user guides, and configurations for linting (pre-commit, prettier, eslint) that ensure code quality.
Relationships and Data Flow
• The frontend (both web apps) communicates with the backend API endpoints.
• The FastAPI backend processes requests, interacts with the Postgres database for storing/retrieving tagged media data, and calls AI modules (CLIP, GPT-4 Mini, Llama-3.1) for automated tagging and metadata extraction.
• There is a direct integration with the Dropbox API for both file upload and management.
• The Nginx server acts as an entry point and proxy server, directing incoming HTTP traffic to the appropriate container (frontend or backend) based on the URL paths.
• Docker Compose is used to start and interconnect these containers in both development and production (release) modes.
Architectural Patterns and Design Principles
• Separation of Concerns: The system splits responsibilities between UI (frontend), business logic (backend), data-storage (database), and external integrations (Dropbox, AI models).
• Containerization: Using Docker and docker-compose to ensure consistency across environments.
• Microservice-like Modularity: Even though it is a monolithic repository, different backend modules handle distinct responsibilities.
• API-First Design: The backend exposes REST endpoints that the frontend calls.
Relevant Technologies, Frameworks, and Libraries
• Frontend: React.js, Vite, TailwindCSS, ESLint/PostCSS for builds and styling.
• Backend: FastAPI (Python), Uvicorn for ASGI server functionality, integration with various Python libraries for AI functionalities.
• Database: Postgres alongside migration and initialization scripts.
• Containerization: Docker, docker-compose.
• Reverse Proxy: Nginx to manage HTTP routing.