How muraschal/meta works
Main Components
• External Clients & Devices:
• Meta Glasses: The primary device sending commands and receiving responses.
• WhatsApp Business API: Used for communication and webhook callbacks.
• OpenAI GPT-4 Vision: The AI service engaged for image and language processing.
• API Server / Entry Point:
• The main Node.js server that ties together all functionality (entry point is defined in src/index.js and index.html, which could serve as a landing page or testing interface).
• REST API Endpoints:
• Found in the “api” directory (health.js, logs.js, system-info.js, webhook.js, etc.). These endpoints are used to monitor system health, log data, or handle webhook callbacks.
• GraphQL API:
• Located in “src/graphql” (with schema.js). This exposes a more flexible API endpoint (accessible via http://localhost:3000/graphql) that clients can query for extended functionality.
• Service Modules:
• In the “src/services” directory, there are integrations for “openai.js” (handling communication with OpenAI) and “whatsapp.js” (handling WhatsApp messaging).
• Webhook Processing:
• Handled by modules in both “api” (api/webhook.js) and “src/webhooks” (whatsapp.js) to capture and process real-time callbacks from WhatsApp or Meta Glasses events.
• Deployment & Configuration:
• Files like package.json, vercel.json, and .env.example highlight that the project leverages environment-based configurations and is potentially deployed on Vercel.
Relationships and Interactions
• The External Devices (Meta Glasses, WhatsApp Business API, and OpenAI) interact with the API Server.
• REST endpoints in the “api” folder are used for operational tasks like health checking, system info, and log retrieval.
• The GraphQL API (originating from the “src/graphql” folder) serves as an extensible layer for querying and possibly mutating data.
• Service modules (OpenAI and WhatsApp) encapsulate the integration logic—the API Server calls these modules to perform tasks such as sending commands or receiving responses.
• Webhook handlers (both in “api” and “src/webhooks”) provide a communication pathway for real-time updates from WhatsApp and, indirectly, Meta Glasses.
• The project uses WebSocket for real-time communication, ensuring low-latency interactions.
Architectural Patterns & Design Principles
• Modularity: The code is separated into distinct folders for API endpoints, GraphQL, service integrations, and webhooks.
• Separation of Concerns: REST and GraphQL serve different client needs; service modules abstract specific integrations with external APIs.
• Extensibility: Using a GraphQL API allows for flexible future expansion of queries and mutations.
• Configuration-Driven: Environment variables (from .env files) keep sensitive configurations separate from code.
Relevant Technologies & Frameworks
• Node.js for the backend platform.
• GraphQL for flexible API access.
• WebSocket for real-time communication.
• Vercel (as suggested by vercel.json) for deployment.
• External services: OpenAI API, WhatsApp Business, and a connection with Meta Glasses.
Final Advice
• Don’t oversimplify; break down the project into as many functional components as possible to capture the detailed workflow and integrations.