How 0xoucan/moderia-aitrifectaethglobal works
Main System Components
• Frontend: The Next.js application under the “src/app” directory, which is responsible for user interfaces (login, dashboards for agents, mentors, students, service booking, etc.). Also includes various shared components (inside “src/components”) and hooks for API queries.
• Backend API & Business Logic: The backend is encapsulated in “src/backend” and the “src/server” directories. The backend contains controllers (e.g., booking, payment, service, transcript, user), services (booking-service, payment-service, etc.), and a collection of business logic in dedicated action providers (ERC20 escrow, Moderia agent, Otter AI quality analysis, recall test, and service marketplace).
• External Integrations & Data Storage: The system integrates with Recall Network for secure, decentralized data storage and uses blockchain (Base Sepolia) for payment escrow and transactions. Otter AI is used for call analysis and quality verification. Telegram (and a potential demo mode) is used for alternate user interaction.
• Database and ORM: Prisma files and “prisma/schema.prisma” indicate the use of a relational database, while the README and environment variables (Nillion DB configs) suggest potential additional database integrations.
Determining Relationships and Interactions
• The Frontend communicates with API routes under “src/app/api” that serve as gateways to business logic.
• The API endpoints in the Next.js app (e.g., /api/recall, /api/users) interact with backend controllers in “src/server/controllers” to process booking, payment, and user-related functionality.
• Controllers and services call out to specialized action providers (located in “src/backend/src/action-providers/…”) for handling specific processes such as escrow transactions, service quality review, and dispute resolution.
• The action providers interface with external services such as:
• Blockchain networks for secure payment processing.
• Recall Network to store and retrieve decentralized data.
• Otter AI for call transcription and quality assessment.
• Telegram for bot-driven command interactions.
• There is also service integration between the Next.js UI components and shared libraries in “src/lib” (for example, the fullRecallFlow or recallActions which are used in both frontend and backend components).
Architectural Patterns & Design Principles
• Separation of Concerns: The project clearly decouples the UI (frontend components and pages), backend API processing, and specialized business logic (action providers).
• Microservices/Modular Approach: Even though the project runs as a unified codebase, the backend is split into various “action-provider” directories, each handling a discrete function (ERC20 escrow, Moderia, Otter AI, etc.). This modular approach enhances scalability and maintainability.
• Secure & Resilient Integration: Use of Recall Network for data security and blockchain for financial transactions emphasizes design principles around trust and security.
• Extensibility: With clearly separated layers (frontend, controllers, services, action providers), adding new providers or functionalities (like new mediation channels) can be done with minimal impact to other components.