How milpagit/agenda-inteligente works
Project Type and Purpose
• This is a full-stack calendar application frontend built with React and Redux Toolkit.
• Its goal is to provide authenticated users with a rich calendar UI to create, view, update, and delete events, plus view others’ events.
• It integrates with:
• A separate Node.js/Express/MongoDB backend (hosted elsewhere) for core CRUD and auth APIs.
• Firebase Hosting for static asset delivery and Firebase Cloud Functions (Python) under the functions/ folder for background tasks such as proactive alerts or imports.
File Structure Analysis
• Top-level:
• public/ – Static HTML/CSS/manifest for the SPA entry point.
• src/ – All application code.
• functions/ – Firebase Cloud Functions in Python.
• Config files: firebase.json, .firebaserc, babel.config.js, jest.config.js.
• src/ breakdown:
• api/ – Axios wrappers for REST endpoints: alertsApi.js, functionsApi.js, importApi.js, alertsApi.js.
• auth/ and calendar/ – Feature modules with pages and components (e.g., Login, Onboarding, CalendarPage, CalendarModal).
• hooks/ – Custom React hooks for state stores and form handling.
• store/ – Redux slices organized by domain (auth, calendar, habits, notifications, recommendations, subjects, tasks, ui).
• router/ – React Router setup (AppRouter.jsx).
• firebase/config.js – Firebase SDK initialization for hosting or messaging.
• core/recommendationEngine.js – Business logic for recommending events.
• helpers/ – Utility functions such as date conversions, localizers, and message lookups.
Key Architecture Patterns
• Single-Page Application (SPA) with React and React Router.
• Global state management via Redux Toolkit slices and custom hooks.
• API abstraction layer using Axios.
• Modular “feature-folder” structure (auth, calendar, shared).
• Separation of concerns: UI components vs. business logic vs. data layer.
• Serverless functions (Firebase) alongside a traditional backend (Node/Express/MongoDB).
Main Components
a. Frontend SPA
• React Components (Auth pages, Calendar pages, Shared/Loading)
• Redux Store (slices for auth, calendar, etc.)
• Custom Hooks + Recommendation Engine + Helpers
b. API Layer
• Axios wrappers → HTTP calls to:
• Node.js/Express backend (REACT_APP_API_URL)
• Firebase Cloud Functions (hosted under your Firebase project)
c. Backend Services
• Node.js + Express REST API → MongoDB database
• Firebase Cloud Functions (Python) → external triggers or cron jobs
d. Hosting & Deployment
• Firebase Hosting serves public/ and bundles from Webpack/Babel
• Cloud Functions deployed via firebase.json
Interactions & Data Flow
• User (Browser) → React SPA (hosted on Firebase Hosting)
• SPA dispatches Redux actions → Custom Hooks → Axios APIs
• Axios →
• Express API endpoints → CRUD on MongoDB
• Firebase Function endpoints → background tasks (e.g., proactive alerts, imports)
• Responses cycle back through Redux store → UI updates