# Project Structure ## Directory Layout ``` dwroller/ ├── backend/ # Backend API server │ ├── src/ │ │ ├── routes/ # API route handlers │ │ ├── controllers/ # Route controllers │ │ ├── middleware/ # Auth, validation middleware │ │ ├── models/ # Data models │ │ └── utils/ # Helper functions │ ├── server.js # Express server entry point │ └── package.json │ ├── frontend/ # React frontend application │ ├── src/ │ │ ├── components/ # React components │ │ ├── pages/ # Route pages │ │ ├── hooks/ # Custom React hooks │ │ └── store/ # State management │ ├── public/ # Static assets │ ├── package.json │ └── vite.config.js │ ├── data/ # Static data files │ ├── gamemasters_kit/ # GM tools │ ├── ocr_rules_*.txt # OCR extracted rules │ ├── rules_page.png # Rules images │ └── dwback.png # Background images │ ├── database/ # Database files │ ├── backups/ # Database backups │ ├── MIGRATION_*.md # Migration documentation │ └── alexei-*.json # Canonical data │ ├── docs/ # This documentation │ ├── SUMMARY.md # Table of contents │ ├── api.md # API documentation │ ├── developer-guide.md │ ├── user-guide.md │ └── ... │ ├── .env.example # Environment template ├── package.json # Root package.json └── README.md # Project overview ``` ## Feature Architecture ``` ┌─────────────────────────────────────────────────────────┐ │ Deathwatch Roller │ ├─────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Frontend │───▶│ API │───▶│ Database │ │ │ │ (React) │ │ (Express) │ │ (SQLite) │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ - Shop - Auth - Players │ │ - Bestiary - Sessions - Inventory │ │ - Rules - Files - Webhooks │ │ - Sessions - Validation - Backups │ └─────────────────────────────────────────────────────────┘ ``` ## Data Flow ``` User Request │ ▼ ┌───────────┐ │ Frontend │ │ (React) │ └───────────┘ │ ├──────────────┬──────────────┐ ▼ ▼ ▼ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ Shop │ │ Bestiary│ │ Sessions│ │ API │ │ API │ │ API │ └─────────┘ └─────────┘ └─────────┘ │ │ │ └──────────────┴──────────────┘ │ ▼ ┌───────────┐ │ Backend │ │ (Express) │ └───────────┘ │ ▼ ┌───────────┐ │ Database │ │ (SQLite) │ └───────────┘ ``` ## File Organization by Feature ### Shop/Inventory - `backend/src/routes/shop/` - Shop API routes - `backend/src/models/Item/` - Item model - `backend/src/controllers/shop/` - Shop controller - `frontend/src/components/Shop/` - Shop UI components ### Bestiary - `backend/src/routes/bestiary/` - Bestiary routes - `backend/src/models/Creature/` - Creature model - `backend/src/controllers/bestiary/` - Bestiary controller - `frontend/src/components/Bestiary/` - Bestiary UI ### Players - `backend/src/routes/players/` - Player routes - `backend/src/models/Player/` - Player model - `backend/src/controllers/players/` - Player controller - `frontend/src/components/Players/` - Player UI (GM only)