Skip to content

Ozup/magic-inventory-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic Inventory App

Backend API for managing Magic: The Gathering collections and decks.

Built with Python, FastAPI, PostgreSQL, SQLAlchemy, and Alembic.


Tech Stack

  • Python
  • FastAPI
  • PostgreSQL
  • SQLAlchemy
  • Alembic

Features

  • Create collections
  • Update collections
  • Collection-card relationships
  • PostgreSQL persistence
  • Alembic migrations
  • REST API structure

Project Structure

magic-inventory-app/
│
├── alembic/
├── models/
├── routers/
├── schemas/
├── database.py
├── main.py
├── requirements.txt
├── alembic.ini
└── README.md

Setup

1. Clone the repository

git clone <your-repository-url>
cd magic-inventory-app

2. Create virtual environment

python -m venv venv

3. Activate virtual environment

Windows:

venv\Scripts\activate

Mac/Linux:

source venv/bin/activate

4. Install dependencies

pip install -r requirements.txt

Database Configuration

This project uses PostgreSQL.

Configure your database URL inside your environment variables or database.py.

Example:

DATABASE_URL = "postgresql://postgres:password@localhost:5432/postgres"

Alembic Migrations

Generate migration:

python -m alembic revision --autogenerate -m "migration message"

Apply migrations:

python -m alembic upgrade head

Run the Server

uvicorn main:app --reload

Server will run at:

http://127.0.0.1:8000

API Documentation

FastAPI automatically generates documentation:

Swagger UI

http://127.0.0.1:8000/docs

ReDoc

http://127.0.0.1:8000/redoc

Current Models

Collection

Represents a deck or collection of cards.

Card

Represents a Magic card.

CollectionCard

Intermediate relationship table between collections and cards.

Supports:

  • quantities
  • many-to-many relationships
  • duplicate prevention

Roadmap

  • Add cards to collections
  • Deck statistics
  • Card search
  • Authentication system
  • Import/export decks
  • User accounts
  • Favorites system

Author

Samuel Giraldo Astronomer | Python Developer

About

Backend API for managing Magic: The Gathering collections and decks using FastAPI, PostgreSQL, SQLAlchemy, and Alembic. Supports collection management, card relationships, and scalable database migrations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors