| cmd | ||
| database | ||
| db | ||
| generated | ||
| models | ||
| ui | ||
| utils | ||
| .envrc | ||
| .gitignore | ||
| AGENTS.md | ||
| flake.lock | ||
| flake.nix | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| NAVIGATION_FEATURE_DOCS.md | ||
| README.md | ||
MTG Deck Manager
THIS REPOSITORY WILL NOT GET MORE UPDATES. CURRENTLY REWRITTING FROM SCRATCH ON https://forgejo.fairlabs.dev/ferrumboll/taplands
A terminal-based Magic: The Gathering deck management application built with Go and Bubble Tea.
Features
- Card Search: Search through the entire MTG card database
- Deck Management: Create, edit, and manage multiple decks
- Collection Management: Organize your card collection
- Commander Support: Full support for Commander/EDH deck building
- Standard Format: Support for Standard format deck building
- Card Previews: Detailed card information with mana costs, text, and artwork info
- Terminal UI: Beautiful terminal interface with keyboard navigation
- Contextual Navigation: Seamlessly add cards to collections/decks from their card view
Installation
Prerequisites
- Go 1.21 or higher
- SQLite3
Build from Source
Clone the repository
git clone cd mtg-deck-manager
Install dependencies
go mod download
Build the application
go build -o mtg-deck-manager ./cmd/main.go
Usage
On first run, the application will download the MTG card database (~80MB) from mtgjson.com. This is a one-time process.
Navigation
- Main Menu: Use ↑/↓ arrow keys to navigate, Enter to select
- Search: Press 'f' or '/' to start searching for cards
- Collections: Press 'a' to add selected card to a collection
- Decks: Press 'd' to add selected card to a deck
Contextual Card Addition Workflow
The application supports a seamless workflow for adding cards to collections and decks:
- View Collection/Deck: Navigate to a collection or deck and press Enter to view its cards
- Add More Cards: While viewing cards, press Enter to search for more cards to add
- Direct Addition: In the search view, press Enter on any card to add it directly to the source collection/deck
- Auto-Return: After adding a card, you're automatically returned to the collection/deck view
- Updated View: The collection/deck view refreshes to show your newly added card
This workflow eliminates the need to manually select collections/decks when adding cards, making deck building faster and more intuitive.
Keyboard Shortcuts
Global
qorctrl+c: Quit application or return to previous screen↑/k: Move cursor up↓/j: Move cursor downEnter: Select item
Navigation
- Main Menu: Use ↑/↓ arrow keys to navigate, Enter to select
- Search: Press 'f' or '/' to start searching for cards
- Collections: Press 'a' to add selected card to a collection
- Decks: Press 'd' to add selected card to a deck
Search Mode
for/: Start searchinga: Add card to collection (when not navigated from a collection)d: Add card to deck (when not navigated from a deck)Enter: Add card to source collection/deck (when navigated from collection/deck view)q: Return to source view
Note: When you navigate to search from a collection or deck, the help text at the bottom shows which collection/deck cards will be added to. For example: "Enter to add to My Collection"
Deck Management
n: Create new decke: Edit deck namet: Edit deck typed: Delete deckEnter: View deck contents- When viewing cards: Press
Enterto search and add more cards ←/→: Adjust card quantityd: Remove card from deck
- When viewing cards: Press
Collection Management
n: Create new collectione: Edit collection named: Delete collectionEnter: View collection contents- When viewing cards: Press
Enterto search and add more cards ←/→: Adjust card quantityd: Remove card from collection
- When viewing cards: Press
Deck Types
Standard
- Minimum 60 cards
- Maximum 4 copies of any card (except basic lands)
- 15-card sideboard (optional)
Commander
- Exactly 100 cards
- Only 1 copy of any card (except basic lands)
- Must have a legendary creature as commander
- Color identity restrictions apply
Database
The application uses two SQLite databases:
- MTG Database: Contains all MTG card information (downloaded from mtgjson.com)
- User Database: Stores your collections and decks
Development
Project Structure
├── cmd/ # Application entry point ├── database/ # Database layer │ ├── config/ # Database configuration │ ├── generated/ # Auto-generated database models │ ├── mtg_db/ # MTG card database operations │ └── user_db/ # User data operations ├── run_models/ # Runtime data models ├── ui/ # Terminal user interface └── utils/ # Utility functions
Adding New Features
- Database Changes: Update migrations in
database/migrations/ - Models: Add new models in
run_models/ - UI: Create new UI components in
ui/ - Database Operations: Add new queries in
database/user_db/
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License
- see the LICENSE file for details.
Acknowledgments
- MTGJSON for providing the card database
- Bubble Tea for the terminal UI framework
- Jet for SQL query generation