How vonhatphuongahihi/vibely-study-social-web works
Main Components
• Frontend Applications:
• “frontend-user”: The primary user-facing Next.js/React application that includes features such as posts, messaging, scheduling, quizzes, and more.
• “frontend-admin”: The administrative portal built with Next.js/React for managing users, posts, study materials, inquiries, and viewing dashboards.
• Backend Application:
• “backend”: A Node.js/Express server that exposes REST APIs for authentication, user management, content (posts, videos, study documents), chat, and other interactions. It includes controllers, middleware, routes, configuration (like connection to MongoDB and Cloudinary), and documentation via Swagger (swagger.yaml).
• Chatbot and AI Integration:
• “chatbot-backend”: A Python-based service that integrates with external AI services (e.g., OpenAI, Hugging Face, Weaviate) and handles AI-related tasks including chat history, processing AI tools and prompts.
• Real-time Communication Service:
• “socket”: A dedicated real-time web socket server (built with Node.js) that likely manages live messaging or notifications.
• Additional Components:
• Database: Although not visible as a file here, the “backend/config/db.js” indicates a MongoDB connection which is a central data store.
• External Services: Cloudinary (for media uploads) as seen in “config/cloudinary.js”, and API documentation/external keys referenced by files in both the Node and Python environments.
• CI/CD & Testing: The “tests” directory with Cypress tests and Dockerfiles in several directories indicate containerization and automated testing setups.
Relationships and Interactions
• The backend server is responsible for processing requests such as user authentication, post management, chat messaging, scheduling, etc. It interacts with the MongoDB database.
• The Express backend consults the “swagger.yaml” file in API to document its endpoints and can serve as an API gateway.
Architectural Patterns and Technologies
• Modular/Microservices-style Architecture: Each service (user frontend, admin frontend, REST API backend, chatbot-backend, and socket service) is logically isolated yet interacts through defined interfaces.
• MVC Pattern on the Backend: Controllers, models, and routes are clearly separated in the “backend” directory.
• Containerization: Dockerfiles are available in multiple services (backend, frontend-admin, frontend-user, socket) and a docker-compose file is present, suggesting container orchestration.
• Real-time and asynchronous communication: The socket service provides real-time data flow for messaging and notifications.
• RESTful API principles: The structured routes, controllers, and API docs (Swagger) illustrate standard API design.
Detailed Elements
• Frontend Components:
• Frontend-User: Include a section for pages that represent chat, posts, scheduling, quizzes, video feed, and social interactions.
• Frontend-Admin: Represent admin functionalities like dashboard, user management, post oversight, etc.
• Backend API:
• Separate logical blocks for authentication (routes and controllers), content management (posts, documents, schedules, quizzes), and administrative operations.
• Middleware layers (authentication, admin authorization).
• A pointer to “swagger.yaml” for API documentation.
• Chatbot-Backend:
• Modules responsible for AI services, including route/service for AI requests (ai_service.py), integration with external ML models, and the supporting tools and database interactions.
• Socket Server:
• Role in handling real-time messaging (using “socket/index.js”) and its interaction with both the backend API and the frontends.
• Infrastructure & DevOps:
• A note for Dockerization: show that each service (frontend, backend, socket) is containerized.
• CI/CD considerations if necessary (pointing to the tests directory and docker-compose file).