How virginiachambi/esland-web works
Main Components
• Frontend/UI Layer:
• Represented by the Astro pages, layouts, and components in the “src” folder.
• Includes pages under “src/pages” (e.g., index, archive, voting, legal notices), common UI components (like Header, Footer, HeroContainer, etc.) and styling with Tailwind CSS.
• API & Backend Endpoints:
• Located under “src/pages/api”. These endpoints (e.g., gallery, candidates, vote) handle dynamic requests and interact with the application logic.
• Data and Database Layer:
• The “src/db/client.ts” file suggests a database client is abstracted here. Components in “src/schemas” and “src/types” define data models for votes and galleries.
• Static Assets:
• All static content (images, fonts, videos, JSON files) is stored under “public”. This includes static pages (like “archivo-page”, “info-page”), media assets, and even some JSON data (e.g., editions-info.json).
• Scripts/Build Tools:
• The “scripts” directory contains TypeScript scripts used for generating meta information, converting images, and handling vote inserts. These are helper tools applied outside the standard runtime but are important for pre-processing resources.
• External Integrations:
• The README describes how to integrate with Twitch (obtaining client IDs and secrets) that are later injected via environment variables (.env). This should be shown as an external system interacting with the application.
Relationships & Data Flow
• Frontend (Astro Components & Pages) makes HTTP calls to the API endpoints to dynamically retrieve information (e.g., gallery data or candidate votes).
• The API endpoints (in “src/pages/api”) interface with the database layer (through “src/db/client.ts”) to process and record submissions, vote counts, etc.
• Static assets in “public” are directly served to the client and integrated within the UI.
• Pre-deployment or periodic “scripts” run to generate image thumbnails and metadata, which then become part of the static assets or initial data feeds.
• External integration with Twitch is used as an authentication or resource provider—its client ID and secret are configured via environment variables (.env).
Architectural Patterns & Principles
• Component-Based Architecture:
• The project clearly separates UI components (Astro and React/TSX components) to enable reuse and maintainability.
• Separation of Concerns:
• Different directories handle static assets, page logic, API endpoints, and utility scripts.
• Content Delivery:
• Astro’s architecture focuses on building static sites with dynamic capabilities, where build-time scripts and runtime API routes collaborate.
• Extensibility:
Essential Technologies & Frameworks
• Astro, TypeScript, and Tailwind CSS form the core of the frontend.
• Node-based scripts (written in TypeScript) perform asset processing and vote management.
• Integration with external services (Twitch).
• The build tools involve either bun or pnpm for package and dependency management.