How lovish888/care-ai works
Main Components
• Frontend: This side (located in the “frontend” directory) is built with TypeScript and Vite, and it includes several React components (e.g., ChatFeedback, ChatHistory, LandingPage, Layout, MainMenu, and SupportChat) that provide the user interface.
• Backend: Found in the “backend” directory, the backend is implemented in TypeScript with entry points like “index.ts” and “socket.ts”. It hosts the core functionalities of the server.
• Agents Modules: Under “backend/src/agents” you have various agent implementations (coinbaseAgentKit, ecommerceAgent, ecommercePrompt, foodDeliveryagent, and foodDeliveryPrompt) that encapsulate domain-specific logic.
• Blockchain Module: Within “backend/src/blockchain” there’s at least one module (chatLogger.ts) intended to handle blockchain interactions or logging, possibly for ensuring message integrity or persistent audit logs.
• Storage Module: The “backend/src/storage” directory contains modules like “zeroGStorage.ts” which likely handles data persistence or caching.
• Types and Configurations: The “backend/src/types” directory and various configuration files (tsconfig.json, environment examples) provide the supporting infrastructure to ensure type safety and proper environment-specific configurations.
Relationships and Interactions
• Client-Server Communication: The frontend interacts with the backend via HTTP requests and likely through WebSockets (given the presence of “socket.ts” in the backend) for real-time chat updates.
• Agent Interaction: The backend routes specific tasks to agent modules to process different kinds of requests (e.g., ecommerce, food delivery, Coinbase integrations). Each agent is a self-contained component offering specialized functions.
• Logging and Storage: The backend integrates with a blockchain-logging mechanism (chatLogger.ts) to record interactions, and a storage module (zeroGStorage.ts) to persist or retrieve relevant data.
• Data Flow: User actions on the frontend trigger events or HTTP calls to the backend. The backend then directs these requests to the appropriate agent module, which may then interact with external services, update the blockchain log, or access persistent storage.
Architectural Patterns and Key Design Principles
• Separation of Concerns: The project is clearly divided between frontend (presentation layer) and backend (business logic), with additional modularization of the agents.
• Real-time Communication: The presence of a dedicated socket module suggests real-time events and data synchronization between the client and server.
• Modular Agent Design: Each agent encapsulates its domain logic making the system highly extensible and maintainable.
• Configuration Management: The use of environment variables (via .env files) and clear directory separation emphasizes ease of configuration for different deployment environments.
• Layout:
• API Server / Entry Points (index.ts, socket.ts).
• Blockchain Logger Module.
• Storage Module.
• Flow:
• User inputs on frontend -> API/Socket communication -> routed to appropriate Agents.
• Agent results -> update logs via Blockchain module.
• Data persistence queries directed to Storage module.
• Annotation: