How ayfg/catlog works
Project type and purpose
• CatLog is a full-stack mobile application for recording and viewing cat-related logs (daily activities, medical records, etc.).
• The frontend is an Expo-managed React Native app (using the new app/–directory router), and the backend is a TypeScript + Express REST API with MongoDB.
File-structure analysis
• Top level: two subprojects, CatLog_front and CatLog_back.
• CatLog_back:
• app.ts — Express entry point
• routes/ → controllers/ → models/ — a classic MVC layering
• middleware/ — auth checker & error handler
• types/ — shared request & error types
• bruno/ — Bruno DSL scripts for testing or BDD scenarios
• CatLog_front:
• app/ — Expo Router screens and layouts (tabbed navigation)
• components/ — reusable buttons
• store/ — Zustand state management
• utils/ — age calculation, date logic, API client, storage helpers
• types/ — shared data models (Cat, DailyLog, MedicalLog, Auth)
• ios/ & android/ — native project files for Expo
README insights
• Tech stack badges: TypeScript, Node.js, Express, MongoDB, React Native, Expo, TanStack Query, Zustand, NativeWind.
Main components & interactions
a. Frontend (Mobile App)
• Screens: Login, Signup, Tabs (Calendar, MyPage), Create/Edit/Delete modals
• State & data layer: Zustand store + TanStack Query for caching/fetching
• HTTP/API client: utils/fetchApi.ts calls backend endpoints
b. Backend (API Server)
• Express router layers: /auth, /cat, /dailyLog, /medicalLog
• Controllers implement business logic
• Models (Mongoose schemas) persist to MongoDB
• Middleware handles authentication (authChecker) and errors
• Bruno scripts for automated tests or API specification
c. Database
• MongoDB collections: users, cats, dailyLogs, medicalLogs
d. External Services
• OAuth/social login (via components/socialButton.tsx)
• Static assets (rives & images served by Expo bundle)
Architectural patterns & design principles
• Backend: MVC-like separation (routes → controllers → models)
• RESTful API design with stateless JWT sessions (checked in authChecker)
• Frontend: component-based UI, unidirectional data flow, React hooks + Zustand + React Query
• Clear separation of concerns: UI vs. networking vs. storage vs. native runtime
Putting it all together
• Top-right: “API Client” node (fetchApi.ts)
• Center: “Express Server” composite node containing Routes, Controllers, Middleware
• Bottom: “MongoDB”
• Side: “Bruno Test Suite” connecting to API Server for automated test execution