How varsharc/intention-ally works
Main Components
a. Frontend:
• Framework: Next.js (React) – look at the “pages”, “components”, and “frontend” directories.
• Features include dashboards, search configuration screens, results displays, and visualizations (knowledge graphs with D3.js).
• State management using React Context (see contexts folder).
• UI components (SearchBar, MainDashboard, AuthModal, etc.) spread across both “components” and “pages” directories.
b. Backend / Service Layer:
• Python-based services (backend directory containing api.py, scheduler.py, models.py, brave_search.py, and storage.py) that likely handle semantic search logic, clustering, and scheduling tasks.
• Node.js servers and scripts (app-server.js, express-server.js, next-app-server.js, server.js, etc.) that may act as API gateways or integration points.
• “services” directory holding API wrappers for authentication (auth.js), Firebase integration, authority management, and Supabase, providing an abstraction over external APIs.
c. External Integrations:
• Firebase: Used for authentication (Firebase Auth) and data persistence (Firestore); see components/ and contexts/FirebaseContext.js.
• Tavily API: For semantic search integration as described in the README, with fallback to mock data in settings.
• Brave Search (backend/brave_search.py) as a potential search data source.
d. Data and Storage:
• Databases and collections in Firebase (user information, search configurations, and search results/clustering data).
• Data files (JSON in the “data” directory) to mock or test search results.
Relationships and Interactions
• The Frontend (Next.js) consumes both internal APIs (from your backend services and “services” layer) and external services (Firebase, Tavily API).
• User interactions on the frontend trigger API calls (likely via the “services/api.js”) to fetch and configure searches, handle authentication, or retrieve search results.
• The Backend (Python scripts and Node.js APIs) performs the semantic analysis, clustering, or data enrichment using inputs from the frontend, and then persists or retrieves data from Firebase.
• External API calls (to Tavily and Brave Search) are mediated by the backend, feeding search data back to the frontend.
• Firebase also functions as the persistence layer (storing user profiles, search configurations, and results).
Architectural Patterns and Design Principles
• Separation of concerns: Clearly partition the frontend visual/UI layer from the backend processing and API integration.
• Use of microservices/API gateway pattern: The modular “services” and “backend” directories indicate separate responsibilities (e.g., search, authentication, authority scoring).
• Integration of third-party services: Firebase for auth and data, external search APIs (Tavily/Brave Search) for semantic search.
• State management via React Context and modular component design for easy scalability.
Relevant Technologies, Frameworks, and Libraries
• Frontend: Next.js, React, Tailwind CSS, D3.js.
• Backend: Python (for api, scheduling, and search logic), Node.js (for serving Next.js and other API endpoints).
• Data Persistence: Firebase Firestore and Firebase Authentication.
• External APIs: Tavily API and Brave Search.
• Build tools and configuration: Webpack (as seen in the .next cache) and Tailwind configuration files.
Detail and Clarity
– Frontend pages/components (Home, Search Configuration, Search Results, and Settings).
– Functional modules in the Backend (API endpoints, semantic search logic, scheduling, and storage).
– Data components (User, Search Configurations, Search Results) along with how they are stored in Firebase Firestore.
– Integration points for external APIs.
• Avoid unnecessary over-complication but do partition the system into distinct sub-components for clear understanding.