How bigoldmaple/mindmate-server works
Main Components
• Mobile Client (MindMate):
• UI Layer: Consists of screens under the “app” directory – with separate subfolders for authentication, tabs (community, messages, profile), home, etc.
• Reusable Components: Under “components” for visual elements and theming.
• Services & Utilities: “services” and “utils” folders that handle API calls, authentication, Health Connect integration, and WebSocket communication.
• Native Integration: “android” folder for native code/configuration (build files, manifest, resources) that integrate the Java/Kotlin parts with React Native.
• Asset Management: “assets” directory for images and fonts.
• Backend Server (MindMateServer):
• API Routes: Located under “src/routes” that include endpoints for authentication, community, chat, buddy, profile, notifications, etc.
• Middleware: Error handling and request processing under “src/middleware.”
• Services: Business logic and external service interactions such as push notifications and WebSocket server (located in “src/services”).
• Database Integration: Database schemas under “src/Database” (ChatSchema, CheckInSchema, etc.) and related configuration in “src/config.”
• Utility Functions: Helpers under “src/utils.”
Relationships & Interactions
• The Mobile Client communicates with the Backend Server via API calls. This occurs through the services (e.g., auth.ts, chatApi.ts, communityApi.ts) in the client.
• Health Connect integration on Android is accessed via the native code and the corresponding HealthConnectService.
• Real-time features (like messaging) may use WebSockets, as indicated by both client-side (websocketService.ts) and server-side (websocketServer.ts) implementations.
• The backend server interacts with a database (evidenced by the schema files) to store and retrieve data related to chats, check-ins, community posts, and notifications.
• The mobile client utilizes Expo to bridge JavaScript code and native modules, and the build process involves Android Studio (for native modules) and Expo CLI.
Architectural Patterns & Design Principles
• Separation of Concerns: The project clearly separates the mobile client code (UI, components, services) from the backend server logic.
• Modular Architecture: Both client and server code are modularized into directories for screens/components/routes, promoting loose coupling.
• Service-Oriented Communication: Client-side “services” abstract API calls while the server organizes routing, middleware, and service logic.
• Real-time Communication: Usage of WebSocket services indicates support for low-latency real-time messaging.
• Native Bridge: The integration of native Android code with React Native indicates the use of bridging techniques to handle platform-specific features.
Relevant Technologies, Frameworks, and Libraries
• React Native/Expo for the mobile client
• TypeScript for both client and server code
• Android native development (Kotlin/Java)
• Express (or similar Node web framework) on the backend server
• WebSocket for real-time communication
• Health Connect for health and step tracking
• Likely a NoSQL database (MongoDB, inferred from the schema structure) for persistence
• Various build tools such as Gradle for Android and Expo CLI for the client