An open API service indexing awesome lists of open source software.

https://github.com/noqqe/serra

Personal Magic: The Gathering Collection Tracker
https://github.com/noqqe/serra

finance golang magic magic-the-gathering mongodb mtg

Last synced: 3 months ago
JSON representation

Personal Magic: The Gathering Collection Tracker

Awesome Lists containing this project

README

          

# serra

Serra is my personal *Magic: The Gathering* collection tracker.

It began as a holiday project in winter 2021/2022 because I was frustrated of
Collection Tracker Websites that are:

* Pain to use
* Want ~$10 a month
* Don't have the features I want

So I started my own Collection Tracker using [Golang](https://golang.org),
[MongoDB](https://mongodb.com) and [Scryfall](https://scryfall.com) to have
an overview in what cards you own and what value they have.

**What Serra does**

* Tracks prices
* Calculates statistics
* Query/filter all of your cards
* Shows what cards/sets do best in value development.

**What Serra does not**

* Does not care about conditions (NM, M, GD...)
* Does not track etched cards. Only normal and foil.

# Quickstart

## Install Binaries

on macOS you can use

brew install noqqe/tap/serra

on Linux/BSD/Windows you can download binaries from

https://github.com/noqqe/serra/releases

## Spin up Database

To run serra, a MongoDB Database is required. The best way is to setup one by yourself. Any way it connects is fine.

docker run -d -p 27017:27017 --name mongo mongo:8

For "production" use this docker command is not recommended since it does not have persistent storage.

## Configure the Database

Configure `serra` via Environment variables

export MONGODB_URI='mongodb://localhost:27017'
export SERRA_CURRENCY=USD # or EUR

After that, you can add a card

./serra add usg/17
./serra update

Start exploring :) (the more cards you add, the more fun it is)

# Usage

The overall usage is described in `--help` text. But below are some examples.
```
Usage:
serra [command]

Available Commands:
add Add a card to your collection
card Search & show cards from your collection
check Check if a card is in your collection
completion Generate the autocompletion script for the specified shell
flops What cards lost most value
help Help about any command
missing Display missing cards from a set
remove Remove a card from your collection
set Search & show sets from your collection
stats Shows statistics of the collection
tops What cards gained most value
update Update card values from scryfall
web Startup web interface

Flags:
-h, --help help for serra
-v, --version version for serra

Use "serra [command] --help" for more information about a command.
```

## Add

To add a card to your collection.

![](https://github.com/noqqe/serra/blob/main/imgs/add.png)

## Cards

Query all of your cards with filters

![](https://github.com/noqqe/serra/blob/main/imgs/cards.png)

## Sets

List all your sets

![](https://github.com/noqqe/serra/blob/main/imgs/sets.png)

## Set

Show details of a single set

![](https://github.com/noqqe/serra/blob/main/imgs/set.png)

## Stats

Calculate some stats for all of your cards

![](https://github.com/noqqe/serra/blob/main/imgs/stats.png)

## Tops

Show what cards/set gained most value

![](https://github.com/noqqe/serra/blob/main/imgs/tops.png)

## Flops

Show what cards/set lost most value

![](https://github.com/noqqe/serra/blob/main/imgs/flops.png)

## Update

The update mechanism iterates over each card in your collection and fetches
its price. After all cards you own in a set are updated, the set value will
update. After all Sets are updated, the whole collection value is updated.

![](https://github.com/noqqe/serra/blob/main/imgs/update.png)

## Check

To add a card to your collection.

![](https://github.com/noqqe/serra/blob/main/imgs/check.png)

## Adding all those cards, manually?

Yes. While there are serveral OCR/Photo Scanners for mtg cards, I found they
are not accurate enough. They guess Editions wrong, they have problems with
blue/black cards and so on.

I add my cards the `add --interactive` feature, since they are sorted by editions
anyways.

```
> ./serra add --interactive --unique --set one
one> 1
1x "Against All Odds" (uncommon, 0.06 USD) added to Collection.
one> 1
Not adding "Against All Odds" (uncommon, 0.06 USD) to Collection because it already exists.
one> 3
1x "Apostle of Invasion" (uncommon, 0.03 USD) added to Collection.
```

It also supports ranges of cards
```
dmr> 1-3
1x "Auramancer" (common, 0.02$) added to Collection.
1x "Battle Screech" (uncommon, 0.09$) added to Collection.
1x "Cleric of the Forward Order" (common, 0.01$) added to Collection.
```

Its basically typing 2-3 digit numbers and hitting enter. I was way faster
with this approach then Smartphone scanners.

# Upgrade

If you want to upgrade, go to
[releases](https://github.com/noqqe/serra/releases) Page and download the
corresponding release for your platform.

For example:
```
wget https://github.com/noqqe/serra/releases/download/3.10.0/serra_Darwin_x86_64.tar.gz
tar zxfv serra_Darwin_x86_64.tar.gz
./serra
```

## Upgrade Notes

### 3.x.x -> 4.x.x

No extra steps needed

### 2.x.x -> 3.x.x

No extra steps needed. Only new Webinterface and Foil support

### 1.5.3 -> 2.0.0

In this stage of the development of serra, I was breaking the original database
"schema" without migration.

Sadly you need to export the cards from the mongodb and import it again using
`serra add ` commands

I wrote a little helper script in python to export all the cards in format
set/number and generate some queries

```
python3 export.py > add_commands.sh

head add_commands.sh
./serra add 5ed/3 -c 1
./serra add mmq/2 -c 1
./serra add p02/4 -c 1
./serra add chr/44 -c 1
./serra add 4ed/291 -c 1
./serra add 4ed/292 -c 1
./serra add mir/2 -c 1
./serra add usg/231 -c 1
./serra add mir/155 -c 1
./serra add pcy/29 -c 2

bash add_commands.sh
```

# Development

## Install

go build .
./serra