Backend API for managing Magic: The Gathering collections and decks.
Built with Python, FastAPI, PostgreSQL, SQLAlchemy, and Alembic.
- Python
- FastAPI
- PostgreSQL
- SQLAlchemy
- Alembic
- Create collections
- Update collections
- Collection-card relationships
- PostgreSQL persistence
- Alembic migrations
- REST API structure
magic-inventory-app/
│
├── alembic/
├── models/
├── routers/
├── schemas/
├── database.py
├── main.py
├── requirements.txt
├── alembic.ini
└── README.md
git clone <your-repository-url>
cd magic-inventory-apppython -m venv venvWindows:
venv\Scripts\activateMac/Linux:
source venv/bin/activatepip install -r requirements.txtThis 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 headuvicorn main:app --reloadServer will run at:
http://127.0.0.1:8000
FastAPI automatically generates documentation:
http://127.0.0.1:8000/docs
http://127.0.0.1:8000/redoc
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
- Add cards to collections
- Deck statistics
- Card search
- Authentication system
- Import/export decks
- User accounts
- Favorites system
Samuel Giraldo Astronomer | Python Developer