Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

EDHRemixer

A web application for managing and optimizing Magic: The Gathering EDH (Elder Dragon Highlander) collections and decks using Moxfield integration.

Architecture

This application consists of two main components:

Frontend (Angular SPA)

  • Located in /frontend directory
  • Built with Angular 18
  • Provides a clean, user-friendly interface for collection management
  • Communicates with the Flask API backend

Backend (Flask API)

  • Located in /api directory
  • Python Flask REST API
  • Handles Moxfield integration
  • Processes card shuffling and optimization logic

Features

  • Collection Management: Add and manage Moxfield decks and binders
  • Type Classification: Mark collections as Source or Target
  • Reshuffle Engine: Optimally redistribute cards between collections
  • Sortable Interface: Sort collections by name, URL, or type
  • Excel Export: Download reshuffled collection data as Excel files

Development Setup

Prerequisites

  • Python 3.12+
  • Node.js 18+
  • npm

Backend Setup

cd api
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt

Frontend Setup

cd frontend
npm install

Running Locally

  1. Start the Flask API:
cd api
source .venv/bin/activate
python app.py

The API will run on http://localhost:5000

  1. In another terminal, start the Angular dev server:
cd frontend
npm start

The frontend will run on http://localhost:4200

Note: The Angular dev server is configured with a proxy (proxy.conf.json) that forwards /api/* requests to the Flask backend at http://localhost:5000.

Docker Deployment

Building and Running with Docker

This application includes a multi-stage Dockerfile that builds both the Angular frontend and Python backend into a single container.

Local Docker Build

docker build -t edh-remixer:latest .
docker run -p 8000:8000 edh-remixer:latest

The application will be available at http://localhost:8000

Using GitHub Container Registry

The application automatically builds and pushes Docker images to GitHub Container Registry (GHCR) on every push to the main or master branch.

Pull the latest image:

docker login ghcr.io
docker pull ghcr.io/rm2631/edhremixer:latest
docker run -p 8000:8000 ghcr.io/rm2631/edhremixer:latest

Pull a specific version (by commit SHA):

docker pull ghcr.io/rm2631/edhremixer:<commit-sha>
docker run -p 8000:8000 ghcr.io/rm2631/edhremixer:<commit-sha>

View build logs: Navigate to your repository's Actions tab to see Docker build logs and history.

Deployment on Render

This application is configured for deployment on Render using the render.yaml blueprint.

Deployment Steps

  1. Push your code to GitHub
  2. Connect your repository to Render
  3. Render will automatically detect the render.yaml file
  4. The build process will:
    • Install Python dependencies
    • Build the Angular application
    • Configure the Flask app to serve the Angular SPA

Environment Variables

No additional environment variables are required for basic operation. All Moxfield API calls are made server-side.

  • LOG_LEVEL (optional, default INFO) - Console log verbosity (DEBUG, INFO, WARNING, ERROR). Outbound calls to Moxfield and EDHRec are logged at INFO (URL, status, latency); DEBUG also shows cache hits and low-level HTTP library logs.

API Endpoints

  • GET /api/health - Health check endpoint
  • POST /api/deck-name - Get deck name from Moxfield URL
    • Body: {"url": "https://www.moxfield.com/decks/..."}
  • POST /api/reshuffle - Process card redistribution
    • Body: Array of collections with name, url, and is_source fields

Project Structure

EDHRemixer/
├── api/                      # Flask backend
│   ├── app.py               # Main Flask application
│   ├── models/              # Data models
│   ├── services/            # Business logic
│   └── requirements.txt     # Python dependencies
├── frontend/                 # Angular frontend
│   ├── src/
│   │   ├── app/            # Angular components and services
│   │   ├── environments/   # Environment configuration
│   │   └── styles.css      # Global styles
│   ├── angular.json         # Angular CLI configuration
│   └── package.json         # Node dependencies
├── models/                   # Shared models (legacy)
├── services/                 # Shared services (legacy)
├── render.yaml              # Render deployment configuration
├── Dockerfile               # Multi-stage Docker build configuration
├── .github/
│   └── workflows/
│       └── docker-build.yml # GitHub Actions workflow for Docker builds
└── README.md                # This file

Legacy Files

The following files are from the previous Streamlit implementation and are kept for reference:

  • main.py - Original main application logic
  • test.py - Test file

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages