Skip to content

Rules API for Magic: The Gathering

License

Notifications You must be signed in to change notification settings

lunakv/academyruins-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

fde8641 · Feb 16, 2025
Oct 1, 2023
Feb 7, 2024
Feb 16, 2025
Jun 17, 2023
Feb 12, 2023
Oct 1, 2023
Oct 1, 2023
Jun 29, 2022
Mar 5, 2023
Sep 27, 2022
Oct 1, 2023
Sep 9, 2023
Jun 6, 2023
Feb 15, 2025
Feb 16, 2025
Sep 28, 2022

Repository files navigation

Academy Ruins API

Programmatic resources for Magic: the Gathering rules documents.

About

This API provides access to various versions of MTG rules documents (CR, MTR, IPG), both in their raw form and (for the CR) as a structured JSON. It also contains diffs of those documents, and links to the most up-to-date version of them.

It is used to power the Academy Ruins project and utilized by several other MTG-related sites and services.

Setup

Prerequisites

  • Python 3.10 or later
  • PostgreSQL 14
  • (optional) Pushover account
  • (recommended) Working Java installation

Installation

  1. Install the Poetry package manager
  2. poetry install
  3. Start Postgres and create a user and database for your API.
  4. cp .env_EXAMPLE .env
  5. Adjust the values in your .env file according to your local configuration
  6. poetry run ./update_schema.sh to load the current schema into the database.

Run

poetry run python devstart.py

The API server will start on port 8000 by default.

Containers

For production deployments, there's a prepared Dockerfile and docker-compose.yml file you can inspect and use to run the API fully contained in a Docker container. Note that if you're running Postgres in a container and want to use psql from the host machine, you have to map port 5432 to the host and specify the --host localhost flag in any psql command in order to connect successfully.

Documentation

The full API docs are available at https://api.academyruins.com/docs

Data

All data used by the site, both raw and processed, is periodically backed up to public a Backblaze B2 (S3 compatible) bucket. You can view the contents of this bucket at https://backup.academyruins.com If you need bulk/programatic access to that data for some reason, send me a message through one of the channels specified on the site.