How icnneto/myprojectdictionary works
Main Components
• Frontend (Client-Side)
• Represented by the contents of the "public" folder.
• Includes HTML pages (e.g., index.html, dashboard.html, login.html) and JavaScript modules/components (organized under public/JS) responsible for UI rendering, page logic, and direct interactions with Firebase (e.g., realtime listeners with onSnapshot, handling add/edit/delete operations).
• Styling with Tailwind CSS and additional CSS files from the "public/css" folder.
• Firebase Backend (Serverless Components)
• Firebase Authentication: Handles user login with Google and GitHub OAuth; interact via Firebase’s client and admin SDKs.
• Firebase Firestore: NoSQL database where the users’ terms are stored under the hierarchy: users/{userId}/termos/{termoId}. Include data fields such as "termo", "descricao", and "favoritado".
• Cloud Functions (located in the "functions" folder):
∙ Function endpoints such as getApiKey, editarTermo, addToIndex, and changeFavoriteIndex.
∙ Integrates with Algolia for search indexing and update operations.
• External Search Service – Algolia
• Responsible for providing fast search and indexing.
• The Cloud Functions handle operations that authenticate and synchronize the Algolia index with changes in Firestore.
• Structure for indexing terms including attributes like objectID, termo, descricao, favoritado, userID, etc.
Important Architectural Patterns & Design Principles
• Client-Server Separation: The frontend communicates directly with Firebase for some operations, while more complex workflows (such as indexing with Algolia) are handled through Cloud Functions.
• Real-time Data Flow: The use of onSnapshot in the frontend indicates real-time synchronization with Firestore.
• Serverless Architecture: Leveraging Firebase Cloud Functions reduces the need for a dedicated backend server.
• Secure Data Access: Firebase Authentication coupled with Firestore Security Rules ensures that users access only their own data.
• External Service Integration: The integration with Algolia for fast, efficient searching.