How azrizhaziq/tradingview-syariah-indicator works
Main Components
• Data Package: This package (found under packages/data) contains the scripts for scraping, processing, and diffing stock list data. It also holds JSON data files (e.g., stock-list.json) and utilities to keep these data up-to-date.
• Extension Package: This core package (packages/extension) is the browser extension. It includes source code for background scripts, content scripts (page injection logic), popup UI components (React/TSX components), localization files, and manifest files for different browsers (Chrome and Firefox). It also includes end-to-end testing (e2e) with Playwright.
• Shared Package: (packages/shared) provides utility functions, common types, and models that are shared between the extension and the web components.
• Web Package: (packages/web) implements the website component, which serves as the frontend for information related to the extension, documentation, and possibly demo pages.
• Assets & Supporting Resources: The assets folder includes images/screenshots used in the README and documentation; additional configuration directories (.github, .husky, etc.) support continuous integration, linting, and formatting.
Relationships and Interactions
• The Data Package periodically updates stock data by scraping various listed sources (Bursa Malaysia, Wahed ETF HLAL, China ETF, etc.). The generated JSON data files will be used by the Extension Package.
• The Extension Package uses shared code from the Shared Package and integrates the data from the Data Package to determine when and where to inject the indicator on TradingView pages.
• The Web Package acts as a consumer of the shared utilities and the updated data may be rendered on the website, perhaps for listing stock data or offering an administration interface.
• There is a clear boundary between the browser extension’s logic (which interacts with TradingView pages) and the supporting data backend and website.
Architectural Patterns and Design Principles
• Modular Monorepo Structure: The project is split into several packages that handle distinct responsibilities, which encourages separation of concerns.
• Data Flow Pattern: Data is scraped/processed in one module, stored as JSON files, and then consumed by the browser extension to reflect real-time updates.
• Component-driven UI: The extension’s popup and page scripts are built with React-like component patterns (TSX components) and are clearly based on modern UI design principles.
• Testing and CI/CD Integration: Presence of E2E tests in the extension package using Playwright along with GitHub Actions for automated testing.
Technologies, Frameworks, and Libraries
• Node.js and TypeScript: Used across the packages, with configuration files such as tsconfig.json in several packages.
• PNPM Workspace: To manage dependencies and inter-package linking.
• Webpack and Vite: Webpack is used in the extension package (see webpack.config.ts) while Vite is used for the web package.
• Babel is configured (via .babelrc) for the extension package for JavaScript transpilation.
• Playwright is integrated for E2E testing in the extension package.
• SolidJS (mentioned in the README for the web package) as the frontend framework for the website.
• Environment configuration files (like .env.example and .nvmrc) ensure consistent development environments.
Elements
• From Data Package to Extension Package (indicating data updates).
• Between Shared Package and both Extension & Web packages.
• Annotations for important configuration artifacts (CI/CD pipeline using GitHub actions, linting/checking via Husky pre-commit scripts).