How tanya-2004/biospotter works
Main Components
• User Interface (Frontend): Represented by static HTML, CSS, and JavaScript files (found in the frontend/public folder). Include pages such as index.html, chatbot.html, discussion.html, gallery.html, signin.html, and signup.html.
• Web Server / API Backend: The NodeJS/Express server located in the backend directory. This includes:
• Controllers (chatbot, discussion, gallery, user) handling specific business logic.
• Routes that map incoming HTTP requests to the appropriate controllers.
• Middleware (e.g., authentication, logging) for processing requests.
• Utility components (like jwt for token generation/validation).
• Database integration models (user, discussionPost, galleryItem) for MongoDB interactions.
• External Services:
• ChatBot API that provides real-time assistance.
• Possibly Socket.io (as mentioned in the readme) for handling real-time discussion board functionalities.
• Database: MongoDB is used to store user data, discussion posts, gallery items, etc.
Relationships and Interactions
• The user (via a web browser) accesses the static frontend pages which then communicate with the backend using HTTP requests (and potentially WebSocket via Socket.io for discussion features).
• The backend NodeJS server routes these requests:
• For user-related activities (login, registration, etc.), the user routes and controllers manage authentication and data access.
• For gallery operations, the gallery routes and controllers handle image file uploads, accessing corresponding models and the uploads folder.
• For chatbot interactions, the chatbot controller interfaces with an external Chatbot API.
• For discussion features, the discussion controller likely integrates real-time communication via Socket.io.
• The ML Microservice (Flask app) receives image inputs (possibly via backend request forwarding) and returns species identification data. The Python ML files (app.py and model.py) serve as the backbone of this service.
• Data flows from the backend to MongoDB and back, and also possibly to/from the ML service when image analysis is required.
Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly segregates responsibilities via separate directories for controllers, models, routes, and middleware.
• Service-Oriented Approach: The ML model and chatbot API are externalized, reinforcing modular design.
• Client-Server Architecture: Distinguish frontend (client) from backend (server API) interactions.
• Real-Time Communication: Use Socket.io for the discussion section, demonstrating a decoupled approach for real-time data.