How shreyash0k/event-listener works
Chrome Extension (located in the “extension” directory)
• This component directly interfaces with the browser and is responsible for gathering event data from web pages.
Next.js Full-Stack Application (in the “nextjs” directory)
• Provides the user dashboard, authentication endpoints, pricing and support pages, and API routes for authentication, Stripe payments (create-checkout, create-portal, webhook), and tracker management.
• Contains UI components (React components), hooks (for logout and mobile functionality), libraries (for handling Stripe, Supabase, and subscriptions), and configuration for Tailwind, ESLint, and Next.js settings.
• Acts as the main web interface for users to configure, view, and manage events being monitored and their subscriptions.
Python Backend (inside the “backend” directory)
• Likely dedicated to handling scheduling, scraping/monitoring operations (leveraging Scrapybara), and triggering email notifications via the Resend API.
• Contains files like config.py, main.py, server.py, and utils.py hinting at a server that might operate as a worker or microservice complementary to the Next.js and extension components.
Additionally, there are external services involved:
• Supabase for secure storage of event configurations and possibly user data.
• Resend API for sending email notifications.
• Scrapybara (mentioned in README) to drive AI-assisted website monitoring.
A. Identify the Main Components:
1. Chrome Extension:
• Popup UI and background service for event detection.
2. Next.js Frontend:
• Dashboard, authentication, and support pages.
• API endpoints serving authentication, Stripe payment integration, tracker management, and more.
3. Python Backend:
• Dedicated server for managing monitoring tasks (scraping via Scrapybara) and sending notifications via Resend.
4. External Services:
• Supabase for database storage.
• Resend API for email notifications.
B. Determine Relationships and Interactions:
1. The Chrome Extension interacts with websites and possibly sends event data (or state changes) to the backend services.
2. The Next.js application serves as a portal for users to view events, configure monitoring parameters, manage subscriptions, and routes requests via its API endpoints.
3. The Python Backend works in the background to periodically run monitoring (using Scrapybara) and communicates with external APIs to notify users via email.
4. Both the Next.js app and Python backend interact with Supabase to read/write user-configured event data.
5. Authentication flows and payment processing (using Stripe) are integrated within the Next.js API routes.
C. Highlight Important Architectural Patterns and Technologies:
1. Separation of Concerns: Clear separation between the browser extension, web dashboard (Next.js), and backend scraping/notification service.
2. Microservices-like Approach: Even though the components reside in a single repo, each (extension, Next.js app, Python backend) provides distinct functionalities.
3. RESTful API Design: The Next.js “app/api” routes follow a structured RESTful approach for events (trackers), authentication, and Stripe interactions.
4. Client-Server Model: The Chrome Extension and Next.js frontend serve as client interfaces, communicating with a Python backend and external services.
5. Integration With Third-Party Services: Use of Supabase, Resend, and possibly Scrapybara as part of the overall workflow.
6. AI or Automation elements: AI agents assist with the monitoring, which could be reflected as part of the logic within the Python backend.
2. Next.js application as a separate component/group that encapsulates:
• Frontend User Interface (dashboard, login, pricing, etc.).
• API Layer (endpoints for authentication, Stripe, trackers).
3. Python Backend as another service focusing on monitoring tasks, scraping with Scrapybara, and handling email notifications.
4. External dependencies (Supabase, Resend API, and possibly the AI monitoring tools) as distinct cloud elements.
• Data flow from the Chrome Extension (triggering events) to the Python Backend or directly to the Next.js API if applicable.
• Communication between the Next.js API layer and the external services.
• Coordination between the Python backend (scraping/monitoring) and Resend API for emails.
• Sync of event configurations and user data with Supabase.
1. Use clear labels for each component:
• User creates/updates event configurations via the Next.js dashboard.
• Chrome extension monitors website events and communicates with backend.
• Python backend processes events and triggers email notifications.
• APIs communicate with external services.
• Next.js / React for frontend.
• Python for backend microservice.
• Supabase and Resend as external services.
• Stripe for payment processing.
5. Be detailed: outline every interaction and dependency. Even if it leads to many components, capturing all critical flows ensures a complete view of the system.