How nergy101/retro-ranker works
Project Type and Purpose
• That Retro Ranker is a full-stack application. Its main purpose is to provide a user-friendly interface for comparing retro handheld gaming devices using data-driven specifications, performance metrics, and side-by-side comparisons.
• That it is built using the Fresh framework, which leverages server-side rendering combined with interactive “islands” for client-side behaviors.
Main Components
a. Frontend:
• Components: Containing reusable UI elements (e.g., Device Cards, SEO, shared utilities).
• Islands: Interactive client-side components like LayoutSelector, TagTypeahead, TimelineContent, and various auth and chart-related islands that provide reactive, stateful behaviors.
• Routes: The pages and API endpoints under the routes directory (including both the public pages and authentication endpoints).
b. Backend/API:
• API endpoints are structured under routes/api. They handle user authentication (sign-in, sign-out, sign-up) and device-related operations such as fetching device data and comparisons.
• The server entry point (main.ts) bootstraps the application and routing.
c. Data and Models:
• Data source and device parser/patcher scripts handle the fetching, parsing, and updating of the retro handhelds' data.
d. Services:
• Integrations with external systems like Pocketbase (for storage/user data) and Umami (for analytics) are found under the services directory.
e. Static Assets and Scripts:
• Static directory contains assets such as images, stylesheets (e.g., PicoCSS), and additional media files.
• Scripts provide utility functions for tasks like generating device entries, scraping images, or generating sitemaps.
f. DevOps and Deployment:
• The .devcontainer, Dockerfile, and GitHub workflows (in .github) indicate containerization and CI/CD practices for development and deployment.
• Deno tasks (e.g., start, build, check, preview) indicate standardized commands for different stages in the development and deployment lifecycle.
Relationships and Interactions
• User requests enter through the main entry point (main.ts) and are routed based on the URL:
• Regular dynamic pages are rendered via routes (_layout, _app) while interactive components use the islands pattern.
• API endpoints under routes/api are invoked for actions like authentication and device queries.
• The frontend communicates with backend services when dynamic data is required. This interaction is usually a REST-like call, as suggested by the sign-in, sign-up, and device fetch operations.
• Data flows from the Data folder through business logic in services and parsers to the UI components which then display device comparisons and performance metrics.
• External services (Pocketbase, Umami analytics) are integrated through dedicated service modules, indicating clear separation of concerns for data persistence and analytics.