How midudev/kings-league-project works
Main Components
• External Data Source: The Kings League Infojobs website from which data is scraped.
• Web Scraping Module: Represent the “scraping” directory as the component that includes individual modules for scraping teams, coaches, MVPs, schedule, etc. Indicate that this process uses Cheerio for HTML parsing and may also optimize images.
• Database (JSON Files): The “db” directory that houses JSON files (such as teams, coaches, schedule, leaderboard, etc.) acting as persistent storage for scraped data.
• API Layer: The “api” directory that houses the main API entry point (index.js), along with its test files; this component is built on Node.js and Hono, and it’s configured for deployment via Cloudflare Workers (as indicated by the “wrangler.toml” file).
• Web Frontend: The “src” directory (with layouts and pages) which contains the Astro-based website. This component utilizes Tailwind CSS (configured via tailwind.config.cjs) for styling and serves the user interface.
• Assets and Public Files: The “assets” and “public” folders provide static assets such as images, logos, and other media used on the website.
• CI/CD and Testing Components: Represent GitHub workflows (under “.github/workflows”) for automated deployments, scraping jobs, and readme updates, as well as testing configurations (global-setup, Vitest config, etc.).
Relationships and Interactions
• Deployment and Automation: Optionally, include a side branch for CI/CD pipelines (GitHub Actions) that trigger deployments for the API (via Cloudflare Workers) and updates that might regenerate or populate data for the frontend.
• Testing: Show a testing component (Vitest, global-setup tests) that validates the API and scraping functions by interacting with both the API and Database modules.
Important Architectural Patterns/Design Principles
• Separation of Concerns: Clearly separate the scraping, data storage, API services, and frontend presentation layers.
• API-First Design: The API is the core service that aggregates data (from the lightweight JSON “database”) and serves it to both the frontend and any consumers.
• Microservice-like Decoupling: Although all components reside within a single repository, the scraping, API, and frontend components are modular and can be thought of as separate services.
• Clear labels for each component.
• Annotations for each technology or framework involved, which helps in understanding the component responsibilities.