Backend API for a Magic: The Gathering inventory management application.
Built with Python, FastAPI, PostgreSQL, SQLAlchemy, and Alembic.
https://github.com/TU-USUARIO/magic-inventory-app-frontend
- Python
- FastAPI
- PostgreSQL
- SQLAlchemy
- Alembic
- Scryfall API
- Create collections
- Update collections
- Delete collections
- Add cards by name
- Remove cards from collections
- Quantity controls
- Card filtering
- Card sorting
- Card search
- Card autocomplete search
- Collection-card relationships
- PostgreSQL persistence
- Alembic migrations
- REST API structure
- Scryfall integration
- Deck validation
magic-inventory-app-backend/
│
├── alembic/
├── models/
├── routers/
├── schemas/
├── database.py
├── main.py
├── requirements.txt
├── alembic.ini
└── README.md
git clone cd magic-inventory-app-backend
python -m venv venv
Windows:
venv\Scripts\activate
Mac/Linux:
source venv/bin/activate
pip install -r requirements.txt
This project uses PostgreSQL.
Configure your database URL inside your environment variables or database.py.
Example:
DATABASE_URL = "postgresql://postgres:password@localhost:5432/postgres"
Generate migration:
python -m alembic revision --autogenerate -m "migration message"
Apply migrations:
python -m alembic upgrade head
uvicorn main:app --reload
Server will run at:
FastAPI automatically generates documentation.
Represents a deck or collection of cards.
Represents a Magic card.
Intermediate relationship table between collections and cards.
Supports:
- quantities
- many-to-many relationships
- duplicate prevention
- FastAPI
- PostgreSQL
- SQLAlchemy
- React
- TypeScript
- Axios
- React Router
- Scryfall API
- Print-specific card versions
- Deck analytics dashboard
- Authentication system
- User accounts
- Collection completion tracking
- Mobile responsive UI
- Import/export deck lists
Samuel Giraldo
Astronomer | Python Developer