Skip to content

Best Project Structure for Hosting Multiple Phaser.js Games in SvelteKit #7

@alokmahor

Description

@alokmahor

I am developing a gaming website using SvelteKit and Phaser.js, where users can play multiple 2D games. Each game should have its own assets (images, sounds, etc.) and be accessible via routes like:

host.com/game/game1
host.com/game/game2
host.com/game/game3
I checked the official Phaser.js + Svelte template (GitHub link), but it seems designed for a single game setup. I need a scalable structure to host multiple games efficiently.

My Current Considerations:

  1. Game Logic: Should each game's logic be inside src/lib/ or within its route (routes/game/game1/)?
  2. Asset Management: How should I organize game-specific assets (images, sounds) while keeping things modular?
  3. Lazy Loading: How can I structure it so games are loaded only when needed to optimize performance?
  4. Best Practices: Are there existing open-source projects or recommended approaches for handling multiple Phaser games in SvelteKit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions