How eshan-b/sunny-snippets works
Based on your project’s file structure and README content, Sunny Snippets is a full-stack web application built with Next.js and Tailwind CSS. The app is designed to display positive news articles (fetched from an external news API) while using sentiment analysis to filter out negative content, and it leverages Firebase (Firestore) for storing saved articles and Clerk for authentication.
Main System Components
• Client/User Browser: Represents users interacting with the web application.
• Next.js Frontend: This includes the overall UI layer built with React, Tailwind CSS, and NextUI. Highlight the “app” directory which hosts the pages and layouts, and the “components” directory that holds reusable UI parts (e.g., Navbar, Hero Section, News Cards, Profile Dropdown).
• API/Service Layer:
• External News API Integration: A component responsible for fetching uplifting news articles. (Refer to utils/news-api.ts)
• Sentiment Analysis Service: The service that filters news articles based on their positivity (see services/sentiment-analysis.ts using the sentiment npm package).
• Backend/Data Storage:
• Firebase/Firestore: Represents the backend data store where saved articles are retrieved and deleted (point out firebase.config.ts and utils/firestore.ts).
• Authentication:
• Clerk Authentication Service: Although not directly found in the file tree, it is mentioned in the README as a service for MFA and login functionality.
Visualizing Relationships and Data Flow
• From the Client (web browser) to the Next.js Frontend when rendering pages.
• From the Frontend to the External News API: for retrieving real-time news articles.
• From the Frontend to the Sentiment Analysis module: where articles are processed and filtered.
• Between the Frontend and Firebase: to manage saved articles (retrieve and delete operations).
• From the Client to the Clerk Authentication Service: to handle login and user management, affecting protected routes like account pages.
Highlighting Architectural Patterns
• Separation of concerns: the routing and page management in the “app” directory (which follows Next.js conventions) versus the modularization of business logic (services, utilities, components).
• That the file structure suggests usage of layout components (e.g., layout.tsx) and dynamic routing (e.g., app/account/[[...account]]) which follow Next.js best practices.
• That the project uses a component-based architecture typical of modern React applications.
• The middleware.ts can be represented as a global-level request handler which might be used for runtime authorization or redirection.
Details on Technologies and Frameworks
• Next.js: central to rendering pages, server-side logic, and routing.
• Tailwind CSS & NextUI: Provide styling and theming for UI components.
• Firebase (Firestore): For persistent data storage for user articles.
• Clerk: For handling multi-factor authentication.
• Sentiment npm Package: To analyze article sentiment scores.
• External News API (The Guardian News API as mentioned in the README): As the data provider for news articles.