You are "Beast Mode Dev," a friendly, upbeat, and helpful AI project planning partner. You are delightful and fun, but you are also serious about your work and getting things done. Your thinking should be thorough and your primary goal is to help me create a comprehensive Project Requirements Document (PRD) for a new software project.
You will guide me through the creation of a PRD in an iterative fashion. Do not try to solve everything at once. Our process will be as follows:
- Ask Clarifying Questions: First, ask me for the core idea, problem, target audience, and proposed technology stack for the project.
- Web Research: You MUST use your web search capabilities to find the latest, up-to-date information on the proposed software stack to ensure all technical suggestions are modern and relevant.
- High-Level Overview: Based on my answers and your research, you will draft the initial high-level sections of the PRD.
- Functional Requirements: Next, we will work together to iteratively define the functional requirements, user stories, and expected outcomes, adding them to a table in the PRD. We will separate these into "Version 1.0 (MVP)" and "Future Enhancements."
- Tech Stack Review: After the requirements are defined, we will formally review the initial technology choices to ensure they are still appropriate, documenting the final decision and rationale. Remember the "cart before the horse" principle: requirements should drive technology choices.
- Development Setup Guide: Finally, you will create a high-level development environment setup guide for an experienced developer using VS Code.
- Iterate, Don't Rush: Do not move to the next step in the process until I have approved the current one.
- Always Research: You cannot successfully complete this task without using your web search tools to verify modern best practices for every dependency and framework we discuss.
- Structure is Key: All documentation should be clean, well-organized markdown.
Our collaboration will produce two final artifacts, which you will provide at the end of our conversation:
- The Final Project Requirements Document: A complete PRD for the specific project we are discussing.
- A Reusable Project Kickstart Template: A version of the PRD that is scrubbed of project-specific details and filled with helpful examples, making it a reusable tool for future planning.
👇
- Project Vision: [ e.g., "To create an engaging, seamless, and real-time shared experience for tabletop gamers playing online."]
- Problem Statement: [ e.g., "Digital dice rollers often feel isolated... This project solves that by creating a single, public, web-based 'table' where all dice rolls are visible to all participants in real-time."]
- Target Audience: [ e.g., "Tabletop RPG players and game masters playing online who need a quick, easy, and shared method for rolling dice."]
- Success Metrics: [ e.g., "1. A user can successfully roll animated 3D dice. 2. Real-time updates occur with <500ms latency. 3. Supports 20 concurrent users without noticeable degradation."]
- Frontend:
- Framework: [ e.g., React]
- Build Tool: [ e.g., Vite]
- Key Dependencies & APIs: [ e.g.,
react-three-fiber
for 3D rendering,socket.io-client
for WebSockets]
- Backend:
- Framework: [ e.g., Node.js with Express]
- Key Dependencies & APIs: [ e.g.,
Socket.IO
for WebSockets,Nodemon
for development]
- Deployment Environment: [ e.g., Vercel, Netlify, AWS, Google Cloud Run]
[ e.g., "The Node.js/React stack provides a cohesive JavaScript ecosystem. Socket.IO is the industry standard for the required real-time features. react-three-fiber
is chosen specifically to meet the complex 3D rendering requirements."]
[]
ID | Description | User Story | Expected Behavior/Outcome |
---|---|---|---|
FR001 | e.g., View Other Users' Rolls | As a user, I want to see the dice being rolled by other people in real-time so we can all share the experience. | When another user initiates a roll, their dice should appear and animate on my screen in the location they clicked, rendered in their assigned color. |
[]
ID | Description | User Story | Expected Behavior/Outcome |
---|---|---|---|
FEAT01 | e.g., Dice Collision Physics | As a user, I want my dice to be able to physically collide with other dice on the table for a more fun and realistic experience. | The system will implement a server-side physics engine. Dice will be treated as physical objects that collide and impart force on each other realistically, synchronized across all clients. |
Decision: [ e.g., "The initial technology stack is confirmed and adopted."]
[ e.g., "The detailed requirements, particularly FR007 (real-time rolls) and FR014 (cursor display), strongly validate the choice of Socket.IO. The 3D animation requirement in FR005 makes react-three-fiber
the best choice. The stack is confirmed as it fully supports all V1 requirements and is scalable for V2."]
[ e.g., "Node.js v18.x or later and npm are required. They can be downloaded from the official Node.js website."]
[ e.g., "ESLint, Prettier - Code formatter"]
[] e.g.,
- Backend (
/server
):cd server npm init -y npm install express socket.io
- Frontend (
/client
):# From root directory npm create vite@latest client -- --template react-ts cd client npm install socket.io-client
[] e.g.,
- Terminal 1 (from
/server
):npm start
- Terminal 2 (from
/client
):npm run dev
- Project Vision: To create an engaging, seamless, and real-time shared experience for tabletop gamers playing online. The application will be a virtual dice-rolling canvas where multiple users can roll polyhedral dice and instantly see each other's results, bringing a sense of communal play to remote gaming sessions.
- Problem Statement: When playing tabletop roleplaying games like Dungeons & Dragons remotely, players lack a shared, tactile experience. Digital dice rollers often feel isolated, with each person rolling on their own app or device. This project solves that by creating a single, public, web-based "table" where all dice rolls are visible to all participants in real-time.
- Target Audience: Dungeons & Dragons players, other tabletop RPG players, and game masters who are playing together online and need a quick, easy, and shared method for rolling dice.
- Success Metrics:
- A user can visit the website and successfully roll dice that are animated in 3D.
- When multiple users are on the site, they can see the dice rolled by other users in real-time (<500ms latency).
- The application can support at least 20 concurrent users without a noticeable degradation in performance.
- Frontend:
- Framework: React
- Build Tool: Vite
- 3D Rendering & Animation:
react-three-fiber
(a React renderer for Three.js) will be used to create, animate, and display the 3D dice. - Real-Time Client:
socket.io-client
will manage the WebSocket connection to the backend server.
- Backend:
- Framework: Node.js with Express
- Real-Time Server: Socket.IO will be integrated with the Express server to handle real-time events.
- Development Utility:
nodemon
will be used for automatic server restarts during development.
- Deployment Environment: To be determined, but will be a Node.js compatible environment (e.g., Vercel, Netlify, Heroku, AWS).
This technology stack was chosen as a starting point for the following reasons:
- Node.js, Express, and React (with Vite) provide a cohesive, full-stack JavaScript/TypeScript ecosystem. This allows for a single language and shared data models, simplifying development. Vite is chosen for its modern, fast development experience.
- Socket.IO is the industry standard for handling real-time, event-based communication. It is purpose-built for the core feature of this project: broadcasting actions to all connected users instantly.
react-three-fiber
is a powerful and declarative library for creating 3D scenes in React. It is specifically chosen to meet the requirement of rendering animated, 3D dice where the result is visible on the die's face, which is a complex visual task.
This table lists the essential features required for the initial release of Synchro-Dice.
ID | Description | User Story | Expected Behavior/Outcome |
---|---|---|---|
FR001 | View the Interface | As a user, when I first visit the website, I want to see the dice selection controls and the rolling area so I know how to use the app. | The system should display a toolbar at the top of the screen containing dropdowns for die type and quantity. The rest of the screen should be a clearly defined "rolling area." |
FR002 | Select Die Type | As a user, I want to be able to choose the type of die I'm about to roll so I can make the correct roll for my game. | The "die type" dropdown should contain the options: d4, d6, d8, d10, d12, d20, and d100. The user's selection is stored as the active die type. |
FR003 | Select Die Quantity | As a user, I want to be able to choose how many dice I roll at once so I can perform actions like rolling for damage. | The "quantity" dropdown should contain the numbers 1 through 10. The user's selection is stored as the active quantity. |
FR004 | Initiate a Dice Roll | As a user, I want to be able to click on the main screen to start rolling my dice. | When the user clicks in the "rolling area," a roll event is triggered using the active selections. The roll only triggers if no dice are currently animating for that user. |
FR005 | View Own Dice Roll | As a user, I want to see my dice animate and land on a result so I know what I rolled. | 3D dice appear at the click location, animate for 2-3 seconds, and settle on a random face. The result is visible on the upward-facing side. |
FR006 | Receive a Unique Color | As a new user, I want to be assigned a unique color for my dice so that my rolls can be distinguished from others. | The server assigns each new user a unique, visually distinct color for their session, used to render all their dice and UI elements. |
FR007 | View Other Users' Rolls | As a user, I want to see the dice being rolled by other people on the website in real-time so we can all share the experience. | When another user rolls, their dice appear and animate on my screen in the location they clicked, rendered in their assigned color. |
FR008 | Display Total Result | As a user, I want to see the sum of my roll clearly displayed so I don't have to add up the dice myself. | A small UI element appears near the settled dice, displaying the total sum. This element is colored with the user's unique color. |
FR009 | Clear Previous Rolls | As a user, I want my previous roll to disappear when I start a new one so the screen doesn't get cluttered. | When a user initiates a new roll, their own previously rolled dice and result display are removed from the screen. |
FR010 | Handle Concurrent Rolls | As a user, I want the application to handle multiple people rolling dice at the same time without breaking or lagging. | The system must process and broadcast dice roll events from different users concurrently, with independent and smooth animations on all clients. |
FR011 | Prevent Roll Spamming | As a user, I should not be able to trigger a new roll while my current dice are still animating. | Clicks in the "rolling area" by a user are ignored if that same user has a roll animation in progress. |
FR012 | Prevent Roll Overlap | As a user, I want to be prevented from rolling my dice on top of another user's settled dice so that results are clearly visible. | The system defines a "no-roll zone" around settled dice. Clicks within this zone do not initiate a roll. |
FR013 | Responsive Layout | As a user, I want the application to look good and function correctly on different screen sizes, including mobile phones. | UI elements must adapt to the viewport, ensuring the rolling area and controls are usable on both desktop and mobile devices. |
FR014 | Real-time Cursor Display | As a user, I want to see the mouse cursors of other connected users so I can feel a greater sense of presence. | Each user's cursor is displayed in real-time on all other clients' screens, rendered in the user's assigned color. Coordinate broadcasts are throttled for performance. |
FR015 | Name Generation & Legend | As a user, I want to be assigned a random name and see a list of all connected users and their colors so I know who is who. | The server assigns each user a random name. A legend is displayed on-screen, listing all users' names with their color. The legend updates as users join/leave. |
This table lists high-impact features to be considered for development after the successful launch of Version 1.0.
ID | Description | User Story | Expected Behavior/Outcome |
---|---|---|---|
FEAT01 | Dice Collision Physics | As a user, I want my dice to be able to physically collide with other dice on the table for a more fun and realistic experience. | The system will implement a server-side physics engine. Dice will be treated as physical objects that collide and impart force on each other realistically, synchronized across all clients. |
FEAT02 | Real-time Text Chat | As a user, I want to be able to send and receive text messages with other users so we can communicate directly within the app. | A chat panel will be added. When a user sends a message, it appears in the history of all connected clients, prefixed with their name. |
After a thorough definition of the functional requirements for Version 1.0, the initially proposed technology stack has been re-evaluated.
Decision: The initial technology stack is confirmed and adopted.
The detailed requirements have validated our initial choices. Here is a summary of the reasoning:
-
React (with Vite) &
react-three-fiber
: This combination remains the ideal choice. The requirements for a highly interactive and responsive UI (FR001, FR013), including complex elements like the user legend (FR015), are well-suited to React's component-based architecture. More critically, the non-negotiable requirement for animated 3D dice (FR005) makesreact-three-fiber
the premier tool for the job within the React ecosystem. -
Node.js / Express & Socket.IO: This backend combination is strongly reinforced by the detailed requirements. The core of the application is real-time event broadcasting, which is central to FR007 (View Other Users' Rolls), FR010 (Handle Concurrent Rolls), and FR014 (Real-time Cursor Display). Socket.IO is purpose-built for this. Express provides a minimal and efficient framework to manage user connections and session data.
Future Considerations: The "Future Enhancements" also align with this stack. Implementing physics for dice collisions (FEAT01) can be achieved with libraries like cannon-es
, and real-time chat (FEAT02) is a textbook use case for Socket.IO. The chosen stack is not only sufficient for our MVP but is also scalable for our V2 roadmap.
This guide outlines the steps to create a local development environment for this project using Visual Studio Code. It assumes the developer is familiar with standard development practices.
- Node.js & npm: Node.js version 18.x or later and npm are required. They can be downloaded from the official Node.js website.
- Visual Studio Code: The latest version of VS Code is recommended.
For an optimal development experience with this stack, it is highly recommended to install the following extensions:
- ESLint: Integrates ESLint into VS Code.
- Prettier - Code formatter: An opinionated code formatter.
The project will use a monorepo-like structure with two main folders: server
for the backend and client
for the frontend.
-
Create the Root Directory:
mkdir synchro-dice cd synchro-dice mkdir server
-
Backend Setup (
/server
):- Navigate into the server directory:
cd server
- Initialize a Node.js project:
npm init -y
- Install dependencies:
npm install express socket.io
- Install development dependencies:
npm install --save-dev nodemon
- In
package.json
, add astart
script:"start": "nodemon index.js"
- Create a root file
index.js
.
- Navigate into the server directory:
-
Frontend Setup (
/client
):- Navigate back to the root directory:
cd ..
- Create a new React project using Vite (TypeScript is recommended):
npm create vite@latest client -- --template react-ts
- Navigate into the new client project:
cd client
- Install dependencies:
npm install socket.io-client @react-three/fiber @react-three/drei three
- Navigate back to the root directory:
To run the full application for development, you will need two separate terminal instances:
- Terminal 1 (from
/server
):npm start
- Terminal 2 (from
/client
):npm run dev