RetroAssembly Documentation

repository·main·Indexed 21 days ago

https://github.com/arianrhodsandlot/retroassembly

A browser-based retro gaming cabinet for managing and playing personal ROM collections. It features spatial navigation for gamepads and keyboards, synchronized save states, and retro-style visual shaders. Built with React, Hono, and Nostalgist.js, it supports a wide array of consoles including Arcade, Game Boy, NES, and Super NES. Users can access the official hosted version or self-host using Docker.

Tokens
9.7K
Snippets
33
Records
43
Agent score
77%

What's inside RetroAssembly

  1. Retroassembly Tech Stack overview

    main

    The project utilizes the following technologies across its layers:

    • Frontend: React, React Router, Radix Themes, Tailwind CSS, Iconify, and Nostalgist.js.
    • Backend: Hono, React Router, and Drizzle ORM.
    • Infrastructure: Node.js or Cloudflare Workers, SQLite or Cloudflare D1, and Cloudflare R2.
    • External Services: jsDelivr, Supabase Auth, and msleuth.
  2. Get started with RetroAssembly

    main

    RetroAssembly is a browser-based retro game collection cabinet. You can use it via a hosted service or by self-hosting your own instance.

    Best for users who want to start playing immediately without technical setup.

    1. Visit retroassembly.com.
    2. Explore the library or try demo games.
    3. Login and upload your own ROM files to create a personal library.
    4. Select a game from your library to launch it in the browser.
    5. Use the in-game menu to save and synchronize progress.

    Option 2: Self-Host with Docker

    Best for advanced users who want full control, privacy, or customization. Refer to the RetroAssembly Docker Hub page for deployment instructions.

  3. Report a bug in retroassembly

    main

    When reporting bugs via GitHub issues, ensure you include the following information to help maintainers diagnose the problem:

    • Expected vs. Actual Behavior: Describe what you expected to happen versus what actually occurred.
    • Reproduction Steps: Provide the exact sequence of steps that lead to the issue.
    • Environment Details: Include your OS and browser version if relevant.
    • Evidence: Attach screenshots, screen recordings, or error logs.
    • Consistency: Specify if the issue happens every time (consistently) or only occasionally (intermittently).
  4. Explore the API route structure

    main

    The API is prefixed with the base path api/v1. The application is composed of several routed modules:

    • /api/v1/auth: Authentication routes.
    • /api/v1/users: User management routes.
    • /api/v1/*: Library routes (mounted at the root of the API version).

    Errors are handled globally: HTTPException instances return a JSON object with the error message and the corresponding status code. All other unhandled errors return a 500 status code with a JSON error message.

  5. Define and structure user preferences

    main

    User preferences in RetroAssembly are organized into three main categories: emulator, input, and ui. When providing partial configuration (a PreferenceSnippet), you can target specific sub-sections of the configuration.

    Preference Categories

    emulator

    Controls emulation behavior, including:

    • autoSaveInterval: Frequency of automatic saves.
    • core: A mapping of CoreName to specific core configurations (e.g., mgba_gb_colors).
    • fullscreen: Boolean to toggle fullscreen mode.
    • platform: Per-platform settings including bioses (file ID and name), the assigned core, and optional shader.
    • shader: The global shader setting.
    • videoSmooth: Boolean to toggle video smoothing.

    input

    Controls control schemes and button mappings:

    • confirmButtonStyle: The visual style for confirmation buttons.
    • gamepadMappings: A record of gamepad-specific button mappings.
    • keyboardMapping: A mapping of specific input keys to emulator actions (e.g., $pause, input_player1_a, input_rewind).

    ui

    Controls the visual interface:

    • dateFormat and language: Localization settings.
    • libraryCoverSize and libraryCoverType: Settings for how game covers are displayed.
    • platforms: An array of PlatformName to show in the UI.
    • saturation: A numeric value for color saturation.
    • showSidebar, showTitle, showDistrictOnTitle, and showFocusIndicators: Visibility toggles for UI elements.
  6. Deploy Retroassembly using Docker Compose

    main

    You can deploy Retroassembly using a Docker Compose configuration. The service runs on port 8000 and requires a local directory mapped to /app/data for persistent storage.

    Configuration Details:

    • Image: arianrhodsandlot/retroassembly
    • Ports: Maps host port 8000 to container port 8000.
    • Volumes: Maps a local ./data directory to /app/data inside the container to ensure data persistence.
    • Restart Policy: Set to unless-stopped to ensure the service restarts automatically unless manually stopped.
    services:
      retroassembly:
        image: arianrhodsandlot/retroassembly
        ports: [8000:8000]
        volumes: [./data:/app/data]
        restart: unless-stopped
  7. Configure Retroassembly via environment variables

    main

    Retroassembly uses environment variables prefixed with RETROASSEMBLY_RUN_TIME_ to configure its runtime behavior. The system supports both node and workerd runtimes. If no environment variable is provided, the following defaults are applied based on the runtime:

    Available Environment Variables

    VariableDefault (Node)Default (workerd)Description
    RETROASSEMBLY_RUN_TIME_ALLOW_CRAWLER'false'DynamicControls if the crawler is allowed. In workerd, it is true if the request origin matches the metadata link origin.
    RETROASSEMBLY_RUN_TIME_DATA_DIRECTORYpath.resolve('data')path.resolve('data')The base directory for application data.
    RETROASSEMBLY_RUN_TIME_MAX_AUTO_STATES_PER_ROM'20''20'Maximum number of auto-generated states per ROM.
    RETROASSEMBLY_RUN_TIME_MAX_ROM_COUNT'''1000'Maximum number of ROMs allowed.
    RETROASSEMBLY_RUN_TIME_MAX_ROM_COUNT_2026'''200'Maximum number of ROMs allowed (2026 limit).
    RETROASSEMBLY_RUN_TIME_MAX_UPLOAD_AT_ONCE'1000''100'Maximum number of simultaneous uploads.
    RETROASSEMBLY_RUN_TIME_MSLEUTH_FALLBACK_HOST'https://msleuth.fly.dev/''https://msleuth.fly.dev/'Fallback host for Msleuth.
    RETROASSEMBLY_RUN_TIME_MSLEUTH_HOST'https://msleuth.arianrhodsandlot.workers.dev/''https://msleuth.arianrhodsandlot.workers.dev/'Primary host for Msleuth.
    RETROASSEMBLY_RUN_TIME_SKIP_HOMENODE_ENV !== 'development''false'Whether to skip the home page.
    RETROASSEMBLY_RUN_TIME_SKIP_HOME_IF_LOGGED_IN'true''false'Whether to skip the home page if the user is logged in.
    RETROASSEMBLY_RUN_TIME_STORAGE_DIRECTORYpath.resolve('data', 'storage')path.resolve('data', 'storage')The directory used for storage.
    RETROASSEMBLY_RUN_TIME_STORAGE_HOST''''Host for storage services.
    RETROASSEMBLY_RUN_TIME_SUPABASE_ANON_KEY''''Supabase anonymous API key.
    RETROASSEMBLY_RUN_TIME_SUPABASE_URL''''Supabase project URL.
    RETROASSEMBLY_RUN_TIME_SUPERVISER_USER_IDS''''Comma-separated list of supervisor user IDs.