paper-dynasty-gameplay-webapp/app
Cal Corum c09f9d1302 CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture
Establishes foundation for migrating baseball simulation from Discord bot to web application using service-oriented architecture pattern.

Key components:
- FastAPI application structure with dependency injection
- Service layer foundation with base classes and container
- Comprehensive directory documentation with README files
- PostgreSQL containerization with Docker Compose
- Testing structure for unit/integration/e2e tests
- Migration planning documentation
- Rotating log configuration per user requirements

Architecture follows Model/Service/Controller pattern to improve testability, maintainability, and scalability over original monolithic Discord app.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 21:44:12 -05:00
..
config CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
engine CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
models CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
repositories CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
routers CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
services CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
templates CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
__init__.py CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
main.py CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00
README.md CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture 2025-09-27 21:44:12 -05:00

App Directory

This directory contains the main application code for the Paper Dynasty web app, following the Model/Service Architecture pattern.

Architecture Overview

The app follows a clean separation of concerns:

  • Models (models/) - Pure data models using SQLModel
  • Services (services/) - Business logic layer with dependency injection
  • Controllers (routers/) - Thin FastAPI route handlers
  • Engine (engine/) - Stateless game simulation functions
  • Configuration (config/) - Application settings and constants

Key Files

  • main.py - FastAPI application setup and configuration
  • Entry point for the web application

Directory Structure

app/
├── main.py                 # FastAPI application setup
├── config/                 # Configuration and constants
├── models/                 # SQLModel data models
├── services/               # Business logic layer (⭐ Core of architecture)
├── repositories/           # Optional data access layer
├── routers/                # FastAPI route handlers
├── engine/                 # Stateless game simulation
├── static/                 # Static web assets
└── templates/              # Jinja2 HTML templates

Service-First Development

When adding new features:

  1. Start with services - implement business logic in the service layer
  2. Test services independently - unit test with mocked dependencies
  3. Create thin routes - delegate to services via dependency injection
  4. Keep engine stateless - pure functions for game calculations

Migration Context

This application is migrated from a Discord bot (../discord-app/) with the goal of extracting Discord-specific business logic into clean, testable services that can support multiple interfaces (web, API, mobile, etc.).