Flutter Developer
Hello Appwrite Community,
I have a question regarding efficient database design with Appwrite. I've been trying to gather relevant information and have created a database structure that works well, but I have questions about scalability, clarity, and maintenance.
App Structure:
Players can form gaming groups worldwide.
Players share information like locations, scenarios, costumes, etc.
Current Database Design:
Collections: Games, Locations, Scenarios, Costumes, Maps.
Each object has a "gameID" attribute to link it to a specific game.
Challenge:
Each game can have many maps, and each map can hold hundreds of small objects that describe canvas-placed objects (e.g., {canvasID="canvasUUID", type="player", pos.dx=2342.4, pos.dy=645.4, name="Player1", color="ffffff", rotation=".54", children="{uuid1, uuid2}, connection=null}).
Each game can have many scenarios, and each scenario consists of dozens of longer text elements.
Storing all these objects and text elements in a single collection for all games seems insame to me, especially since the map elements need to be kept separate (not one bigger JSON for all elements on one canvas) for real-time updates of individual elements in the canvas editor.
My New Solution:
Create a new database for each new game.
Collections and schemas within these databases are identical.
I read a statement in Discord that made me uncertain about this approach: "But generally, if your DB design ends up by creating new databases or collections at runtime, you're probably doing something wrong or looking in the wrong direction."
Questions:
Is this approach efficient?
Will tens of thousands of small databases cause problems?
Is there a better way to handle this?
I would appreciate your thoughts and assistance.
Thank you!